summaryrefslogtreecommitdiff
path: root/libre/icecat/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'libre/icecat/PKGBUILD')
-rw-r--r--libre/icecat/PKGBUILD372
1 files changed, 305 insertions, 67 deletions
diff --git a/libre/icecat/PKGBUILD b/libre/icecat/PKGBUILD
index bf8c8dfce..011e7b67f 100644
--- a/libre/icecat/PKGBUILD
+++ b/libre/icecat/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer (arch): Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Jakub Schmidtke <sjakub@gmail.com>
-# Maintainer (aur): Figue <ffigue at gmail>
+# Contributor: Figue <ffigue at gmail>
# Contributor: fauno <fauno@kiwwwi.com.ar>
# Contributor: evr <evanroman at gmail>
# Contributor: Muhammad 'MJ' Jassim <UnbreakableMJ@gmail.com>
@@ -15,77 +15,107 @@
# Contributor: grizzlyuser <grizzlyuser@protonmail.com>
-# NOTE: icecat (60.7 < V <= 78.9) are not upstream releases
+# NOTE: icecat (60.7 < V <= 78.10) are not upstream releases
# upstream releases would normally have '-gnu' appended to $_upstream_ver
# this build is based on gnuzilla VCS developement sources
-# rev: 8b54aee6bd0c39f043bbba7a654870e032a910bc
-
-# NOTE: this PKGBUILD is a temporary WIP
-# it is based on the AUR PKGBUILD, which also runs makeicecat at build-time
-# makeicecat requires an active internet connection though, so that code was removed
-# this was introduced hastily, because 'icu' had changed,
-# and the 78.9.0 parabola PKGBUILD had "sandbox violation" problems at the time
-# eventually, the original parabola PKGBUILD should be restored/merged with this recipe
-# per rev: 04c332d29f362070a883baa3eab40df4a6f701d3
-# TODO: this PKGBUILD has several issues:
-# - it is adapted only for x86_64
-# - it has branding issues eg: missing "topsites", serach-engines, previous parabola patching
-# - it has two switchable implememtations (per '_make_srcball' - both work);
-# but preparing the upstream source-ball requires network access,
-# and the source-ball is only necessary becuase gnuzilla has not published one for v78
+# rev: b72c22186cf381d7b1f93be550c9da30865d03b4
pkgname=icecat
-_upstream_ver=78.9.0-pre # -gnu
-_mozilla_ver=${_upstream_ver%-*}
+_upstream_ver=78.10.0-pre2 # -gnu1
pkgver=${_upstream_ver//-/_}
pkgrel=1
-_commit=8b54aee6bd0c39f043bbba7a654870e032a910bc
-pkgdesc="The GNU web browser, based on Mozilla Firefox ESR"
-arch=(x86_64)
-url="http://www.gnu.org/software/gnuzilla/"
-license=('GPL' 'MPL' 'LGPL')
-
+pkgdesc="the GNU web browser, based on Mozilla Firefox ESR"
+arch=(x86_64 i686 armv7h)
+license=(MPL GPL LGPL)
+url=http://www.gnu.org/software/gnuzilla/
depends=(gtk3 libxt mime-types dbus-glib ffmpeg nss ttf-font libpulse)
makedepends=(m4 unzip zip diffutils python2-setuptools yasm mesa imake inetutils
xorg-server-xvfb autoconf2.13 rust clang llvm jack gtk2
- python nodejs python2-psutil cbindgen nasm lld perl-file-rename)
+ python nodejs python2-psutil cbindgen nasm perl-file-rename)
+makedepends+=(mozilla-searchplugins jq)
+makedepends=(${makedepends[*]/rust/rust=1:1.49.0}) # FIXME:
optdepends=('networkmanager: Location detection via available WiFi networks'
'libnotify: Notification integration'
'pulseaudio: Audio support'
'speech-dispatcher: Text-to-Speech'
'hunspell-en_US: Spell checking, American English')
options=(!emptydirs !makeflags !strip)
-
source=(https://repo.parabola.nu/other/${pkgname}/${pkgname}-${_upstream_ver}.tar.bz2{,.sig}
icecat.desktop icecat-safe.desktop
0001-Use-remoting-name-for-GDK-application-names.patch
rust_1.48.patch.gz)
-sha256sums=('6f777cbea1066ba10db64967d55b9204e14bbea9a7836c4bf7e7a1e642f97716'
+source+=(searchplugins_list.json
+ 9003-misc-libre.patch)
+source_i686=('rust-static-disable-network-test-on-static-libraries.patch')
+sha256sums=('f4334ab97a30bf8e8fe400c55ed00fcea1d44536dc6df1c7f65fec8eae1664a3'
'SKIP'
'e00dbf01803cdd36fd9e1c0c018c19bb6f97e43016ea87062e6134bdc172bc7d'
'33dd309eeb99ec730c97ba844bf6ce6c7840f7d27da19c82389cdefee8c20208'
'e0eaec8ddd24bbebf4956563ebc6d7a56f8dada5835975ee4d320dd3d0c9c442'
'c7f867ccee684939c9f0a9c30ea69127077bbe43af545a03f09dfbbdc02545a9')
-validpgpkeys=('3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger
+sha256sums+=('3edb4add450f94c579f2df7c16ac4d9bd9f5c6acf3fbd8a05ce24c21c317257d'
+ '28029afa3201e1be8138be06f741c59d64869edf0c9e90dbb05cfa6b5fff4ecd')
+sha256sums_i686=('068efe37a99561490e6ec7b70a3cd4dd84e89e6bdf19f04a475d06c78fd28920')
+validpgpkeys=('318C679D94F17700CC847DE646A70073E4E50D4E') # Ruben Rodriguez
+validpgpkeys+=('3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger (VCS builds)
+
+
+# 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.
+ local obj_directory=$(./mach environment | sed -En '/object directory:/{n;s/^\s+//;p;}')
+ local mozinfo_json="${obj_directory}"/mozinfo.json
+ local antifeature_keys=('.crashreporter' '.datareporting' '.healthreport' '.normandy' '.telemetry' '.updater')
+ local antifeatures=()
+ local jq_cmd=( jq -e "${key} != false" "${mozinfo_json}" )
+ printf "\$mozinfo_json %s - obj_directory is: %s\n" \
+ "$( [[ -f "${mozinfo_json}" ]] || printf "not " )found" \
+ "${obj_directory}"
+
+ for key in ${antifeature_keys[@]} ; do ${jq_cmd[@]} && antifeatures+=(${key}); done ;
+
+ if (( ${#antifeatures[@]} ))
+ then echo "Some anti-features are not disabled in build configuration files, aborting:"
+ for key in ${antifeature_keys[@]}
+ do echo "${key} - $( ${jq_cmd[@]} || echo "not " )detected\n"
+ done
+
+ # return 1 # FIXME: .datareporting is detected
+ fi
+
+ popd > /dev/null
+}
prepare() {
- cd "${srcdir}"/$pkgname-${_mozilla_ver}/
+ mkdir -p mozbuild
+ cd "$srcdir/$pkgname-${pkgver%_*}"
# https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
- patch -Np1 -i "${srcdir}"/0001-Use-remoting-name-for-GDK-application-names.patch
+ patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch
# https://bugzilla.mozilla.org/show_bug.cgi?id=1667736
- patch -Np1 -i "${srcdir}"/rust_1.48.patch
+ patch -Np1 -i ../rust_1.48.patch
- # Patch to move files directly to /usr/lib/icecat. No more symlinks.
- sed -e 's;$(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME);g' -i config/baseconfig.mk
- sed -e 's;$(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME)-devel;g' -i config/baseconfig.mk
-
- printf '%b' " \e[1;36m->\e[0m\033[1m Starting build...\n"
-
- cat >./mozconfig <<END
+ cat >../mozconfig <<END
ac_add_options --enable-application=browser
ac_add_options --prefix=/usr
@@ -93,8 +123,6 @@ ac_add_options --enable-release
ac_add_options --enable-hardening
ac_add_options --enable-optimize
ac_add_options --enable-rust-simd
-ac_add_options --enable-linker=lld
-ac_add_options --disable-elf-hack
export CC='clang --target=x86_64-unknown-linux-gnu'
export CXX='clang++ --target=x86_64-unknown-linux-gnu'
export AR=llvm-ar
@@ -103,8 +131,16 @@ export RANLIB=llvm-ranlib
# Branding
ac_add_options --enable-official-branding
+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=${pkgname}
+export MOZ_APP_REMOTINGNAME=${pkgname}
+export MOZ_TELEMETRY_REPORTING=
+export MOZ_REQUIRE_SIGNING=
+ac_add_options --with-app-basename=${pkgname}
+ac_add_options --with-app-name=${pkgname}
# System libraries
ac_add_options --with-system-nspr
@@ -117,14 +153,93 @@ ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-tests
ac_add_options --disable-eme
-
-ac_add_options --with-app-basename=icecat
-ac_add_options --with-app-name=icecat
END
+
+
+ ## [ARCH-SPECIFIC CONFIG] ##
+
+ case "${CARCH}" in
+ armv7h)
+# TODO: re-work for armv7h
+# 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 <<END
+#ac_add_options --enable-optimize="-g -O2 -fno-schedule-insns"
+#ac_add_options --disable-elf-hack
+#ac_add_options --disable-webrtc
+#ac_add_options --disable-av1
+#END
+ ;;
+ i686)
+# sed -i '/--enable-linker=gold/d' ../mozconfig
+ sed -i '/--enable-rust-simd/d' ../mozconfig
+
+ # test failure in rust code (complaining about network functions) when PGO is used,
+ # TEST-UNEXPECTED-FAIL | check_networking | libgkrust.a | Identified 7 networking function(s) being imported in the rust static library (accept,connect,getsockname,getsockopt,listen,recv,send)
+ # see https://bugzilla.mozilla.org/show_bug.cgi?id=1565757
+ echo "applying rust-static-disable-network-test-on-static-libraries.patch"
+ patch -Np0 -i ../rust-static-disable-network-test-on-static-libraries.patch
+ ;;
+ x86_64)
+ ;;
+ *) echo "no [ARCH-SPECIFIC CONFIG] for arch: ${CARCH}" ; return 1 ;
+ ;;
+ esac
+
+
+ ## searchengines ##
+
+ pushd browser/components/search/extensions > /dev/null
+
+ # Patch search-engines configs
+ cp "${srcdir}"/searchplugins_list.json list.json
+ sed -i 's|https://duckduckgo.com/|https://html.duckduckgo.com/html/|' ddg/manifest.json
+
+ # 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)'
+ jq "${jq_cmd}" ddg/manifest.json > manifest.json.tmp
+ ! diff manifest.json.tmp ddg/manifest.json > /dev/null
+ mv manifest.json.tmp ddg/manifest.json
+
+ # Delete unused search engine configs
+ cp -rv /usr/share/mozilla/searchplugins/* .
+ find -mindepth 1 -maxdepth 1 \
+ -not -name ddg \
+ -not -name duckduckgo-html \
+ -not -name duckduckgo-lite \
+ -not -name internet-archive \
+ -not -name parabola-labs \
+ -not -name parabola-packages \
+ -not -name parabola-wiki \
+ -not -name searx \
+ -not -name wikipedia \
+ -not -name yacy \
+ -not -name list.json \
+ -exec rm -rf {} \;
+
+ # Sanity-check search-engines patching
+ local engines_err_msg="search-engines patching needs re-working"
+ jq < list.json || ! echo "${engines_err_msg}"
+
+ popd > /dev/null
+
+
+ ## libre patching ##
+
+ # Remove remaining non-free bits
+ echo "applying 9003-misc-libre.patch"
+ patch -Np1 --no-backup-if-mismatch -i "${srcdir}"/9003-misc-libre.patch
}
build() {
- cd "${srcdir}"/$pkgname-${_mozilla_ver}/
+ cd "$srcdir/$pkgname-${pkgver%_*}"
+
+ ## build env ##
export MOZ_NOSPAM=1
export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
@@ -137,34 +252,125 @@ build() {
CFLAGS="${CFLAGS/-fvar-tracking-assignments/}"
CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}"
- # -fno-plt with cross-LTO causes obscure LLVM errors
- # LLVM ERROR: Function Import: link error
- CFLAGS="${CFLAGS/-fno-plt/}"
- CXXFLAGS="${CXXFLAGS/-fno-plt/}"
- ./mach build
- #./mach buildsymbols
-}
+ ## [ARCH-SPECIFIC BUILD ENV] ##
+
+ case "${CARCH}" in
+ armv7h)
+# TODO: re-work for armv7h
+# export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off"
+# export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
+ ;;
+ i686)
+ # -fno-plt with cross-LTO -> LLVM ERROR: Function Import: link error
+ CFLAGS="${CFLAGS/-fno-plt/}"
+ CXXFLAGS="${CXXFLAGS/-fno-plt/}"
+
+ # disable LTO (clang has issues on IA32)
+ export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off"
+ export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
+ ;;
+ x86_64)
+ ;;
+ *) echo "no [ARCH-SPECIFIC BUILD ENV] for arch: ${CARCH}" ; return 1 ;
+ ;;
+ esac
+ export CFLAGS
+ export CXXFLAGS
+
+
+ ## [ARCH-SPECIFIC BUILD CONFIG] ##
+
+ case ${CARCH} in
+ armv7h)
+# TODO: re-work for 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 - <<END
+ac_add_options --enable-profile-generate=cross
+END
+ _check_build_config
+ ./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."
+ return 1
+ fi
+
+ if [[ ! -s jarlog ]]; then
+ echo "No jar log produced."
+ return 1
+ fi
+
+ echo "Removing instrumented browser..."
+ ./mach clobber
+
+ cat >.mozconfig ../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
+END
+ fi # $_should_skip_pgo
+
+
+ ## sanity checks ##
+
+ # 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
-package () {
- cd "${srcdir}"/$pkgname-${_mozilla_ver}/
- # Remove cose.manifest and cose.sig cause march install fails
- find obj-x86_64-pc-linux-gnu/dist/bin/browser/extensions -name cose.manifest -delete
- find obj-x86_64-pc-linux-gnu/dist/bin/browser/extensions -name cose.sig -delete
+ ## main build ##
+ echo "Building optimized browser..."
+ ./mach build
+}
+
+package() {
+ cd "$srcdir/$pkgname-${pkgver%_*}"
DESTDIR="$pkgdir" ./mach install
- local _vendorjs="$pkgdir/usr/lib/${pkgname}/browser/defaults/preferences/vendor.js"
- install -Dvm644 /dev/stdin "$_vendorjs" <<END
+ local vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
+ install -Dvm644 /dev/stdin "$vendorjs" <<END
// Use LANG environment variable to choose locale
pref("intl.locale.requested", "");
+// Use system-provided dictionaries
+pref("spellchecker.dictionary_path", "/usr/share/hunspell");
+
// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);
-// Opt all of us into e10s, instead of just 50%
-pref("browser.tabs.remote.autostart", true);
+// Don't disable extensions in the application directory
+pref("extensions.autoDisableScopes", 11);
END
local distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
@@ -180,15 +386,47 @@ app.distributor.channel=$pkgname
app.partner.parabola=parabola
END
- printf '%b' " \e[1;36m->\e[0m\033[1m Finishing...\n"
install -m755 -d ${pkgdir}/usr/share/applications
install -m755 -d ${pkgdir}/usr/share/pixmaps
+ local i
for i in 16 32 48; do
- install -Dm644 browser/branding/official/default${i}.png \
- "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/icecat.png"
+ install -Dm644 browser/branding/official/default${i}.png \
+ "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/${pkgname}.png"
done
- install -Dm644 browser/branding/official/default48.png ${pkgdir}/usr/share/pixmaps/icecat.png
- install -Dm644 ${srcdir}/icecat.desktop ${pkgdir}/usr/share/applications/
- install -Dm644 ${srcdir}/icecat-safe.desktop ${pkgdir}/usr/share/applications/
+
+ install -Dm644 browser/branding/official/default48.png "${pkgdir}"/usr/share/pixmaps/icecat.png
+ install -Dm644 "${srcdir}"/icecat.desktop "${pkgdir}"/usr/share/applications/
+ install -Dm644 "${srcdir}"/icecat-safe.desktop "${pkgdir}"/usr/share/applications/
+
+ # Install a wrapper to avoid confusion about binary path
+ install -Dvm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
+#!/bin/sh
+exec /usr/lib/$pkgname/$pkgname "\$@"
+END
+
+
+ ## [ARCH-SPECIFIC INSTALL] ##
+
+ case ${CARCH} in
+ armv7h)
+# TODO: re-work for armv7h
+ ;;
+ i686)
+ ;;
+ x86_64)
+ ;;
+ *) echo "no [ARCH-SPECIFIC INSTALL] for arch: ${CARCH}" ; return 1 ;
+ ;;
+ esac
+
+ # Replace duplicate binary with wrapper
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
+ ln -srfv "$pkgdir/usr/bin/$pkgname" "$pkgdir/usr/lib/$pkgname/$pkgname-bin"
+
+ # Use system certificates
+ local nssckbi="$pkgdir/usr/lib/$pkgname/libnssckbi.so"
+ if [[ -e $nssckbi ]]; then
+ ln -srfv "$pkgdir/usr/lib/libnssckbi.so" "$nssckbi"
+ fi
}