# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka # Note: This software is total mess and it seems to be nearly impossible to # create a clean distribution package. pkgname=emscripten # Keep with sync with pkg emscrypten-fastcomp! pkgver=1.37.9 pkgrel=0 pkgdesc="An LLVM-to-JavaScript Compiler" url="https://kripken.github.io/emscripten-site/" arch="all" license="MIT UOI-NCSA" depends="$pkgname-optimizer=$pkgver-r$pkgrel emscripten-fastcomp>=$pkgver nodejs python2" makedepends="cmake clang" subpackages="$pkgname-optimizer" source="$pkgname-$pkgver.tar.gz::https://github.com/kripken/$pkgname/archive/$pkgver.tar.gz fix-python-shebang.patch settings_template-paths.patch add-system-level-config.patch move-emcc-txt.patch emscripten.cfg" builddir="$srcdir/$pkgname-$pkgver" build() { cd "$builddir"/tools/optimizer cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ -DCMAKE_C_FLAGS="$CFLAGS" \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_VERBOSE_MAKEFILE=ON make } check() { cd "$builddir" sed "s|/usr/share/emscripten|$builddir|" "$srcdir"/emscripten.cfg \ > tests/.emscripten ./emcc --em-config tests/.emscripten \ --cache "$srcdir"/.cache \ -o tests/hello_world.js tests/hello_world.c node tests/hello_world.js } package() { local destdir="$pkgdir/usr/share/$pkgname" local name mkdir -p "$destdir" cp -r "$builddir"/* "$destdir"/ cd "$destdir" # This is read from emcc.py for --help. cp site/build/text/docs/tools_reference/emcc.txt . find . -name "*.bat" -delete rm -r docs # there are only few PDFs and TeX sources rm -r media # media for website rm -r site # a website (?) rm -r tests # looks more like a dump of random sources than decent tests 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 mkdir -p "$pkgdir"/usr/bin for name in em++ em-config emar embuilder.py emcc emcmake \ emconfigure emlink.py emmake emrun emscons do ln -s ../share/$pkgname/$name "$pkgdir"/usr/bin/$name done install -D -m 644 "$srcdir"/emscripten.cfg "$pkgdir"/etc/emscripten.cfg } optimizer() { pkgdesc="Emscripten's optimizer for asm.js code" depends="" install -D -m 755 "$builddir"/tools/optimizer/optimizer \ "$subpkgdir"/usr/bin/emoptimizer } sha512sums="0efd9035d3dce0726025b5b8e30129885eef30f915c502b8957150e4ffc11fd0e9a2b605854cdf69ca3eb05e5102bf34341b7edd2116f5fa29fd170a28e7f07f emscripten-1.37.9.tar.gz a61e172ced6b72adb53a840255a9753905a0c7a1c9f8965345781b9cdcc8a596c4dc88f036e91bd5c05d8b3eb2908bbb7d991c4e1abcf35a46be67b9765e546a fix-python-shebang.patch ec0dc4a5c562fb85d861c37f5b3168351921dfd7865754ff117f757f15c45ec4474c56b71cd6f50beed71d91a270f3c7ad9d27db205be8eb6637b72b0c9fca8a settings_template-paths.patch 10a7a545f468a5f71fdf1cca0e0be983db5d21387202b851bd11f811c2a0a74f4e4c8733ae9ff933df4ea49c3f5e8e4e16fc3651bc98bb8c37a0828bb29eca7e add-system-level-config.patch 6613ef4cf41bcf0ecc13a0415cdc847f4ec112f07dd19573000ea6a9a6f2360aee6b2db01f822d117d5022dc58b2421be89fe3421c46fd6857737d07ce489c1e move-emcc-txt.patch e485c974c465fc60ff0c81ba0a7e2c68bd2f653fff6861007d4ce29dd20c7163ba63ac1a3c449b870a8fa4642ad3ef1c8d1e6380add2db58f65553b58f626c9e emscripten.cfg"