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.4/Dollyfile-system-tools 7f6c86fcc73e544e7007646eba2718bbc4d43b7f0516d9558e2dc500b1a05a8011INSTALL /v0.1.4/Dollyfile-zlib 7f3254e8d51bc7edd2fa47b19f3b1e2e43c747476ab93c57654639e4119abde712USE /v0.1.4/demos/python/Dollyfile-python 3e3b6f083bff4d9be1a817d8fa142378e2c0b492c42998e71977e2c309bdddb313USE /v0.1.4/demos/rust/Dollyfile-cargo 606af69e5155b384d0157fc86cd14127a48213acb34e9a1cbce0305f842545ae14USE /v0.1.4/demos/rust/Dollyfile-cbindgen 5b084c39bd59d98899ad66ce653175d8aa234aceda6cf29eb290aa9786e3eb7415USE /v0.1.4/demos/zero-ad/Dollyfile-pkgconf c9be89938c3e165017d6b0763625b658b6409345f90275460e4a161d90f679ef16REQUIRES 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.4/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