2020-03-07 19:44:22 +01:00
|
|
|
#!/bin/bash
|
2019-07-17 20:50:38 +02:00
|
|
|
printf "\n\n------------------------------ FINAL PREBUILD CONFIGURATION ---------------------------------\n";
|
|
|
|
|
2020-07-30 17:51:35 +02:00
|
|
|
set -e
|
|
|
|
|
2019-07-21 07:30:19 +02:00
|
|
|
# Setup Script Variables
|
2020-03-28 23:18:19 +01:00
|
|
|
srcdir=$1;
|
2021-02-13 20:04:43 +01:00
|
|
|
CI_PROJECT_DIR=${CI_PROJECT_DIR:-$(realpath $(dirname $0)/../)}
|
2019-08-17 22:34:48 +02:00
|
|
|
_COMMON_REPO='https://gitlab.com/librewolf-community/browser/common.git';
|
2020-03-28 23:18:19 +01:00
|
|
|
_MOZBUILD=$srcdir/../mozbuild
|
2020-03-28 23:15:41 +01:00
|
|
|
|
|
|
|
mkdir -p ${_MOZBUILD}
|
2019-07-21 07:30:19 +02:00
|
|
|
|
|
|
|
# Copy Source Code Changes to Source Code
|
|
|
|
printf "\nCopying branding and source code changes to firefox source code\n";
|
2019-08-17 05:32:17 +02:00
|
|
|
git clone $_COMMON_REPO common;
|
2020-03-28 23:18:19 +01:00
|
|
|
cp -r common/source_files/* $srcdir/;
|
2019-08-17 05:32:17 +02:00
|
|
|
rm -rf common;
|
2019-07-17 20:50:38 +02:00
|
|
|
|
2020-03-28 23:18:19 +01:00
|
|
|
cd $srcdir
|
2020-03-28 23:15:41 +01:00
|
|
|
|
2020-03-29 01:27:47 +01:00
|
|
|
cat >${CI_PROJECT_DIR}/mozconfig <<END
|
2020-03-28 23:15:41 +01:00
|
|
|
ac_add_options --enable-application=browser
|
2020-08-27 10:23:17 +02:00
|
|
|
mk_add_options MOZ_OBJDIR=${srcdir}/firefox-${pkgver}/obj
|
2020-03-28 23:15:41 +01:00
|
|
|
|
2020-03-29 13:34:12 +02:00
|
|
|
# to build on ubuntu and pick up clang
|
2020-03-29 18:37:23 +02:00
|
|
|
ac_add_options NODEJS=/usr/lib/nodejs-mozilla/bin/node
|
|
|
|
ac_add_options NASM=/usr/lib/nasm-mozilla/bin/nasm
|
2020-03-29 13:34:12 +02:00
|
|
|
|
2020-03-28 23:15:41 +01:00
|
|
|
# This supposedly speeds up compilation (We test through dogfooding anyway)
|
|
|
|
ac_add_options --disable-tests
|
|
|
|
ac_add_options --disable-debug
|
|
|
|
|
2020-03-29 16:52:39 +02:00
|
|
|
ac_add_options --prefix=/usr
|
2020-03-28 23:15:41 +01:00
|
|
|
ac_add_options --enable-release
|
|
|
|
ac_add_options --enable-hardening
|
|
|
|
ac_add_options --enable-rust-simd
|
2020-03-29 13:09:14 +02:00
|
|
|
|
2020-03-28 23:15:41 +01:00
|
|
|
# Branding
|
|
|
|
ac_add_options --enable-update-channel=release
|
2020-03-29 14:37:10 +02:00
|
|
|
ac_add_options --with-app-name=librewolf
|
|
|
|
ac_add_options --with-app-basename=LibreWolf
|
|
|
|
ac_add_options --with-branding=browser/branding/librewolf
|
2021-01-31 11:51:25 +01:00
|
|
|
ac_add_options --with-distribution-id=io.gitlab.librewolf-community
|
2020-03-28 23:15:41 +01:00
|
|
|
ac_add_options --with-unsigned-addon-scopes=app,system
|
|
|
|
ac_add_options --allow-addon-sideload
|
|
|
|
export MOZ_REQUIRE_SIGNING=0
|
|
|
|
|
|
|
|
# System libraries
|
2020-03-29 14:37:10 +02:00
|
|
|
# ac_add_options --with-system-nspr
|
|
|
|
# ac_add_options --with-system-nss
|
2020-03-28 23:15:41 +01:00
|
|
|
|
|
|
|
# Features
|
|
|
|
ac_add_options --enable-alsa
|
|
|
|
ac_add_options --enable-jack
|
|
|
|
ac_add_options --disable-crashreporter
|
|
|
|
ac_add_options --disable-updater
|
|
|
|
ac_add_options --disable-tests
|
|
|
|
|
|
|
|
# Disables crash reporting, telemetry and other data gathering tools
|
|
|
|
mk_add_options MOZ_CRASHREPORTER=0
|
|
|
|
mk_add_options MOZ_DATA_REPORTING=0
|
|
|
|
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
|
|
|
|
mk_add_options MOZ_TELEMETRY_REPORTING=0
|
|
|
|
|
|
|
|
# options for ci / weaker build systems
|
|
|
|
# mk_add_options MOZ_MAKE_FLAGS="-j4"
|
|
|
|
# ac_add_options --enable-linker=gold
|
|
|
|
END
|
|
|
|
|
|
|
|
if [[ $CARCH == 'aarch64' ]]; then
|
2020-03-29 01:27:47 +01:00
|
|
|
cat >>${CI_PROJECT_DIR}/mozconfig <<END
|
2020-03-28 23:15:41 +01:00
|
|
|
# taken from manjaro build:
|
|
|
|
ac_add_options --enable-optimize="-g0 -O2"
|
|
|
|
|
|
|
|
# from ALARM
|
2020-03-29 18:37:23 +02:00
|
|
|
# should only fail on armv7x
|
|
|
|
# ac_add_options --disable-webrtc
|
2020-03-28 23:15:41 +01:00
|
|
|
|
2020-03-31 09:53:45 +02:00
|
|
|
export CC='clang-8'
|
|
|
|
export CXX='clang++-8'
|
|
|
|
export AR=llvm-ar-8
|
|
|
|
export NM=llvm-nm-8
|
|
|
|
export RANLIB=llvm-ranlib-8
|
2020-03-28 23:15:41 +01:00
|
|
|
END
|
|
|
|
|
2020-03-31 11:19:50 +02:00
|
|
|
export MOZ_DEBUG_FLAGS=" "
|
|
|
|
export CFLAGS+=" -g0"
|
|
|
|
export CXXFLAGS+=" -g0"
|
|
|
|
export RUSTFLAGS="-Cdebuginfo=0"
|
|
|
|
|
2020-07-30 17:51:35 +02:00
|
|
|
export LDFLAGS+=" -Wl,--no-keep-memory -Wl"
|
2020-03-30 00:55:22 +02:00
|
|
|
patch -p1 -i ${CI_PROJECT_DIR}/arm.patch
|
2020-03-31 10:08:20 +02:00
|
|
|
wget https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/master/extra/firefox/build-arm-libopus.patch -O ${CI_PROJECT_DIR}/build-arm-libopus.patch
|
2020-03-30 00:55:22 +02:00
|
|
|
patch -p1 -i ${CI_PROJECT_DIR}/build-arm-libopus.patch
|
2020-03-29 18:37:23 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
cat >>${CI_PROJECT_DIR}/mozconfig <<END
|
2020-03-30 23:21:01 +02:00
|
|
|
# ubuntu seems to recommend this
|
2020-03-29 18:37:23 +02:00
|
|
|
ac_add_options --disable-elf-hack
|
2020-03-31 09:53:45 +02:00
|
|
|
|
2020-09-30 14:04:18 +02:00
|
|
|
export CC='clang-11'
|
|
|
|
export CXX='clang++-11'
|
|
|
|
export AR=llvm-ar-11
|
|
|
|
export NM=llvm-nm-11
|
|
|
|
export RANLIB=llvm-ranlib-11
|
2020-03-31 09:53:45 +02:00
|
|
|
|
2020-03-31 11:19:50 +02:00
|
|
|
# probably not needed, enabled by default?
|
|
|
|
ac_add_options --enable-optimize
|
2020-03-29 18:37:23 +02:00
|
|
|
END
|
2020-03-28 23:15:41 +01:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
2020-03-29 18:37:23 +02:00
|
|
|
# hopefully the magic sauce that makes things build on 16.04 and later on work "everywhere":
|
2020-07-31 12:11:59 +02:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/lower-python3-requirement.patch"
|
2020-07-31 00:14:28 +02:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/armhf-reduce-linker-memory-use.patch"
|
2020-03-30 00:55:22 +02:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/build-with-libstdc++-7.patch"
|
2020-07-31 00:14:28 +02:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/fix-armhf-webrtc-build.patch"
|
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/webrtc-fix-compiler-flags-for-armhf.patch"
|
2021-02-01 13:29:58 +01:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/reduce-rust-debuginfo.patch"
|
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/relax-cargo-dep.patch"
|
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/use-system-icupkg.patch"
|
2020-08-27 11:48:26 +02:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/python3-remove-variable-annotations.patch"
|
2020-09-30 14:04:18 +02:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/python3-remove-fstrings.patch"
|
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/python3-remove-pep487.patch"
|
2020-10-29 02:18:46 +01:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/silence-gtk-style-assertions.patch"
|
2020-11-21 13:22:34 +01:00
|
|
|
patch -p1 -i "${CI_PROJECT_DIR}/deb_patches/sandbox-update-arm-syscall-numbers.patch"
|
2020-07-30 17:51:35 +02:00
|
|
|
|
2020-04-10 20:22:10 +02:00
|
|
|
# Remove some pre-installed addons that might be questionable
|
|
|
|
patch -p1 -i ${CI_PROJECT_DIR}/remove_addons.patch
|
|
|
|
|
2020-06-05 17:53:19 +02:00
|
|
|
# Disable (some) megabar functionality
|
|
|
|
# Adapted from https://github.com/WesleyBranton/userChrome.css-Customizations
|
|
|
|
patch -p1 -i ${CI_PROJECT_DIR}/megabar.patch
|
|
|
|
|
2021-03-24 10:59:27 +01:00
|
|
|
# remove mozilla vpn ads
|
|
|
|
patch -p1 -i ${CI_PROJECT_DIR}/mozilla-vpn-ad.patch
|
|
|
|
|
2021-01-08 20:44:53 +01:00
|
|
|
# Debian patch to enable global menubar
|
2021-01-31 11:51:25 +01:00
|
|
|
if [[ ! -z "${GLOBAL_MENUBAR}" ]];then
|
|
|
|
patch -p1 -i ${CI_PROJECT_DIR}/unity-menubar.patch
|
|
|
|
fi
|
2021-01-08 20:44:53 +01:00
|
|
|
|
2020-03-28 23:15:41 +01:00
|
|
|
# Disabling Pocket
|
2019-07-17 20:50:38 +02:00
|
|
|
printf "\nDisabling Pocket\n";
|
2020-03-28 23:15:41 +01:00
|
|
|
sed -i "s/'pocket'/#'pocket'/g" browser/components/moz.build
|
2021-02-15 10:15:26 +01:00
|
|
|
|
|
|
|
patch -Np1 -i "${CI_PROJECT_DIR}/context-menu.patch"
|
|
|
|
|
2020-03-28 23:15:41 +01:00
|
|
|
# this one only to remove an annoying error message:
|
|
|
|
sed -i 's#SaveToPocket.init();#// SaveToPocket.init();#g' browser/components/BrowserGlue.jsm
|
|
|
|
|
2020-04-10 20:22:10 +02:00
|
|
|
# Remove Internal Plugin Certificates
|
|
|
|
_cert_sed='s#if (aCert.organizationalUnit == "Mozilla [[:alpha:]]\+") {\n'
|
|
|
|
_cert_sed+='[[:blank:]]\+return AddonManager\.SIGNEDSTATE_[[:upper:]]\+;\n'
|
|
|
|
_cert_sed+='[[:blank:]]\+}#'
|
|
|
|
_cert_sed+='// NOTE: removed#g'
|
|
|
|
sed -z "$_cert_sed" -i toolkit/mozapps/extensions/internal/XPIInstall.jsm
|
|
|
|
|
2020-03-28 23:15:41 +01:00
|
|
|
# allow SearchEngines option in non-ESR builds
|
|
|
|
sed -i 's#"enterprise_only": true,#"enterprise_only": false,#g' browser/components/enterprisepolicies/schemas/policies-schema.json
|
2021-01-04 23:18:23 +01:00
|
|
|
|
|
|
|
# stop some undesired requests (https://gitlab.com/librewolf-community/browser/common/-/issues/10)
|
2021-01-27 10:57:18 +01:00
|
|
|
_settings_services_sed='s#firefox.settings.services.mozilla.com#f.s.s.m.c.qjz9zk#g'
|
2021-01-04 23:18:23 +01:00
|
|
|
sed "$_settings_services_sed" -i browser/components/newtab/data/content/activity-stream.bundle.js
|
|
|
|
sed "$_settings_services_sed" -i modules/libpref/init/all.js
|
|
|
|
sed "$_settings_services_sed" -i services/settings/Utils.jsm
|
|
|
|
sed "$_settings_services_sed" -i toolkit/components/search/SearchUtils.jsm
|