1DOLLY 82PACKAGE 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 /Dollyfile-system-tools 7dc08859cff6c590c9bf42278822be15b530cc9d18438481449469995c2bf8fe11INSTALL /Dollyfile-zlib acf8f8daaba24468b5b521bbb4d4ba3e034fe28d7a2d92fc680d2e39a1cea97112USE /demos/python/Dollyfile-python caf80d3cd27594e1ed0bc4bbd8d586359be411b6f5328e5d3fe89c4a6951576f13USE /demos/rust/Dollyfile-cargo 80ca2a3f9b9e0470ea4b0d48639be86660d8b143b9ed375efeb2accc88d9cf8314USE /demos/rust/Dollyfile-cbindgen 515bef3d9f0a13724b91d43672d78f162de2abc939a8abaf7eac75241cd0466915USE /demos/tools/Dollyfile-pkgconf 7aa2fb7ca6d1e11fc4a062fa683ca4a6980bcc85f06fbedee1d11b3fe99f901116REQUIRES 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 /dist/static/spidermonkey/source.tar.gz 5ce7dbde086665dcbec37584707cefb82792aa13a4b10726d5e6824d8b33647e /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