From 85f55868f631d67e5a4ab190f69e919f38be57f8 Mon Sep 17 00:00:00 2001 From: ohfp <1813007-ohfp@users.noreply.gitlab.com> Date: Sun, 29 Mar 2020 18:37:23 +0200 Subject: 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". --- binary_tarball/scripts/1_Install_Dependencies.sh | 45 ++++++++++-- binary_tarball/scripts/3_Configure_Source_Code.sh | 23 ++++-- binary_tarball/scripts/4_Build_Binary_Tarball.sh | 66 ++--------------- deb_patches/build-with-libstdc++-7.patch | 36 ++++++++++ deb_patches/drop-check-glibc-symbols.patch | 19 +++++ deb_patches/fix-armhf-webrtc-build.patch | 83 ++++++++++++++++++++++ .../webrtc-fix-compiler-flags-for-armhf.patch | 35 +++++++++ 7 files changed, 238 insertions(+), 69 deletions(-) create mode 100644 deb_patches/build-with-libstdc++-7.patch create mode 100644 deb_patches/drop-check-glibc-symbols.patch create mode 100644 deb_patches/fix-armhf-webrtc-build.patch create mode 100644 deb_patches/webrtc-fix-compiler-flags-for-armhf.patch 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 <>${CI_PROJECT_DIR}/mozconfig <.mozconfig ${CI_PROJECT_DIR}/mozconfig - <.mozconfig ${CI_PROJECT_DIR}/mozconfig - <.mozconfig ${CI_PROJECT_DIR}/mozconfig - <.mozconfig ${CI_PROJECT_DIR}/mozconfig - < +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 +Author: Olivier Tilloy +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 +# 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 != "") { -- cgit