diff options
author | B. Stack <bgstack15@gmail.com> | 2023-10-09 13:25:50 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2023-10-09 13:26:31 -0400 |
commit | 64f94edaaafa871bd320fa2515ae8c42a3ede300 (patch) | |
tree | 1487e57fefe2ade96c21f2423ef1d71ed671dbfa /waterfox-g/debian/build.sh | |
parent | Merge branch 'jellyfin-mpv-shim' (diff) | |
download | stackrpms-64f94edaaafa871bd320fa2515ae8c42a3ede300.tar.gz stackrpms-64f94edaaafa871bd320fa2515ae8c42a3ede300.tar.bz2 stackrpms-64f94edaaafa871bd320fa2515ae8c42a3ede300.zip |
waterfox-g 6.0.2 rc1
Diffstat (limited to 'waterfox-g/debian/build.sh')
-rwxr-xr-x | waterfox-g/debian/build.sh | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/waterfox-g/debian/build.sh b/waterfox-g/debian/build.sh new file mode 100755 index 0000000..b7a1f9e --- /dev/null +++ b/waterfox-g/debian/build.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# Upstream modifies version_display.txt using script included in GitHub Actions (version=git_tag), +# without patching. Debhelper won't allow us to do that by same way and +# patching won't be much convenient, so we need to create new files. +mkdir -p "$(pwd)"/debian/app_version + +cp "$(pwd)"/browser/config/version.txt "$(pwd)"/debian/app_version/version.txt +echo "$WF_VERSION" >"$(pwd)"/debian/app_version/version_display.txt + +# Tune flags +OPT_EXTRA_FLAGS="-march=x86-64 -mtune=k8" +CFLAGS+=" $OPT_EXTRA_FLAGS" +CXXFLAGS+=" $OPT_EXTRA_FLAGS" + +# LTO needs more open files +ulimit -n 4096 +# Do 3-tier PGO +LDFLAGS+=" -Wl,--no-keep-memory -Wl,--no-mmap-output-file" +export LDFLAGS +if test `lsb_release -sc` = "bionic" || test `lsb_release -sc` = "focal" || test `lsb_release -sc` = "buster"; then +export NODEJS=/usr/lib/nodejs-mozilla/bin/node +fi + +if test `lsb_release -sc` = "bionic"; then +export NASM=/usr/lib/nasm-mozilla/bin/nasm +fi + +# For successfull LTO build, we need to use matching LLVM version +if test `lsb_release -sc` = "bionic" || test `lsb_release -sc` = "focal" || test `lsb_release -sc` = "buster" || test `lsb_release -sc` = "bullseye"; then +export PATH=/usr/lib/llvm-13/bin/:$PATH +fi + +if test `lsb_release -sc` = "jammy"; then +export PATH=/usr/lib/llvm-15/bin/:$PATH +fi + +export CC=clang +export CXX=clang++ +export AR=llvm-ar +export NM=llvm-nm +export RANLIB=llvm-ranlib +export LLVM_PROFDATA=llvm-profdata +export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system +export GEN_PGO=1 +./mach build + +echo "Profiling instrumented browser..." +./mach package +JARLOG_FILE="$(pwd)/jarlog" xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" ./mach python build/pgo/profileserver.py + +stat -c "Profile data found (%s bytes)" merged.profdata +test -s merged.profdata + +stat -c "Jar log found (%s bytes)" jarlog +test -s jarlog + +echo "Removing instrumented browser..." +./mach clobber + +echo "Building optimized browser..." +unset GEN_PGO +export USE_PGO=1 +./mach build + +# Build langpacks +mkdir -p "$(pwd)"/extensions +# langpack-build can not be done in parallel easily (see https://bugzilla.mozilla.org/show_bug.cgi?id=1660943) +# Therefore, we have to have a separate obj-dir for each language +# We do this, by creating a mozconfig-template with the necessary switches +# and a placeholder obj-dir, which gets copied and modified for each language +sed -r '/^(ja-JP-mac|en-US|)$/d;s/ .*$//' debian/locales.shipped | cut -f1 -d":" | + xargs -n 1 -P $JOBS -I {} /bin/sh -c ' + locale=$1 + cp debian/mozconfig_LANG ${PWD}/mozconfig_$locale + sed -i "s|obj_LANG|obj_$locale|" ${PWD}/mozconfig_$locale + export MOZCONFIG=${PWD}/mozconfig_$locale + ./mach build config/nsinstall langpack-$locale + cp -L ../obj_$locale/dist/linux-*/xpi/waterfox-g-$WF_VERSION.$locale.langpack.xpi \ + "$(pwd)"/extensions/langpack-$locale@l10n.waterfox.net.xpi +' -- {} |