From 5a4432312c859ee73a76b4dd090ac58e1ce33275 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Tue, 29 Dec 2020 12:47:46 -0500 Subject: [icecat]: wip - antifeatures-check - i686 --- libre/icecat/PKGBUILD | 262 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 214 insertions(+), 48 deletions(-) (limited to 'libre/icecat/PKGBUILD') diff --git a/libre/icecat/PKGBUILD b/libre/icecat/PKGBUILD index ab4f84fb4..c128a81d8 100644 --- a/libre/icecat/PKGBUILD +++ b/libre/icecat/PKGBUILD @@ -44,19 +44,67 @@ options=(!emptydirs !makeflags !strip) source=(https://repo.parabola.nu/other/${pkgname}/${pkgname}-${_upstream_ver}-pre.tar.bz2{,.sig} ${pkgname}.desktop 0001-Use-remoting-name-for-GDK-application-names.patch - rust_1.48.patch.gz) + rust-1.48_icecat-78.6.0.patch) source+=(libre.patch mozilla-1663715.patch) +source_i686=('avoid-libxul-OOM-python-check.patch' + 'rust-static-disable-network-test-on-static-libraries.patch') sha256sums=('314171bb68cd8b0fb7b880a77f3a2daa65acd660fc6f2a7d6871c5a5ba44be52' 'SKIP' 'f9f954fd06739e70a72ccf4774cfa71f349a4b133ec8f5dea0a3bcca2cf7321d' '3bb7463471fb43b2163a705a79a13a3003d70fff4bbe44f467807ca056de9a75' - 'd32c87c4526e897d64453914da43f99366d1d0b7d71e43b4027a6cb5aa274040' + 'd90faa59dc59f457c5770b3cc1ee4caa5b255e754ab9ab3993af894992c007e4' '28029afa3201e1be8138be06f741c59d64869edf0c9e90dbb05cfa6b5fff4ecd' '665cf25255fd240f79d5d010b3c3764f2d80aa81fdc7b6e9a9728e4a7970685b') +sha256sums_i686=('80b6461579398398c28f9b72b0c55220f261d9bf6c5a253e3bc66dc8a65131f6' + 'e661665ee00ecec66c33e115b0af3474452022f0d8ceda634a6315dc8cb99014') validpgpkeys=('318C679D94F17700CC847DE646A70073E4E50D4E' # Ruben Rodriguez '3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger + +# PGO requires networking +_should_skip_pgo_armv7h=1 # disable for armv7h - always +_should_skip_pgo_i686=1 # disable for i686 - always +_should_skip_pgo_x86_64=0 # disable for x86_64 - libremakepkg +eval "_should_skip_pgo=\$_should_skip_pgo_${CARCH}" + + +_check_build_config() { + pushd "${srcdir}"/${pkgname}-${pkgver%_*} > /dev/null + + echo "Checking build configuration..." + + # Configure produces mozinfo.json that reflects current configuration. + # See build/docs/mozinfo.rst + ./mach configure + + # In this test, jq collects values of the following keys of mozinfo.json into array, + # and checks if any of them are not equal to false, in which case it returns "true". + # E.g. if the value of any key is true or null (in case the key is missing from mozinfo.json), + # that means the build configuration has to be reworked. + declare -A antifeatures=( [.crashreporter]=true \ + [.datareporting]=true \ + [.healthreport]=true \ + [.normandy]=true \ + [.telemetry]=true \ + [.updater]=true ) + local obj_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}') + local config_file="${obj_directory}"/mozinfo.json + echo "verifying disabled anti-features in: ${config_file}" + for key in ${!antifeatures[@]} + do jq -e "${key} != false" "${config_file}" > /dev/null || unset antifeatures[${key}] + done + if (( ${#antifeatures[@]} )) + then echo "Some anti-features are not disabled in build configuration files - aborting:" + for key in ${!antifeatures[@]} ; do echo " - ${key} is enabled" ; done ; +# FIXME: '- .datareporting is enabled' - this build may not be FSDG-fit +# TODO: investigate the implications of this +# return 1 + fi + + popd > /dev/null +} + prepare() { mkdir -p mozbuild cd "$srcdir/$pkgname-${pkgver%_*}" @@ -65,7 +113,7 @@ prepare() { patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch # https://bugzilla.mozilla.org/show_bug.cgi?id=1667736 - patch -Np1 -i ../rust_1.48.patch + patch -Np1 -i ../rust-1.48_icecat-78.6.0.patch # https://bugzilla.mozilla.org/show_bug.cgi?id=1663715 patch -Np1 -i ../mozilla-1663715.patch @@ -112,24 +160,58 @@ ac_add_options --disable-updater ac_add_options --disable-eme END -# if [[ $CARCH = arm* ]]; then -# sed -i '/--enable-linker=gold/d' .mozconfig -# sed -i '/--enable-rust-simd/d' .mozconfig + + ## [ARCH-SPECIFIC CONFIG] ## + + # TODO: this per-arch handling is yet to be re-worked for armv7h + case "${CARCH}" in + armv*) +# sed -i '/--enable-linker=gold/d' ../mozconfig +# sed -i '/--enable-rust-simd/d' ../mozconfig # # # https://bugzilla.mozilla.org/show_bug.cgi?id=1463035 # patch -Np1 -i "$srcdir"/mozilla-1463035.patch # -# cat >> .mozconfig <> ../mozconfig <>../mozconfig <.mozconfig ../mozconfig - < error: unknown argument: '-fvar-tracking-assignments' + CFLAGS="${CFLAGS/-fvar-tracking-assignments/}" + CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}" + + + ## [ARCH-SPECIFIC BUILD ENV] ## + + # TODO: this per-arch handling is yet to be re-worked for armv7h + case "${CARCH}" in + armv*) +# export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off" +# export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" +# export CFLAGS +# export CXXFLAGS + ;; + i686) + # -fno-plt with cross-LTO -> LLVM ERROR: Function Import: link error + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + + export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off" +# export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" # ld.lld: error: unknown argument '--reduce-memory-overheads' + export LDFLAGS+=" -Wl,--no-keep-memory" + export CFLAGS + export CXXFLAGS + ;; + x86_64) + # TODO: this may only be needed for v78 + # -fno-plt with cross-LTO causes obscure LLVM errors + # LLVM ERROR: Function Import: link error + CFLAGS="${CFLAGS/-fno-plt/}" + CXXFLAGS="${CXXFLAGS/-fno-plt/}" + + export CFLAGS + export CXXFLAGS + ;; + *) echo "no [ARCH-SPECIFIC BUILD ENV] for arch: ${CARCH}" ; return 1 ; + ;; + esac + + + ## [ARCH-SPECIFIC BUILD CONFIG] ## + + # TODO: this per-arch handling is yet to be re-worked for armv7h + case ${CARCH} in + armv7h) + ;; + i686) + # avoid excessive debug symbols in rust leading to out-of-memory situations + sed -i "s/debug_info = '\''2'\''/debug_info = '\''0'\''/" build/moz.configure/toolchain.configure + ;; + x86_64) + ;; + *) echo "no [ARCH-SPECIFIC BUILD CONFIG] for arch: ${CARCH}" ; return 1 ; + ;; + esac + + + ## PGO build ## + + if (( $_should_skip_pgo )) + then + # skipping "3-tier PGO" "instrumented browser", to avoid OOM problems; + # so we have the final .mozconfig now + cp ../mozconfig .mozconfig + else + # Do 3-tier PGO + echo "Building instrumented browser..." + cat >.mozconfig ../mozconfig - <.mozconfig ../mozconfig - <.mozconfig ../mozconfig - < "${pkgdir}"/etc/ld.so.conf.d/${pkgname}.conf + ;; + x86_64) + ;; + *) echo "no [ARCH-SPECIFIC INSTALL] for arch: ${CARCH}" ; return 1 ; + ;; + esac } -- cgit v1.2.2