diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2020-12-22 13:37:41 -0500 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2021-01-08 18:49:34 -0500 |
commit | 67543610649d27431b8f5d3aaed572305e2a8918 (patch) | |
tree | 419de9a0eb3916f91b2c940ab498e697ce99fc84 | |
parent | c119d03f02d8f3f7f8244d27eb48933fcf8ba818 (diff) | |
download | abslibre-67543610649d27431b8f5d3aaed572305e2a8918.tar.gz abslibre-67543610649d27431b8f5d3aaed572305e2a8918.tar.bz2 abslibre-67543610649d27431b8f5d3aaed572305e2a8918.zip |
[icedove][iceweasel]: housekeeping - refactor anti-features check
these changes are an attempt to normalize common patching
implementations, in order to reduce the diffs
across all of our mozilla PKGBUILDs
-rw-r--r-- | libre/icecat/PKGBUILD | 31 | ||||
-rw-r--r-- | libre/icedove/PKGBUILD | 27 | ||||
-rw-r--r-- | libre/iceweasel/PKGBUILD | 133 | ||||
-rw-r--r-- | nonprism/icedove/PKGBUILD | 27 |
4 files changed, 123 insertions, 95 deletions
diff --git a/libre/icecat/PKGBUILD b/libre/icecat/PKGBUILD index eef0d52df..2b763c67b 100644 --- a/libre/icecat/PKGBUILD +++ b/libre/icecat/PKGBUILD @@ -68,6 +68,8 @@ 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. @@ -78,13 +80,21 @@ _check_build_config() { # 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. - local object_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}') - local jq_cmd='[.crashreporter, .datareporting, .healthreport, .normandy, .telemetry, .updater] | any(. != false)' - local features_not_disabled=$(cat "$object_directory/mozinfo.json" | jq -e "${jq_cmd}") - if $features_not_disabled; then - echo 'Some features are not disabled correctly in build configuration files, aborting.' -# return 1 + local obj_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}') + local antifeature_keys=(.crashreporter .datareporting .healthreport .normandy .telemetry .updater) + local antifeatures=() + echo "obj_directory is: ${obj_directory}" + for key in ${antifeature_keys[@]} + do jq -e "${key} != false" "${obj_directory}"/mozinfo.json && 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 +# return 1 fi + + popd > /dev/null } prepare() { @@ -117,13 +127,12 @@ ac_add_options --enable-update-channel=release ac_add_options --with-distribution-id=nu.parabola ac_add_options --with-unsigned-addon-scopes=app,system ac_add_options --allow-addon-sideload -export MOZ_APP_NAME=icecat -export MOZ_APP_REMOTINGNAME=${pkgname//-/} +export MOZ_APP_NAME=${pkgname} +export MOZ_APP_REMOTINGNAME=${pkgname} export MOZ_TELEMETRY_REPORTING= export MOZ_REQUIRE_SIGNING= - -ac_add_options --with-app-basename=icecat -ac_add_options --with-app-name=icecat +ac_add_options --with-app-basename=${pkgname} +ac_add_options --with-app-name=${pkgname} # System libraries ac_add_options --with-system-nspr diff --git a/libre/icedove/PKGBUILD b/libre/icedove/PKGBUILD index f2f596731..856c00f11 100644 --- a/libre/icedove/PKGBUILD +++ b/libre/icedove/PKGBUILD @@ -177,22 +177,23 @@ END build() { cd $_pkgname-$pkgver - # clang-10: error: unknown argument: '-fvar-tracking-assignments' + # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments' CFLAGS="${CFLAGS/-fvar-tracking-assignments/}" CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}" - if [[ $CARCH = armv7h ]]; then - export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" - sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk - sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure - export MOZ_MAKE_FLAGS=-j1 - fi - - if [[ $CARCH = i686 ]]; then - sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk - sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure - export MOZ_MAKE_FLAGS=-j1 - fi + case "${CARCH}" in + armv*) + export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" + sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk + sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure + export MOZ_MAKE_FLAGS=-j1 + ;; + i686) + sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk + sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure + export MOZ_MAKE_FLAGS=-j1 + ;; + esac ./mach configure ./mach build diff --git a/libre/iceweasel/PKGBUILD b/libre/iceweasel/PKGBUILD index 24f639c4b..9fc8b3125 100644 --- a/libre/iceweasel/PKGBUILD +++ b/libre/iceweasel/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer (arch): Jan Alexander Steffens (heftig) <heftig@archlinux.org> # Contributor (arch): Ionut Biru <ibiru@archlinux.org> # Contributor (arch): Jakub Schmidtke <sjakub@gmail.com> -# Maintainer (connochaetos): Henry Jensen <hjensen@connochaetos.org> +# Contributor: Henry Jensen <hjensen@connochaetos.org> # Maintainer (alarm): Kevin Mihelich <kevin@archlinuxarm.org> # Maintainer (arch32): Andreas Baumann <mail@andreasbaumann.cc> # Contributor (arch32): Erich Eckner <git@eckner.net> @@ -110,6 +110,35 @@ _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. + local obj_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}') + local antifeature_keys=(.crashreporter .datareporting .healthreport .normandy .telemetry .updater) + local antifeatures=() + echo "obj_directory is: ${obj_directory}" + for key in ${antifeature_keys[@]} + do jq -e "${key} != false" "${obj_directory}"/mozinfo.json && 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 ; + return 1 + fi + + popd > /dev/null +} + prepare() { mkdir mozbuild cd firefox-$pkgver @@ -150,7 +179,7 @@ ac_add_options --with-distribution-id=nu.parabola ac_add_options --with-unsigned-addon-scopes=app,system ac_add_options --allow-addon-sideload export MOZ_APP_NAME=$pkgname -export MOZ_APP_REMOTINGNAME=${pkgname//-/} +export MOZ_APP_REMOTINGNAME=${pkgname} export MOZ_TELEMETRY_REPORTING= export MOZ_REQUIRE_SIGNING= @@ -271,24 +300,7 @@ END quilt push -av - ## libre patching ## - - # Remove remaining non-free bits - echo "applying libre.patch" - patch -Np1 -i ../libre.patch - - # Disable various components at the source level - sed -i 's/;1/;0/' toolkit/components/telemetry/components.conf - sed -Ei 's/((MOZ_SERVICES_HEALTHREPORT|MOZ_NORMANDY).+)True/\1False/' browser/moz.configure - #sed -i 's/;1/;0/' browser/experiments/Experiments.manifest - #sed -i '/pocket/d' browser/extensions/moz.build - #sed -i '/activity-stream/d' browser/extensions/moz.build - - # Load custom searchplugins - # FIXME: no longer applicable - replace with (broken) replacement fo libre/mozilla-searchplugins - # https://git.parabola.nu/packages/iceweasel.git/tree/branding-dev-build/mozilla-searchplugins?h=68.0 -# rm -rvf -- browser/components/search/searchplugins/{*.xml,images/} -# cp -av -- /usr/lib/mozilla/searchplugins/* browser/components/search/searchplugins/ + ## searchengines ## # Patch search-engines config # FIXME: custom searchplugins ID per new format above ("ddg" is standard) @@ -296,11 +308,25 @@ END # local remove_engines_sed='s|.*oogle.*| "ddg", "duckduckgo-html", "duckduckgo-lite", "internet-archive", "parabola-labs", "parabola-packages", "parabola-wiki-en", "searx", "wikipedia", "yacy"|g' local remove_engines_sed='s|.*oogle.*| "ddg", "wikipedia"|g' echo "applying libre-searchengines.patch" - patch -Np1 -i ../libre-searchengines.patch - pushd browser/components/search/extensions + patch -Np1 -i "${srcdir}"/libre-searchengines.patch sed -i "${remove_engines_sed}" list.json sed -i 's|https://duckduckgo.com/|https://html.duckduckgo.com/html/|' ddg/manifest.json - + + pushd browser/components/search/extensions + + # replace default searchplugins + # FIXME: no longer applicable - replace with (broken) replacement fo libre/mozilla-searchplugins + # https://git.parabola.nu/packages/iceweasel.git/tree/branding-dev-build/mozilla-searchplugins?h=68.0 +# rm -rvf -- browser/components/search/searchplugins/{*.xml,images/} +# cp -av -- /usr/lib/mozilla/searchplugins/* browser/components/search/searchplugins/ + # TODO: replacement implementation for above - see analogous changes in libre/icecat/PKGBUILD +# cp -av -- /usr/share/mozilla/searchplugins/* . + find -mindepth 1 -maxdepth 1 \ + -not -name ddg \ + -not -name wikipedia \ + -not -name list.json \ + -exec rm -rf {} \; + # Removing URL parameters that let DuckDuckGo know the place in UI # the search was ran from (like address bar, context menu, etc.) local jq_cmd='del(.chrome_settings_overrides.search_provider.params)' @@ -313,13 +339,18 @@ END local engines_err_msg="search-engines patch needs re-working" ! grep -E ${removed_engines_regex} list.json > /dev/null || ! echo "${engines_err_msg}" - find -mindepth 1 -maxdepth 1 \ - -not -name ddg \ - -not -name wikipedia \ - -not -name list.json \ - -exec rm -rf {} \; popd + + ## libre patching ## + + # Disable various components at the source level + sed -i 's/;1/;0/' toolkit/components/telemetry/components.conf + sed -Ei 's/((MOZ_SERVICES_HEALTHREPORT|MOZ_NORMANDY).+)True/\1False/' browser/moz.configure + #sed -i 's/;1/;0/' browser/experiments/Experiments.manifest + #sed -i '/pocket/d' browser/extensions/moz.build + #sed -i '/activity-stream/d' browser/extensions/moz.build + # Removing What's New tab from Developer Tools, usages are removed by libre.patch rm -rf devtools/client/whats-new @@ -331,26 +362,10 @@ END -e '!toolkit/crashreporter/google-breakpad/src/third_party/lss/' \ -e '!third_party/python/**/*.egg-info/' rm -rf .git -} - -_check_build_config() { - 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. - local object_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}') - local jq_cmd='[.crashreporter, .datareporting, .healthreport, .normandy, .telemetry, .updater] | any(. != false)' - local features_not_disabled=$(cat "$object_directory/mozinfo.json" | jq -e "${jq_cmd}") - if $features_not_disabled; then - echo 'Some features are not disabled correctly in build configuration files, aborting.' - return 1 - fi + # Patch and remove anything that's left + echo "applying libre.patch" + patch -Np1 -i "${srcdir}"/libre.patch } build() { @@ -368,7 +383,7 @@ build() { case ${CARCH} in armv7h) - # clang-9: error: unknown argument: '-fvar-tracking-assignments' + # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments' CFLAGS="${CFLAGS/-fvar-tracking-assignments/}" CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}" @@ -395,7 +410,7 @@ build() { export CXXFLAGS+=" -mmmx" ;; x86_64) - # clang-9 -> error: unknown argument: '-fvar-tracking-assignments' + # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments' CFLAGS="${CFLAGS/-fvar-tracking-assignments/}" CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}" @@ -443,11 +458,15 @@ END 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 + if [[ ! -s merged.profdata ]]; then + echo "No profile data produced." + return 1 + fi - stat -c "Jar log found (%s bytes)" jarlog - test -s jarlog + if [[ ! -s jarlog ]]; then + echo "No jar log produced." + return 1 + fi echo "Removing instrumented browser..." ./mach clobber @@ -465,7 +484,6 @@ END # each of the [ARCH-SPECIFIC BUILD CONFIG] branches above should have created .mozconfig [[ ! -f .mozconfig ]] && echo ".mozconfig file not found in source root" && return 1 - _check_build_config @@ -493,11 +511,10 @@ pref("browser.shell.checkDefaultBrowser", false); // Don't disable extensions in the application directory pref("extensions.autoDisableScopes", 11); END - # Parabola additions to vendor.js - local _shortver=$(cut -d. -f1,2 <<<"$pkgver") - cat "${srcdir}"/vendor.js.in >> "$vendorjs" - sed -i "s|@_SHORTVER_@|$_shortver|g" "$vendorjs" + local _shortver=$(cut -d. -f1,2 <<<"${pkgver}") + cat "${srcdir}"/vendor.js.in >> "${vendorjs}" + sed -i "s|@_SHORTVER_@|$_shortver|g" "${vendorjs}" local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini" install -Dvm644 /dev/stdin "$distini" <<END diff --git a/nonprism/icedove/PKGBUILD b/nonprism/icedove/PKGBUILD index f4b7e57ea..589618fb5 100644 --- a/nonprism/icedove/PKGBUILD +++ b/nonprism/icedove/PKGBUILD @@ -205,22 +205,23 @@ END build() { cd $_pkgname-$pkgver - # clang-10: error: unknown argument: '-fvar-tracking-assignments' + # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments' CFLAGS="${CFLAGS/-fvar-tracking-assignments/}" CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}" - if [[ $CARCH = armv7h ]]; then - export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" - sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk - sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure - export MOZ_MAKE_FLAGS=-j1 - fi - - if [[ $CARCH = i686 ]]; then - sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk - sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure - export MOZ_MAKE_FLAGS=-j1 - fi + case "${CARCH}" in + armv*) + export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" + sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk + sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure + export MOZ_MAKE_FLAGS=-j1 + ;; + i686) + sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk + sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure + export MOZ_MAKE_FLAGS=-j1 + ;; + esac ./mach configure ./mach build |