diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-03-31 20:50:34 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-03 00:33:48 +0200 |
commit | 8d0158e08f0eb769c2208d23e46673f7cb705189 (patch) | |
tree | 20f79571a571c6681aae3ff175182bac412823b6 /testing | |
parent | 14286b372051d27be543244666881f79198c0cbf (diff) | |
download | aports-8d0158e08f0eb769c2208d23e46673f7cb705189.tar.bz2 aports-8d0158e08f0eb769c2208d23e46673f7cb705189.tar.xz |
testing/emscripten: fix multiple issues
Diffstat (limited to 'testing')
-rw-r--r-- | testing/emscripten/APKBUILD | 37 | ||||
-rw-r--r-- | testing/emscripten/binaryen-wasm-js-path.patch | 40 | ||||
-rw-r--r-- | testing/emscripten/embuilder-fix-task-all-for-wasm.patch | 35 | ||||
-rw-r--r-- | testing/emscripten/embuilder-omit-provided.patch | 67 | ||||
-rw-r--r-- | testing/emscripten/emscripten.cfg | 5 | ||||
-rw-r--r-- | testing/emscripten/settings_template-paths.patch | 23 |
6 files changed, 190 insertions, 17 deletions
diff --git a/testing/emscripten/APKBUILD b/testing/emscripten/APKBUILD index 60b80333a4..37dba987f1 100644 --- a/testing/emscripten/APKBUILD +++ b/testing/emscripten/APKBUILD @@ -6,7 +6,7 @@ pkgname=emscripten # Keep with sync with pkg emscrypten-fastcomp! pkgver=1.37.9 -pkgrel=0 +pkgrel=1 pkgdesc="An LLVM-to-JavaScript Compiler" url="https://kripken.github.io/emscripten-site/" arch="all" @@ -20,9 +20,24 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/kripken/$pkgname/archive/$pk settings_template-paths.patch add-system-level-config.patch move-emcc-txt.patch + binaryen-wasm-js-path.patch + embuilder-fix-task-all-for-wasm.patch + embuilder-omit-provided.patch emscripten.cfg" builddir="$srcdir/$pkgname-$pkgver" +prepare() { + default_prepare + + cd "$builddir" + + # This file is read from emcc.py for --help. + cp site/build/text/docs/tools_reference/emcc.txt . + + sed "s|/usr/share/emscripten|$builddir|" \ + "$srcdir"/emscripten.cfg > "$srcdir"/.emscripten +} + build() { cd "$builddir"/tools/optimizer @@ -39,12 +54,11 @@ build() { check() { cd "$builddir" - sed "s|/usr/share/emscripten|$builddir|" "$srcdir"/emscripten.cfg \ - > tests/.emscripten - - ./emcc --em-config tests/.emscripten \ + rm -f tests/hello_world.js + ./emcc --em-config "$srcdir"/.emscripten \ --cache "$srcdir"/.cache \ -o tests/hello_world.js tests/hello_world.c + node tests/hello_world.js } @@ -57,10 +71,8 @@ package() { cd "$destdir" - # This is read from emcc.py for --help. - cp site/build/text/docs/tools_reference/emcc.txt . - find . -name "*.bat" -delete + find . -name "*.pyc" -delete # these contain wrong absolute path rm -r docs # there are only few PDFs and TeX sources rm -r media # media for website rm -r site # a website (?) @@ -68,7 +80,7 @@ package() { rm -r third_party # bundled stuff rm -r tools/optimizer # we've already built it rm AUTHORS LICENSE *.md *.markdown package.json - rm system/lib/build_cxx_natively.sh + rm system/lib/build_cxx_natively.sh tools/update_libc_symbols.sh # garbage mkdir -p "$pkgdir"/usr/bin for name in em++ em-config emar embuilder.py emcc emcmake \ @@ -90,7 +102,10 @@ optimizer() { sha512sums="0efd9035d3dce0726025b5b8e30129885eef30f915c502b8957150e4ffc11fd0e9a2b605854cdf69ca3eb05e5102bf34341b7edd2116f5fa29fd170a28e7f07f emscripten-1.37.9.tar.gz a61e172ced6b72adb53a840255a9753905a0c7a1c9f8965345781b9cdcc8a596c4dc88f036e91bd5c05d8b3eb2908bbb7d991c4e1abcf35a46be67b9765e546a fix-python-shebang.patch -ec0dc4a5c562fb85d861c37f5b3168351921dfd7865754ff117f757f15c45ec4474c56b71cd6f50beed71d91a270f3c7ad9d27db205be8eb6637b72b0c9fca8a settings_template-paths.patch +f190ea32dcd4af2661f455ffd8773cb0f7b30ba4a96d22609e11af7186ed1a5c230f3c379d717f23213e87143bb5601acc4d75799631854d0312ff308cbcc14b settings_template-paths.patch 10a7a545f468a5f71fdf1cca0e0be983db5d21387202b851bd11f811c2a0a74f4e4c8733ae9ff933df4ea49c3f5e8e4e16fc3651bc98bb8c37a0828bb29eca7e add-system-level-config.patch 6613ef4cf41bcf0ecc13a0415cdc847f4ec112f07dd19573000ea6a9a6f2360aee6b2db01f822d117d5022dc58b2421be89fe3421c46fd6857737d07ce489c1e move-emcc-txt.patch -e485c974c465fc60ff0c81ba0a7e2c68bd2f653fff6861007d4ce29dd20c7163ba63ac1a3c449b870a8fa4642ad3ef1c8d1e6380add2db58f65553b58f626c9e emscripten.cfg" +a2a2c9b56e8d655b06fdbac2e297e07a0bbcdc3e3df7c913b5caac8ddf20f66b91ed77ac46275adcf8e92baedb5a50cb554c8f3fa59823e17006e17d8d11e820 binaryen-wasm-js-path.patch +53bb9b64222dd445e8aefbb5a4b87bc6d562ea578a6f7a04c2605703f0235633583144fe478031e650a7346ba89f6e0aaf6c435aedb8398131fa02940356bc17 embuilder-fix-task-all-for-wasm.patch +3d2fb817ea3e1dd661900df1e27bd135f39076723494b7ffbbe9e1561ae0a0e62a4ed0058301cf3e6b9a13f75adafe58dc902d4a32ade2cb16754a7fd5e542af embuilder-omit-provided.patch +579140e22c086129190026f8d2bcb4ac9bc5783f056c6a9704a74613b17483817ab9cc869c263630cd5b83a347c9d5d26cb67ef74720dbaafe709eb21aa52851 emscripten.cfg" diff --git a/testing/emscripten/binaryen-wasm-js-path.patch b/testing/emscripten/binaryen-wasm-js-path.patch new file mode 100644 index 0000000000..d2c7ab994a --- /dev/null +++ b/testing/emscripten/binaryen-wasm-js-path.patch @@ -0,0 +1,40 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Sun, 02 Mar 2017 22:42:00 +0200 +Subject: [PATCH] Allow to specify path to wasm.js + +Add configuration variable BINARYEN_WASM_JS that allows to specify location of +the Binaryen's wasm.js file. + +--- a/emcc.py ++++ b/emcc.py +@@ -1282,6 +1282,11 @@ + shared.Settings.BINARYEN_ROOT = shared.BINARYEN_ROOT + except: + pass ++ if not shared.Settings.BINARYEN_WASM_JS: ++ try: ++ shared.Settings.BINARYEN_WASM_JS = shared.BINARYEN_WASM_JS ++ except: ++ shared.Settings.BINARYEN_WASM_JS = os.path.join(BINARYEN_ROOT, 'bin', 'wasm.js') + # default precise-f32 to on, since it works well in wasm + # also always use f32s when asm.js is not in the picture + if ('PRECISE_F32=0' not in settings_changes and 'PRECISE_F32=2' not in settings_changes) or 'asmjs' not in shared.Settings.BINARYEN_METHOD: +@@ -2110,7 +2115,7 @@ + # BINARYEN_METHOD with something that doesn't use the polyfill, then we don't need it. + if not shared.Settings.BINARYEN_METHOD or 'interpret' in shared.Settings.BINARYEN_METHOD: + logging.debug('integrating wasm.js polyfill interpreter') +- wasm_js = open(os.path.join(binaryen_bin, 'wasm.js')).read() ++ wasm_js = open(shared.Settings.BINARYEN_WASM_JS).read() + wasm_js = wasm_js.replace('EMSCRIPTEN_', 'emscripten_') # do not confuse the markers + js = open(js_target).read() + combined = open(js_target, 'w') +--- a/src/settings.js ++++ b/src/settings.js +@@ -709,6 +709,7 @@ + // required for all but the smallest modules to run in V8 + var BINARYEN_ROOT = ""; // Directory where we can find Binaryen. Will be automatically set for you, + // but you can set it to override if you are a Binaryen developer. ++var BINARYEN_WASM_JS = ""; // Path to the file wasm.js, the Binaryen components compiled to JavaScript. + + var WASM = 0; // Alias for BINARYEN, the two are identical. Both make us compile code to WebAssembly. + diff --git a/testing/emscripten/embuilder-fix-task-all-for-wasm.patch b/testing/emscripten/embuilder-fix-task-all-for-wasm.patch new file mode 100644 index 0000000000..375891e6eb --- /dev/null +++ b/testing/emscripten/embuilder-fix-task-all-for-wasm.patch @@ -0,0 +1,35 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Sun, 2 Apr 2017 23:11:41 +0200 +Subject: [PATCH] embuilder: if EMCC_WASM_BACKEND, omit tasks using pthreads + from ALL + +Fixes the following error: + + $ EMCC_WASM_BACKEND=1 ./embuild build ALL + Traceback (most recent call last): + File "emscripten/src/emscripten-1.37.9/emcc", line 13, in <module> + emcc.run() + File "emscripten/src/emscripten-1.37.9/emcc.py", line 1278, in run + assert not shared.Settings.USE_PTHREADS, 'WebAssembly does not support pthreads' + AssertionError: WebAssembly does not support pthreads + +Upstream-Issue: https://github.com/kripken/emscripten/pull/5107 +--- + embuilder.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/embuilder.py b/embuilder.py +index 6674ccd..eaa762a 100755 +--- a/embuilder.py ++++ b/embuilder.py +@@ -84,6 +84,10 @@ def build_port(port_name, lib_name, params): + tasks = sys.argv[2:] + if 'ALL' in tasks: + tasks = ['libc', 'libc-mt', 'dlmalloc', 'dlmalloc_threadsafe', 'pthreads', 'libcxx', 'libcxx_noexcept', 'libcxxabi', 'gl', 'binaryen', 'bullet', 'freetype', 'libpng', 'ogg', 'sdl2', 'sdl2-image', 'sdl2-ttf', 'sdl2-net', 'vorbis', 'zlib'] ++ if os.environ.get('EMCC_WASM_BACKEND') == '1': ++ skip_tasks = {'libc-mt', 'dlmalloc_threadsafe', 'pthreads'} ++ print('Skipping building of %s, because WebAssembly does not support pthreads.' % ', '.join(skip_tasks)) ++ tasks = [x for x in tasks if x not in skip_tasks] + if os.environ.get('EMSCRIPTEN_NATIVE_OPTIMIZER'): + print 'Skipping building of native-optimizer since environment variable EMSCRIPTEN_NATIVE_OPTIMIZER is present and set to point to a prebuilt native optimizer path.' + elif hasattr(shared, 'EMSCRIPTEN_NATIVE_OPTIMIZER'): diff --git a/testing/emscripten/embuilder-omit-provided.patch b/testing/emscripten/embuilder-omit-provided.patch new file mode 100644 index 0000000000..5bdcc26f82 --- /dev/null +++ b/testing/emscripten/embuilder-omit-provided.patch @@ -0,0 +1,67 @@ +Remove task for building native_optimizer and binaryen. It's not needed, +because we ship this binary as a package. Also we don't build +emscripten-fastcomp with X86 target, so it can't be used to build this native +binary. + +--- a/embuilder.py ++++ b/embuilder.py +@@ -33,8 +33,6 @@ + libcxx_noexcept + libcxxabi + gl +- native_optimizer +- binaryen + bullet + freetype + libpng +@@ -48,14 +46,10 @@ + + Issuing 'embuilder.py build ALL' causes each task to be built. + +-It is also possible to build native_optimizer manually by using CMake. To +-do that, run ++Do not use this tool to build native_optimizer manually - it's already ++installed and configured on Alpine Linux. + +- 1. cd $EMSCRIPTEN/tools/optimizer +- 2. cmake . -DCMAKE_BUILD_TYPE=Release +- 3. make (or mingw32-make/vcbuild/msbuild on Windows) +- +-and set up the location to the native optimizer in ~/.emscripten ++If you need binaryen, install it with apk: apk add binaryen. + + ''' + sys.exit(0) +@@ -88,12 +82,6 @@ + skip_tasks = {'libc-mt', 'dlmalloc_threadsafe', 'pthreads'} + print('Skipping building of %s, because WebAssembly does not support pthreads.' % ', '.join(skip_tasks)) + tasks = [x for x in tasks if x not in skip_tasks] +- if os.environ.get('EMSCRIPTEN_NATIVE_OPTIMIZER'): +- print 'Skipping building of native-optimizer since environment variable EMSCRIPTEN_NATIVE_OPTIMIZER is present and set to point to a prebuilt native optimizer path.' +- elif hasattr(shared, 'EMSCRIPTEN_NATIVE_OPTIMIZER'): +- print 'Skipping building of native-optimizer since .emscripten config file has set EMSCRIPTEN_NATIVE_OPTIMIZER to point to a prebuilt native optimizer path.' +- else: +- tasks += ['native_optimizer'] + for what in tasks: + shared.logging.info('building and verifying ' + what) + if what in ('libc', 'dlmalloc'): +@@ -146,9 +134,7 @@ + } + ''', ['gl.bc']) + elif what == 'native_optimizer': +- build(''' +- int main() {} +- ''', ['optimizer.2.exe'], ['-O2']) ++ shared.logging.warning('native_optimizer is already installed: /usr/bin/emoptimizer. Skipping build.') + elif what == 'wasm_compiler_rt': + if shared.get_llvm_target() == shared.WASM_TARGET: + build(''' +@@ -177,7 +163,7 @@ + elif what == 'sdl2-ttf': + build_port('sdl2-ttf', 'libsdl2_ttf.bc', ['-s', 'USE_SDL=2', '-s', 'USE_SDL_TTF=2', '-s', 'USE_FREETYPE=1']) + elif what == 'binaryen': +- build_port('binaryen', None, ['-s', 'BINARYEN=1']) ++ shared.logging.warning('Run "apk add binaryen" to install binaryen. Skipping build.') + else: + shared.logging.error('unfamiliar build target: ' + what) + sys.exit(1) diff --git a/testing/emscripten/emscripten.cfg b/testing/emscripten/emscripten.cfg index 495334a771..dbfc07185e 100644 --- a/testing/emscripten/emscripten.cfg +++ b/testing/emscripten/emscripten.cfg @@ -2,9 +2,10 @@ import os EMSCRIPTEN_ROOT = '/usr/share/emscripten' LLVM_ROOT = '/usr/lib/emscripten-fastcomp/bin' -BINARYEN_ROOT = os.getenv('BINARYEN', '') +BINARYEN_ROOT = '/usr' +BINARYEN_WASM_JS = '/usr/share/binaryen/wasm.js' -CLOSURE_COMPILER = os.getenv('CLOSURE', '/usr/bin/closure-compiler') +CLOSURE_COMPILER = os.getenv('CLOSURE', '/usr/share/java/closure-compiler.jar') CRUNCH = os.getenv('CRUNCH', 'crunch') EMSCRIPTEN_NATIVE_OPTIMIZER = '/usr/bin/emoptimizer' JAVA = os.path.join(os.getenv('JAVA_HOME', '/usr/lib/jvm/default-jvm'), 'bin/java') diff --git a/testing/emscripten/settings_template-paths.patch b/testing/emscripten/settings_template-paths.patch index 2407f23e3a..092535f1ef 100644 --- a/testing/emscripten/settings_template-paths.patch +++ b/testing/emscripten/settings_template-paths.patch @@ -1,14 +1,26 @@ --- a/tools/settings_template_readonly.py +++ b/tools/settings_template_readonly.py -@@ -7,19 +7,18 @@ +@@ -1,35 +1,35 @@ +-# This file will be edited (the {{{ }}} things), and then ~/.emscripten created with the result, if ~/.emscripten doesn't exist. +- + # Note: If you put paths relative to the home directory, do not forget os.path.expanduser + +-# Note: On Windows, remember to escape backslashes! I.e. EMSCRIPTEN_ROOT='c:\emscripten\' is not valid, but EMSCRIPTEN_ROOT='c:\\emscripten\\' and EMSCRIPTEN_ROOT='c:/emscripten/' are. +- import os # this helps projects using emscripten find it -EMSCRIPTEN_ROOT = os.path.expanduser(os.getenv('EMSCRIPTEN') or '{{{ EMSCRIPTEN_ROOT }}}') # directory -LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '{{{ LLVM_ROOT }}}') # directory +-BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN') or '{{{ BINARYEN_ROOT }}}') # directory +EMSCRIPTEN_ROOT = os.path.expanduser(os.getenv('EMSCRIPTEN') or '/usr/share/emscripten') # directory +LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/lib/emscripten-fastcomp/bin') # directory - BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN') or '{{{ BINARYEN_ROOT }}}') # directory ++ ++if os.getenv('BINARYEN'): ++ BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN')) # directory ++else: ++ BINARYEN_ROOT = '/usr' ++ BINARYEN_WASM_JS = '/usr/share/binaryen/wasm.js' # If not specified, defaults to sys.executable. -#PYTHON = 'python' @@ -25,12 +37,15 @@ SPIDERMONKEY_ENGINE = [os.path.expanduser(os.getenv('SPIDERMONKEY') or 'js')] # executable V8_ENGINE = os.path.expanduser(os.getenv('V8') or 'd8') # executable -@@ -29,7 +28,7 @@ + JAVA = 'java' # executable + +-TEMP_DIR = '{{{ TEMP }}}' ++TEMP_DIR = '/tmp' CRUNCH = os.path.expanduser(os.getenv('CRUNCH') or 'crunch') # executable -#CLOSURE_COMPILER = '..' # define this to not use the bundled version -+CLOSURE_COMPILER = '/usr/bin/closure-compiler' # define this to not use the bundled version ++CLOSURE_COMPILER = '/usr/share/java/closure-compiler.jar' ######################################################################################################## |