50 lines
1.5 KiB
Bash
Executable file
50 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
program_name="librewolf-allow-dark"
|
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
|
|
|
# prep
|
|
workdir=$(mktemp -d)
|
|
built_dir=${COMPILED_DIR:-/compiled}/$program_name
|
|
mkdir -p $built_dir
|
|
apt update && apt install curl jq -y
|
|
|
|
# check whether it's up-to-date
|
|
version_file=$built_dir/version
|
|
touch $version_file
|
|
version=$(curl 'https://gitlab.com/api/v4/projects/32320088/packages?sort=desc' | jq '.[0].version' -r)
|
|
if grep -q $version $version_file; then
|
|
echo "already up to date, exiting"
|
|
exit
|
|
fi
|
|
|
|
# get source and build
|
|
cd $workdir
|
|
curl "https://gitlab.com/api/v4/projects/32320088/packages/generic/librewolf-source/$version/librewolf-$version.source.tar.gz" -LO
|
|
tar -xzf librewolf-136.0-2.source.tar.gz
|
|
cd ./librewolf-$version/
|
|
# get build deps
|
|
apt install python3 python3-pip wget patch -y
|
|
# apply allow dark patch
|
|
patch -p1 -i $SCRIPT_DIR/allow_dark.patch
|
|
export MOZ_BUILD_DATE="$(date -u${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH} +%Y%m%d%H%M%S)"
|
|
# not entirely sure what this does, but it's what librewolf-allow-dark does
|
|
export MOZ_NOSPAM=1
|
|
# build
|
|
./mach --no-interactive bootstrap --application-choice=browser
|
|
./lw/setup-wasi-linux.sh
|
|
./mach build
|
|
./mach package
|
|
|
|
|
|
# build .tar.zst archive
|
|
cd $workdir
|
|
tar -xvf ./librewolf-$version/obj-x86_64-pc-linux-gnu/dist/librewolf-$version.en-US.linux-x86_64.tar.xz
|
|
cd ./librewolf/
|
|
apt install zstd -y
|
|
mkdir -p $built_dir
|
|
tar --zstd -cf $built_dir/$program_name.tar.zst .
|
|
echo $version >$version_file
|
|
|
|
echo "$program_name updated to $version"
|