Files

57 lines
1.6 KiB
Bash

#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash curl gcc zlib libffi icu77 python313 rustc ccache ninja cmake libllvm cargo rust-cbindgen pkg-config
# CONFIGURATION OPTIONS
MAJORVERSION="140" # MAJOR firefox esr version
MINORVERSION="${MAJORVERSION}.4.0" # Minor firefox version
VERSION="${MINORVERSION}esr" # Whole Version put together
DOWNLOAD="https://ftp.mozilla.org/pub/firefox/releases/$VERSION/source/firefox-$VERSION.source.tar.xz"
BUILDPATH=$(realpath .) # Where to output build fragments
OUTPUT="/var/www/$VERSION/" # Where to place built and zipped hashes and all that (ex. for file hosting)
# Ensure necessary directories exist
mkdir $BUILDPATH/bin
mkdir $OUTPUT
#debug stuff
echo Version:
echo $VERSION
echo Link:
echo $DOWNLOAD
echo Build Location:
echo $BUILDPATH
#unzip this or something
echo Downloading...
curl -RO "$DOWNLOAD"
echo Unzipping Source...
tar -xJf "firefox-$VERSION.source.tar.xz"
cd "firefox-$MINORVERSION/js/src"
echo Making Build Path...
mkdir _build
cd _build
# https://clang.llvm.org/docs/CrossCompilation.html
echo Configuring build...
../configure --disable-jemalloc --with-system-zlib --with-system-icu --prefix="$BUILDPATH/bin" --with-intl-api --enable-optimize --target=x86_64-pc-linux-gnu
echo Compiling...
make -k
make -k install
echo Finished Building!
cd $BUILDPATH/bin/include
echo Compressing build fragment...
tar -cJf $VERSION.tar.xz mozjs-$MAJORVERSION/
echo Calculating sum of fragment...
sha256sum $VERSION.tar.xz > $VERSION.tar.xz.sha256
echo Moving fragments to output
mv $VERSION.tar.xz $VERSION.tar.xz.sha256 $OUTPUT