2018-10-01 02:03:34 +00:00
|
|
|
description "Emscripten build environment"
|
|
|
|
fetch_git https://github.com/juj/emsdk.git
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
./emsdk install latest
|
|
|
|
./emsdk activate latest
|
|
|
|
}
|
|
|
|
|
|
|
|
make_wrapper_script() {
|
|
|
|
local toolname emtoolname path
|
|
|
|
toolname="$1"
|
|
|
|
emtoolname="$2"
|
2018-10-01 02:40:43 +00:00
|
|
|
path="$PACKAGE_INSTALL_DIR/bin/asmjs-local-emscripten-$toolname"
|
2018-10-02 01:46:27 +00:00
|
|
|
mkdir -p "$PACKAGE_INSTALL_DIR/bin"
|
2018-10-01 02:03:34 +00:00
|
|
|
(echo "#!/bin/bash"
|
2018-10-02 01:48:53 +00:00
|
|
|
echo ". $PACKAGE_BUILD_DIR/emsdk_env.sh >/dev/null"
|
2018-10-01 02:03:34 +00:00
|
|
|
echo "export EMCC_CFLAGS='-s ERROR_ON_MISSING_LIBRARIES=1'"
|
|
|
|
echo "exec $emtoolname \"\$@\"") > "$path"
|
|
|
|
chmod a+rx "$path"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Emscripten is a weird beast, and wants us to use all its weird tools
|
|
|
|
# (emconfigure, emmake, etc.). Instead of that, we define a "fake" system
|
2018-10-01 02:40:43 +00:00
|
|
|
# named asmjs-local-emscripten and create wrapper scripts for all the
|
2018-10-01 02:03:34 +00:00
|
|
|
# necessary compile tools. Then we can build like any other normal
|
|
|
|
# cross-compile system.
|
|
|
|
do_install() {
|
|
|
|
make_wrapper_script ar emar
|
|
|
|
make_wrapper_script gcc emcc
|
|
|
|
make_wrapper_script g++ em++
|
|
|
|
make_wrapper_script ld emcc
|
|
|
|
make_wrapper_script nm llvm-nm
|
|
|
|
make_wrapper_script ranlib emranlib
|
|
|
|
}
|
|
|
|
|
2018-10-01 02:40:43 +00:00
|
|
|
check_tool asmjs-local-emscripten-gcc
|
2018-10-01 02:03:34 +00:00
|
|
|
|