aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorohfp <1813007-ohfp@users.noreply.gitlab.com>2020-03-29 18:37:23 +0200
committerohfp <1813007-ohfp@users.noreply.gitlab.com>2020-03-30 00:26:30 +0200
commit85f55868f631d67e5a4ab190f69e919f38be57f8 (patch)
tree4b91a6ed7ef90064c835403d5e1af952f8bff43b
parentre-introduce profiling (diff)
downloadlibrewolf-linux-85f55868f631d67e5a4ab190f69e919f38be57f8.tar.gz
librewolf-linux-85f55868f631d67e5a4ab190f69e919f38be57f8.tar.bz2
librewolf-linux-85f55868f631d67e5a4ab190f69e919f38be57f8.zip
Disable PGO for deb/ubuntu, because everything is horrible.
Also: Grab dependencies, patches and further config options from ubuntu upstream build sources. Builds statically against a mozilla-gcc-7/libstdc++7. Let's hope this works for Appimages and Flatpaks as well, "everywhere".
-rwxr-xr-xbinary_tarball/scripts/1_Install_Dependencies.sh45
-rwxr-xr-xbinary_tarball/scripts/3_Configure_Source_Code.sh23
-rwxr-xr-xbinary_tarball/scripts/4_Build_Binary_Tarball.sh66
-rw-r--r--deb_patches/build-with-libstdc++-7.patch36
-rw-r--r--deb_patches/drop-check-glibc-symbols.patch19
-rw-r--r--deb_patches/fix-armhf-webrtc-build.patch83
-rw-r--r--deb_patches/webrtc-fix-compiler-flags-for-armhf.patch35
7 files changed, 238 insertions, 69 deletions
diff --git a/binary_tarball/scripts/1_Install_Dependencies.sh b/binary_tarball/scripts/1_Install_Dependencies.sh
index 58ac13c..833b139 100755
--- a/binary_tarball/scripts/1_Install_Dependencies.sh
+++ b/binary_tarball/scripts/1_Install_Dependencies.sh
@@ -5,7 +5,43 @@ set -e
# Setup Script Variables
# _DEPENDENCIES="mercurial wget git flatpak flatpak-builder";
-_DEPENDENCIES="wget git xvfb build-essential xz-utils curl python3 libjack-dev nasm-mozilla libstdc++6";
+_DEPENDENCIES="wget git xvfb \
+ xz-utils \
+ curl python3 libjack-dev \
+ autotools-dev \
+ autoconf2.13 \
+ zip \
+ libx11-dev \
+ libx11-xcb-dev \
+ libxt-dev \
+ libxext-dev \
+ libgtk2.0-dev \
+ libgtk-3-dev \
+ libglib2.0-dev \
+ libpango1.0-dev \
+ libfontconfig1-dev \
+ libfreetype6-dev \
+ libstartup-notification0-dev \
+ libasound2-dev \
+ libcurl4-openssl-dev \
+ libdbus-glib-1-dev \
+ hardening-wrapper \
+ lsb-release \
+ libiw-dev \
+ mesa-common-dev \
+ libnotify-dev \
+ libxrender-dev \
+ libpulse-dev \
+ yasm \
+ unzip \
+ dbus-x11 \
+ python \
+ cargo \
+ rustc \
+ nodejs-mozilla \
+ nasm-mozilla \
+ gcc-mozilla"
+
export DEBIAN_FRONTEND=noninteractive
# Installs Dependencies
@@ -20,6 +56,7 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add
apt-get update
apt-get -y install clang-9 libclang-9-dev
-# Installs (non-ancient) clang
-curl -sL https://deb.nodesource.com/setup_13.x | bash -
-apt-get install -y nodejs
+# Installs (non-ancient) nodejs
+# => use nodejs-mozilla instead
+# curl -sL https://deb.nodesource.com/setup_13.x | bash -
+# apt-get install -y nodejs
diff --git a/binary_tarball/scripts/3_Configure_Source_Code.sh b/binary_tarball/scripts/3_Configure_Source_Code.sh
index e912c92..3a8813c 100755
--- a/binary_tarball/scripts/3_Configure_Source_Code.sh
+++ b/binary_tarball/scripts/3_Configure_Source_Code.sh
@@ -21,8 +21,11 @@ cat >${CI_PROJECT_DIR}/mozconfig <<END
ac_add_options --enable-application=browser
# to build on ubuntu and pick up clang
-ac_add_options --with-libclang-path="/usr/lib/llvm-9/lib"
-ac_add_options --with-clang-path="/usr/bin/clang-9"
+#ac_add_options --with-libclang-path="/usr/lib/llvm-9/lib"
+#ac_add_options --with-clang-path="/usr/bin/clang-9"
+ac_add_options NODEJS=/usr/lib/nodejs-mozilla/bin/node
+ac_add_options NASM=/usr/lib/nasm-mozilla/bin/nasm
+ac_add_options --disable-install-strip
# let's see if this works: make things backwards-compatible as much as possible
# TODO: check if this would also work when building on something newer to have it run on
@@ -88,8 +91,8 @@ export CXXFLAGS+=" -g0"
export RUSTFLAGS="-Cdebuginfo=0"
# from ALARM
-# See https://bugzilla.mozilla.org/show_bug.cgi?id=1430094
-ac_add_options --disable-webrtc
+# should only fail on armv7x
+# ac_add_options --disable-webrtc
END
@@ -97,9 +100,21 @@ END
patch -p1 -i ${$CI_PROJECT_DIR}/arm.patch
wget https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/master/extra/firefox/build-arm-libopus.patch -O ${$CI_PROJECT_DIR}/build-arm-libopus.patch
patch -p1 -i ${$CI_PROJECT_DIR}/build-arm-libopus.patch
+ # might not even be needed for aarch64?
+ 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
+
+else
+ cat >>${CI_PROJECT_DIR}/mozconfig <<END
+ac_add_options --disable-elf-hack
+END
fi
+# hopefully the magic sauce that makes things build on 16.04 and later on work "everywhere":
+patch -p1 -i "${$CI_PROJECT_DIR}/deb_patches/drop-check-glibc-symbols.patch"
+patch -p1 -i "${$CI_PROJECT_DIR}/deb_patches/build-with-libstdc++-7.patch"
+
# Disabling Pocket
printf "\nDisabling Pocket\n";
sed -i "s/'pocket'/#'pocket'/g" browser/components/moz.build
diff --git a/binary_tarball/scripts/4_Build_Binary_Tarball.sh b/binary_tarball/scripts/4_Build_Binary_Tarball.sh
index d7649e4..cd1bed3 100755
--- a/binary_tarball/scripts/4_Build_Binary_Tarball.sh
+++ b/binary_tarball/scripts/4_Build_Binary_Tarball.sh
@@ -41,72 +41,20 @@ export SHELL=/bin/bash;
cd $srcdir;
# Runs bootstrapper to install dependencies
-printf "\nRunning bootstrapper to install build dependencies (using ./mach script within source code)\n";
-./mach bootstrap --application-choice=browser --no-interactive
+# printf "\nRunning bootstrapper to install build dependencies (using ./mach script within source code)\n";
+# ./mach bootstrap --application-choice=browser --no-interactive
+
+# ./mach configure
# add cargo binary to path
-source /root/.cargo/env
+# source /root/.cargo/env
# install cbindgen
cargo install cbindgen
-rm -f mozconfig
-
-# Do 3-tier PGO
-echo "Building instrumented browser..."
-
-if [[ $CARCH == 'aarch64' ]]; then
-
-cat >.mozconfig ${CI_PROJECT_DIR}/mozconfig - <<END
-ac_add_options --enable-profile-generate
-END
-
-else
-
-# -fno-plt with cross-LTO causes obscure LLVM errors
-# LLVM ERROR: Function Import: link error
-CFLAGS="${CFLAGS/-fno-plt/}"
-CXXFLAGS="${CXXFLAGS/-fno-plt/}"
-
-cat >.mozconfig ${CI_PROJECT_DIR}/mozconfig - <<END
-ac_add_options --enable-profile-generate=cross
-END
-
-fi
-
-# Executes the actual build
-printf "\nBuilding LibreWolf\n";
-./mach build;
-
-echo "Profiling instrumented browser..."
-./mach package
-LLVM_PROFDATA=llvm-profdata \
- JARLOG_FILE="$PWD/jarlog" \
- xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
- ./mach python build/pgo/profileserver.py
-
-if [[ ! -s merged.profdata ]]; then
- echo "No profile data produced."
- exit 1
-fi
-
-if [[ ! -s jarlog ]]; then
- echo "No jar log produced."
- exit 1
-fi
-
-echo "Removing instrumented browser..."
-./mach clobber
-
-echo "Building optimized browser..."
-
if [[ $CARCH == 'aarch64' ]]; then
cat >.mozconfig ${CI_PROJECT_DIR}/mozconfig - <<END
-ac_add_options --enable-lto
-ac_add_options --enable-profile-use
-ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
-ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
# seems to break on arm
# ac_add_options --enable-linker=gold
END
@@ -114,10 +62,6 @@ END
else
cat >.mozconfig ${CI_PROJECT_DIR}/mozconfig - <<END
-ac_add_options --enable-lto=cross
-ac_add_options --enable-profile-use=cross
-ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
-ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
ac_add_options --enable-linker=gold
END
diff --git a/deb_patches/build-with-libstdc++-7.patch b/deb_patches/build-with-libstdc++-7.patch
new file mode 100644
index 0000000..dfc0665
--- /dev/null
+++ b/deb_patches/build-with-libstdc++-7.patch
@@ -0,0 +1,36 @@
+Description: point clang to the toolchain provided by the gcc-mozilla package (version 7 required for C++ 17), and statically link against libstdc++
+Author: Olivier Tilloy <olivier.tilloy@canonical.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1856861
+
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -1387,6 +1387,9 @@ set_config('_DEPEND_CFLAGS', depend_cfla
+ set_config('_HOST_DEPEND_CFLAGS', depend_cflags(host_c_compiler))
+
+
++add_old_configure_assignment('CXXFLAGS', ['--gcc-toolchain=/usr/lib/gcc-mozilla'])
++
++
+ @depends(c_compiler)
+ def preprocess_option(compiler):
+ # The uses of PREPROCESS_OPTION depend on the spacing for -o/-Fi.
+@@ -2074,7 +2074,7 @@
+ flags.append('-Wl,-syslibroot,%s' % macos_sdk)
+ else:
+ flags.append('-Wl,--sysroot=%s' % macos_sdk)
+-
++ flags.append('-static-libstdc++')
+ return flags
+
+
+--- a/servo/components/style/build_gecko.rs
++++ b/servo/components/style/build_gecko.rs
+@@ -148,6 +148,8 @@ impl BuilderExt for Builder {
+ builder = builder.with_rustfmt(path);
+ }
+
++ builder = builder.clang_arg("--gcc-toolchain=/usr/lib/gcc-mozilla");
++
+ for dir in SEARCH_PATHS.iter() {
+ builder = builder.clang_arg("-I").clang_arg(dir.to_str().unwrap());
+ }
diff --git a/deb_patches/drop-check-glibc-symbols.patch b/deb_patches/drop-check-glibc-symbols.patch
new file mode 100644
index 0000000..98cbf92
--- /dev/null
+++ b/deb_patches/drop-check-glibc-symbols.patch
@@ -0,0 +1,19 @@
+Description: Drop the glibc and stdcxx checks.
+ We're not compiling Firefox to run on a different version.
+Author: Chris Coulson <chris.coulson@canonical.com>
+Author: Olivier Tilloy <olivier.tilloy@canonical.com>
+Forwarded: not-needed
+
+--- a/python/mozbuild/mozbuild/action/check_binary.py
++++ b/python/mozbuild/mozbuild/action/check_binary.py
+@@ -296,9 +296,7 @@ def checks(target, binary):
+ target = HOST
+ checks = []
+ if target['MOZ_LIBSTDCXX_VERSION']:
+- checks.append(check_stdcxx)
+ checks.append(check_libgcc)
+- checks.append(check_glibc)
+
+ # Disabled for local builds because of readelf performance: See bug 1472496
+ if not buildconfig.substs.get('DEVELOPER_OPTIONS'):
+
diff --git a/deb_patches/fix-armhf-webrtc-build.patch b/deb_patches/fix-armhf-webrtc-build.patch
new file mode 100644
index 0000000..44e88a6
--- /dev/null
+++ b/deb_patches/fix-armhf-webrtc-build.patch
@@ -0,0 +1,83 @@
+diff -r 53fd96ca5aa4 media/webrtc/gn-configs/arm_False_arm_linux.json
+--- a/media/webrtc/gn-configs/arm_False_arm_linux.json Sun Dec 09 23:42:51 2018 +0200
++++ b/media/webrtc/gn-configs/arm_False_arm_linux.json Mon Dec 10 10:40:13 2018 +0100
+@@ -15969,9 +15969,7 @@
+ "/home/jenkins/workspace/Firefox-default/label/armv7/firefox/obj-armv7l-unknown-linux-gnueabihf/media/webrtc/trunk/webrtc/gn-output/gen/"
+ ],
+ "libs": [],
+- "sources": [
+- "//system_wrappers/source/cpu_features_linux.c"
+- ],
++ "sources": [],
+ "type": "static_library"
+ },
+ "//system_wrappers:field_trial_api": {
+diff -r 53fd96ca5aa4 media/webrtc/gn-configs/arm_True_arm_linux.json
+--- a/media/webrtc/gn-configs/arm_True_arm_linux.json Sun Dec 09 23:42:51 2018 +0200
++++ b/media/webrtc/gn-configs/arm_True_arm_linux.json Mon Dec 10 10:40:13 2018 +0100
+@@ -15558,9 +15558,7 @@
+ "/home/jenkins/workspace/Firefox-default/label/armv7/firefox/obj-armv7l-unknown-linux-gnueabihf/media/webrtc/trunk/webrtc/gn-output/gen/"
+ ],
+ "libs": [],
+- "sources": [
+- "//system_wrappers/source/cpu_features_linux.c"
+- ],
++ "sources": [],
+ "type": "static_library"
+ },
+ "//system_wrappers:field_trial_api": {
+diff -r 53fd96ca5aa4 media/webrtc/trunk/webrtc/system_wrappers/cpu_features_linux_gn/moz.build
+--- a/media/webrtc/trunk/webrtc/system_wrappers/cpu_features_linux_gn/moz.build Sun Dec 09 23:42:51 2018 +0200
++++ b/media/webrtc/trunk/webrtc/system_wrappers/cpu_features_linux_gn/moz.build Mon Dec 10 10:40:13 2018 +0100
+@@ -31,10 +31,6 @@
+ "/media/webrtc/trunk/webrtc/"
+ ]
+
+-UNIFIED_SOURCES += [
+- "/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c"
+-]
+-
+ if not CONFIG["MOZ_DEBUG"]:
+
+ DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "0"
+@@ -53,20 +49,36 @@
+ DEFINES["WEBRTC_ARCH_ARM64"] = True
+ DEFINES["WEBRTC_HAS_NEON"] = True
+
+-if CONFIG["CPU_ARCH"] == "arm":
++ UNIFIED_SOURCES += [
++ "/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c"
++ ]
+
+- CFLAGS += [
+- "-mfpu=neon"
+- ]
++if CONFIG["CPU_ARCH"] == "arm":
+
+ DEFINES["WEBRTC_ARCH_ARM"] = True
+ DEFINES["WEBRTC_ARCH_ARM_V7"] = True
+ DEFINES["WEBRTC_HAS_NEON"] = True
+
++if CONFIG["CPU_ARCH"] == "ppc64":
++
++ UNIFIED_SOURCES += [
++ "/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c"
++ ]
++
+ if CONFIG["CPU_ARCH"] == "x86":
+
+ CFLAGS += [
+ "-msse2"
+ ]
+
++ UNIFIED_SOURCES += [
++ "/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c"
++ ]
++
++if CONFIG["CPU_ARCH"] == "x86_64":
++
++ UNIFIED_SOURCES += [
++ "/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c"
++ ]
++
+ Library("cpu_features_linux_gn")
diff --git a/deb_patches/webrtc-fix-compiler-flags-for-armhf.patch b/deb_patches/webrtc-fix-compiler-flags-for-armhf.patch
new file mode 100644
index 0000000..5846b21
--- /dev/null
+++ b/deb_patches/webrtc-fix-compiler-flags-for-armhf.patch
@@ -0,0 +1,35 @@
+# Description: Don't pass -mfloat-abi=softfp on armhf
+# Author: Chris Coulson <chris.coulson@canonical.com>
+# Forwarded: no
+
+--- a/build/gyp.mozbuild
++++ b/build/gyp.mozbuild
+@@ -107,9 +107,15 @@ if CONFIG['ARM_ARCH']:
+ gyp_vars['arm_neon'] = 1
+ gyp_vars['build_with_neon'] = 1
+ else:
+- # CPU detection for ARM works on Android only. armv7 always uses CPU
+- # detection, so we have to set armv7=0 for non-Android target
+- gyp_vars['armv7'] = 0
++ gyp_vars['armv7'] = 1
++ # We enable NEON for Ubuntu armhf. Note that these don't really
++ # have any effect here as NEON is hardcoded on in
++ # media/webrtc/trunk/webrtc/build/common.gypi. Disabling these
++ # without fixing that file will result in a link failure, as
++ # targets hidden behind the build_with_neon flag don't get
++ # built but WEBRTC_HAS_NEON is still defined
++ gyp_vars['arm_neon'] = 1
++ gyp_vars['build_with_neon'] = 1
+ # For libyuv
+ gyp_vars['arm_version'] = int(CONFIG['ARM_ARCH'])
+
+--- a/media/webrtc/trunk/webrtc/build/config/compiler/BUILD.gn
++++ b/media/webrtc/trunk/webrtc/build/config/compiler/BUILD.gn
+@@ -590,7 +590,6 @@ config("compiler_cpu_abi") {
+ if (!is_nacl) {
+ cflags += [
+ "-march=$arm_arch",
+- "-mfloat-abi=$arm_float_abi",
+ ]
+ }
+ if (arm_tune != "") {
bgstack15