1DOLLY 72PACKAGE spidermonkey3REQUIRES HOST runtime@045# SpiderMonkey 128.13.0, the JavaScript library 0 A.D. links, for programs the6# cc package builds: upstream's mozbuild (configure.py and Make) with Dolly's7# CPython, Cargo, cbindgen and c++, from 0 A.D.'s pinned tarball and patches.8# The tools serve the build and are not installed with it; a program links9# -ljs_static -ljsrust -lz.10FROM /v0.1.5/Dollyfile-system-tools 39e8ad7c80d06b7a0c420bbeaae2e6b2423e7e633d38640e82d72a73c20e232a11INSTALL /v0.1.5/Dollyfile-zlib 0b706df4c643faf419bd9089995b97d13ff7237493d9bb9727f8d3df91cbe03312USE /v0.1.5/demos/python/Dollyfile-python 5909c3743aee62ae30b4bc1bfc3b0b221ac5458e2ed4dfb4b6767d8b072fc9ea13USE /v0.1.5/demos/rust/Dollyfile-cargo 4d544944e4536001068b345f5ca72a0baad99899ee04dbafc6616852b601021a14USE /v0.1.5/demos/rust/Dollyfile-cbindgen 0e7b0a0bcf79d59e144b4ca79631a38a6b0db8438ce74aa396fd6bc64f594be115USE /v0.1.5/demos/zero-ad/Dollyfile-pkgconf 093ecdba243fbc62c20fd1c9c51aef92ed4a8f256f5500944e8011c832a9525816REQUIRES HEADER zlib17REQUIRES LIB z18REQUIRES TOOL cc19REQUIRES TOOL c++20REQUIRES TOOL ar21REQUIRES TOOL make22REQUIRES TOOL patch23REQUIRES TOOL tar24REQUIRES TOOL gzip25REQUIRES TOOL pkg-config26REQUIRES TOOL python27REQUIRES TOOL cargo28REQUIRES TOOL rustc29REQUIRES TOOL cbindgen30REQUIRES TOOL cp31REQUIRES TOOL mkdir32REQUIRES TOOL sh33REQUIRES TOOL rm3435# The pinned tree without its test suites, 0 A.D.'s patches and Dolly's.36SOURCE /v0.1.5/dist/static/spidermonkey/source.tar.gz a0e7bd4549c698ba1c84c437e4191345afde2e24746eb7ac41e7d799f1ba8808 /tmp/mozjs.tar.gz37SLOP gzip -dc /tmp/mozjs.tar.gz | tar -xf - -C /38SLOP CWD /tmp/mozjs/mozjs-128.13.0 sh ../patches/patch.sh39SLOP patch -p1 -d /tmp/mozjs/mozjs-128.13.0 -i /tmp/mozjs/spidermonkey.patch4041# The host build's configuration: mozbuild knows no Dolly OS, so the compiler42# names the target as the host build did (-D__wasi__, wasm64-unknown-wasi) and43# Dolly builds on the same triple. No JIT, no Intl, no tests, no debug symbols.44# A standalone JS build uses no bindgen, but configure still looks for libclang;45# naming Dolly's library directory (which holds none) takes mozbuild's own46# --with-libclang-path route and skips its `c++ -print-search-dirs` probe,47# a spelling Dolly's cc does not have.48FILE /tmp/mozjs/build.slop49    set -e50    export MOZCONFIG=/dev/null MOZBUILD_STATE_PATH=/tmp/mozjs/state51    export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none RUSTC_BOOTSTRAP=1 CRATE_CC_NO_DEFAULTS=152    export CC='cc -D__wasi__' CXX='c++ -D__wasi__' HOST_CC='cc -D__wasi__' HOST_CXX='c++ -D__wasi__'53    export AR=ar RUST_TARGET=wasm64-emscripten-probe CBINDGEN=/usr/bin/cbindgen54    mkdir /tmp/mozjs/mozjs-128.13.0/obj55    cd /tmp/mozjs/mozjs-128.13.0/obj56    python ../configure.py --enable-project=js --host=wasm64-unknown-wasi --target=wasm64-unknown-wasi \57      --disable-jit --disable-shared-js --without-intl-api --disable-tests --disable-js-shell \58      --disable-jemalloc --disable-debug --enable-optimize=-O2 --disable-debug-symbols \59      --disable-bootstrap --disable-warnings-as-errors --with-libclang-path=/usr/lib60    # Cargo links the Rust library and its build scripts through Dolly's rustc61    # linker adapter, which translates the Emscripten target's linker vocabulary62    # to cc; mozbuild would otherwise hand cc the raw -s/EXPORTED_FUNCTIONS flags.63    L=/opt/rust-sdk/bin/dolly-rust-link64    make -j4 MOZ_CARGO_WRAP_LD=$L MOZ_CARGO_WRAP_HOST_LD=$L MOZ_CARGO_WRAP_LD_CXX=$L \65      MOZ_CARGO_WRAP_HOST_LD_CXX=$L MOZ_CARGO_WRAP_LDFLAGS= MOZ_CARGO_WRAP_HOST_LDFLAGS=66    mkdir -p /opt/mozjs/lib /usr/share/licenses/spidermonkey/crates67    # dist/include is 328 symlinks into the source tree, which is not retained;68    # copytree dereferences them (Dolly's cp has no -L).69    python -c 'import shutil; shutil.copytree("dist/include", "/opt/mozjs/include", symlinks=False)'70    cp js/src/build/libjs_static.a wasm64-emscripten-probe/release/libjsrust.a /opt/mozjs/lib/71    ls -l /opt/mozjs/lib72    cp ../LICENSE /usr/share/licenses/spidermonkey/LICENSE73    cp ../nsprpub/LICENSE /usr/share/licenses/spidermonkey/MPL-2.074    # The notices of the crates compiled into libjsrust.a.75    for crate in $(ls wasm64-emscripten-probe/release/deps | sed -nE 's/^lib(.+)-[0-9a-f]{16}\.rlib$/\1/p' | sort -u); do76      for name in $crate $(echo $crate | tr _ -); do77        [ -d ../third_party/rust/$name ] || continue78        for notice in LICENSE LICENSE-MIT LICENSE-APACHE LICENSE-MPL LICENSE.txt LICENSE.md COPYING COPYRIGHT UNLICENSE; do79          [ -f ../third_party/rust/$name/$notice ] || continue80          mkdir -p /usr/share/licenses/spidermonkey/crates/$name81          cp ../third_party/rust/$name/$notice /usr/share/licenses/spidermonkey/crates/$name/$notice82        done83        break84      done85    done86SLOP time slop -e /tmp/mozjs/build.slop8788EXPORTS LIB    js_static /opt/mozjs/lib/libjs_static.a89EXPORTS LIB    jsrust    /opt/mozjs/lib/libjsrust.a90EXPORTS HEADER mozjs-128 /opt/mozjs/include91FILE /usr/lib/pkgconfig/mozjs-128.pc92    Name: SpiderMonkey 128.13.093    Description: The Mozilla library for JavaScript94    Version: 128.13.095    Cflags: -I/opt/mozjs/include96    Libs: -L/opt/mozjs/lib -ljs_static -ljsrust -lz97FOLDER /usr/share/licenses/spidermonkey98SLOP rm -rf /tmp/mozjs /tmp/mozjs.tar.gz99