#! /bin/bash # mozjs78 (JS 78) # Source: https://ftp.mozilla.org/pub/firefox/releases/78.6.1esr/source/firefox-78.6.1esr.source.tar.xz # # $BUILD = Directory to temporarily install # $PKGS = Directory to store built packages # # DEPS # Required: Autoconf-2.13, ICU, rustc, Which, nspr # Recommended: NONE # Optional: NONE # NOTE: Rust will no longer build on musl-1.2.x, which means mozjs will not build. # Workaround is by installing and patching Alpine Linux's build of mozjs. # Alpine's mozjs 78.14.0 will require libffi-3.3 and ICU 67(libicudata,libicui18n,libicuuc) # If you compiling this package in chroot then ensure that /dev/shm is mounted. # As root: mountpoint -q /dev/shm || mount -t tmpfs devshm /dev/shm patch -Np1 -i ../patches/mozjs78-alpine/0001-silence-sandbox-violations.patch patch -Np1 -i ../patches/mozjs78-alpine/disable-jslint.patch patch -Np1 -i ../patches/mozjs78-alpine/fd6847c9416f9eebde636e21d794d25d1be8791d.patch patch -Np1 -i ../patches/mozjs78-alpine/fix-musl-build.patch patch -Np1 -i ../patches/mozjs78-alpine/fix-rust-target.patch # If using python 3.10.x, apply these patches: patch -Np1 -i ../patches/mozjs78-alpine/fix-python3.10-compilation.patch patch -Np1 -i ../patches/mozjs78-mlfs/fix-typo-in-python-script.py mkdir -v obj && cd obj && export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=1048576" && touch configure && case $(uname -m) in armv*) ARM_ARCH=$(echo ${$(uname -m)#*armv} | sed "s|-.*||") sed -i "s|ARM_ARCH=.*|ARM_ARCH=$ARM_ARCH|" "$builddir"/build/autoconf/arch.m4 ;; esac && case $(uname -m) in i686) export RUST_TARGET="i686-unknown-linux-musl" ;; x86_64) export RUST_TARGET="x86_64-unknown-linux-musl" ;; aarch64) export RUST_TARGET="aarch64-unknown-linux-musl" ;; armv7*) export RUST_TARGET="armv7l-unknown-linux-musl" ;; armv6*) export RUST_TARGET="armv6l-unknown-linux-musl" ;; esac && CC=gcc CXX=g++ \ SHELL=/bin/ash PYTHON=/usr/bin/python3 \ ../js/src/configure --prefix=/usr \ --with-intl-api \ --with-system-icu \ --with-system-nspr \ --with-system-zlib \ --enable-ctypes \ --enable-hardening \ --enable-optimize="$CFLAGS -O2" \ --enable-readline \ --enable-release \ --enable-shared-js \ --enable-system-ffi \ --enable-tests \ --disable-debug \ --disable-debug-symbols \ --disable-jemalloc \ --disable-strip && read -p "Compile?" && make -j2 && sudo -S make DESTDIR=$BUILD install && sudo -S rm -vf ${BUILD}/usr/lib/*.ajs && cd $BUILD && sudo -S mkdir -v ${BUILD}/install && cat > /tmp/slack-desc << "EOF" # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| mozjs: mozjs (Mozilla's JavaScript engine) mozjs: mozjs: SpiderMonkey is Mozilla's JavaScript engine written in C and C++. It mozjs: is used in various Mozilla products, including Firefox, and is mozjs: available under the MPL2. mozjs: mozjs: mozjs: mozjs: mozjs: mozjs: EOF sudo -S mv -v /tmp/slack-desc install/ && sudo -S makepkg -l y -c n $PKGS/mozjs-78.6.1-$(uname -m)-mlfs.txz && sudo -S rm -rf ${BUILD}/*