diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2023-02-15 17:09:07 -0500 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2023-02-17 16:51:10 -0500 |
commit | 12475eed2b49599c5715860d79f7f62b82b1689d (patch) | |
tree | 2a3be5468caea483e28b04e4b6d2dbe7b2564d02 /libre/icecat/PKGBUILD | |
parent | c1011881f760cac975044b21c7fe24ead26f0558 (diff) |
[icecat][icewesel]: minimize diffs across PKGBUILDs
Diffstat (limited to 'libre/icecat/PKGBUILD')
-rw-r--r-- | libre/icecat/PKGBUILD | 256 |
1 files changed, 168 insertions, 88 deletions
diff --git a/libre/icecat/PKGBUILD b/libre/icecat/PKGBUILD index 7135037ba..218b87542 100644 --- a/libre/icecat/PKGBUILD +++ b/libre/icecat/PKGBUILD @@ -32,20 +32,21 @@ # NOTE: icecat (60.7 < V <= current) are not complete upstream releases # upstream releases normally have $_upstream_ver ending in '-gnu<N>' -# those builds were based on gnuzilla VCS developement sources +# those builds were based on gnuzilla VCS development sources # with parabola patches applied (offered upstream, some accepted) # https://git.parabola.nu/~bill-auger/icecat.git/log/?h=parabola # NOTE: since 102.4.0, the former icecat maintainer has publishing versioned source-balls # for some versions - like the upstream VCS, they are denoted as 'testing' and # are not signed; and although the current maintainer has published newer versions; -# we should still prefer the versionedc source-balls - besides the usually reason +# we should still prefer the versioned source-balls - besides the usually reason # (always prefer versioned source-balls to VCS builds), they are a significant # reduction in workload; because gnuzilla can not be compiled from VCS - we first # need to run the makeicecat.sh script to prepare the source-ball, then sign it and # publish it, which takes hours - ordinarily, this would not deserve mention # (ie: both this and the preceding NOTEs would not be necessary); but it not yet # obvious if this recent trend will continue (ie: we may need to build from VCS -# again, which deserves a special note) +# again, which deserves a special note) - if the trend continues, these NOTEs can +# be deleted, along with the LOCs commented with "(VCS builds)" # NOTE: all of the important parabola patches are now upstreamed - the remaining patches # are now re-implemented in abslibre ('enable-sync.patch') - # those would need to be deleted, if building from VCS again (and 'dummy-sig') @@ -67,26 +68,70 @@ pkgname=icecat _upstream_ver=102.5.0-gnu1 -# _upstream_ver=${_upstream_ver/-gnu1/-gnu0-pre1} # parabola pre-release from VCS +# _upstream_ver=${_upstream_ver/-gnu1/-gnu0-pre1} # (VCS builds) pkgver=${_upstream_ver//-/_} pkgrel=1 pkgdesc="the GNU web browser, based on Mozilla Firefox ESR" -arch=(armv7h i686 x86_64) -license=(MPL GPL LGPL) url=http://www.gnu.org/software/gnuzilla/ -depends=(gtk3 libxt mime-types dbus-glib ffmpeg nss ttf-font libpulse) -makedepends=(unzip zip diffutils yasm mesa imake inetutils xorg-server-xvfb - rust clang llvm jack nodejs cbindgen nasm python - lld dump_syms wasi-compiler-rt wasi-libc wasi-libc++ wasi-libc++abi +arch=(x86_64) +arch+=( + armv7h + i686) +license=( + GPL + LGPL + MPL +) +depends=( + dbus-glib + ffmpeg + gtk3 + libpulse + libxt + mime-types + nss + ttf-font +) +makedepends=( + cbindgen + clang + diffutils + dump_syms + imake + inetutils + jack + lld + llvm + mesa + nasm + nodejs + python + rust + unzip + wasi-compiler-rt + wasi-libc + wasi-libc++ + wasi-libc++abi + xorg-server-xvfb + yasm + zip ) -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' - 'xdg-desktop-portal: Screensharing with Wayland') -options=(!emptydirs !makeflags !strip !lto !debug) -# source=(https://repo.parabola.nu/other/${pkgname}/${pkgname}-${_upstream_ver}.tar.bz2{,.sig} # parabola pre-release from VCS +optdepends=( + 'hunspell-en_US: Spell checking, American English' + 'libnotify: Notification integration' + 'networkmanager: Location detection via available WiFi networks' + 'pulseaudio: Audio support' + 'speech-dispatcher: Text-to-Speech' + 'xdg-desktop-portal: Screensharing with Wayland' +) +options=( + !debug + !emptydirs + !lto + !makeflags + !strip +) +# source=(https://repo.parabola.nu/other/${pkgname}/${pkgname}-${_upstream_ver}.tar.bz2{,.sig} # (VCS builds) source=(https://icecat.trisquel.org/${_upstream_ver%%-*}/icecat-${_upstream_ver}.tar.bz2 dummy-sig icecat.desktop icecat-safe.desktop ) @@ -94,9 +139,11 @@ source+=(vendor.js.in arc4random.diff enable-sync.patch) source_armv7h=(build-arm-libopus.patch) -source_i686=(avoid-libxul-OOM-python-check.patch - rust-static-disable-network-test-on-static-libraries.patch - firefox-99.0.1-fdlibm-double.patch) +source_i686=( + avoid-libxul-OOM-python-check.patch + rust-static-disable-network-test-on-static-libraries.patch + firefox-99.0.1-fdlibm-double.patch +) sha256sums=('4ce4257a14a70fa5237b3a3f2cb5759e32cd73e20cdd78fa0317cb296ef91d5c' 'SKIP' 'e00dbf01803cdd36fd9e1c0c018c19bb6f97e43016ea87062e6134bdc172bc7d' @@ -109,24 +156,33 @@ sha256sums_armv7h=('2d4d91f7e35d0860225084e37ec320ca6cae669f6c9c8fe7735cdbd542e3 sha256sums_i686=('2f0c81a38c4578f68f5456b618fe84a78974072821488173eb55e0e72287e353' '10c5276eab2e87f400a6ec15d7ffbef3b0407ee888dea36f1128927ca55b9041' '62695e56daf8c0b8bb921980d475b3fd169b9134188ad9ffaeb9cd660589c23d') -validpgpkeys+=('3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger (VCS builds) +#validpgpkeys+=('3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40') # bill-auger (VCS builds) -## dependency tweaks ## +## compiler and optimization tweaks ## + +# disable PGO for 32-bit arches (always), x86_64 optionally +# normally enabled ('0') for x86_64 - try '1' if the build hangs indefinitely +readonly _SHOULD_SKIP_PGO=$(case "${CARCH}" in armv7h|i686) echo 1 ;; *) echo 0 ;; esac) + +# use GCC vs LLVM for 32-bit arches +# normally not needed ('0') for x86_64 +# for 32-bit arches, try one or the other, to resolve compiler/linker issues +readonly _SHOULD_USE_GCC==$(case "${CARCH}" in armv7h) echo 1 ;; + i686 ) echo 1 ;; + x86_64) echo 0 ;; esac) -# disable PGO for 32-bit arches -_should_skip_pgo=0 # for x86_64 (try '1' if the build hangs indefinitely) + +## dependency tweaks ## case "${CARCH}" in armv7h) - _should_skip_pgo=1 - - depends+=( icu=71.1 ) # ld.lld: error: undefined hidden symbol: std::type_info::operator==(std::type_info const&) const + makedepends=( ${makedepends[*]/wasi-*/} ) # armv7h has no wasi compiler - makedepends=( ${makedepends[*]/wasi*/} ) # armv7h has no wasi compiler + depends+=( icu=72.1 ) # --with-system-icu ;; i686) - _should_skip_pgo=1 + makedepends+=( llvm14 ) # rustup: error while loading shared libraries: libLLVM-14.so: makedepends=( ${makedepends[*]/wasi-*/} ) # wasm-ld: error: cannot open /usr/lib/clang/15.0.7/lib/wasi/libclang_rt.builtins-wasm32.a: No such file or directory makedepends+=( 'wasi-libc++>=15' 'wasi-libc++<16' ) # in [community-testing] @@ -200,10 +256,33 @@ prepare() { # https://bugzilla.mozilla.org/show_bug.cgi?id=1773259 sed -i '/const uint64_t ROOT_CLIP_CHAIN = ~0;/d' gfx/webrender_bindings/webrender_ffi.h + # arch-specific technical patching case ${CARCH} in aarch64|armv7h) + patch -p1 -i ../build-arm-libopus.patch ;; - i686|x86_64) + i686) + # Unbreak build with glibc 2.36 + patch -Np1 -i ../arc4random.diff + + # readelf: Error: Unable to seek to 0x801db328 for section headers + echo "applying avoid-libxul-OOM-python-check.patch" + patch -p1 -i ../avoid-libxul-OOM-python-check.patch + + # test failure in rust code (complaining about network functions) when PGO is used, + # see https://bugzilla.mozilla.org/show_bug.cgi?id=1565757 + echo "applying rust-static-disable-network-test-on-static-libraries.patch" + patch -p1 -i ../rust-static-disable-network-test-on-static-libraries.patch + + # FIXME: this patch is probably temporary - it comes from mozilla + # https://bugzilla.mozilla.org/show_bug.cgi?id=1729459 + # /build/iceweasel/src/firefox-96.0.1/modules/fdlibm/src/math_private.h:34:21: + # error: conflicting declaration ‘typedef __double_t double_t’ + # /usr/include/math.h:156:21: note: previous declaration as ‘typedef long double double_t’ + echo "applying firefox-99.0.1-fdlibm-double.patch" + patch -p1 -i "$srcdir/firefox-99.0.1-fdlibm-double.patch" + ;; + x86_64) # Unbreak build with glibc 2.36 patch -Np1 -i ../arc4random.diff ;; @@ -230,16 +309,15 @@ ac_add_options --disable-bootstrap ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot # Branding -ac_add_options --enable-official-branding # branding (icecat) +ac_add_options --enable-official-branding ac_add_options --enable-update-channel=release ac_add_options --with-distribution-id=nu.parabola # branding over-ride ac_add_options --with-app-name=${pkgname} # branding over-ride ac_add_options --with-app-basename=${pkgname} # branding over-ride ac_add_options --with-unsigned-addon-scopes=app,system ac_add_options --allow-addon-sideload -# export MOZILLA_OFFICIAL=1 # branding (icecat) -export MOZ_APP_NAME=$pkgname # TODO: probably do not need this (per --with-app-name=) -export MOZ_APP_REMOTINGNAME=${pkgname} +# export MOZILLA_OFFICIAL=1 # branding over-ride +export MOZ_APP_REMOTINGNAME=${pkgname//-/} export MOZ_TELEMETRY_REPORTING= export MOZ_REQUIRE_SIGNING= @@ -266,7 +344,9 @@ END case ${CARCH} in aarch64|armv7h) - # version-specific hacks + # experimental/version-specific hacks # + + (( ! _SHOULD_USE_GCC )) || cat >> ../mozconfig <<EOF export CC=gcc export CXX=g++ @@ -274,16 +354,12 @@ export AR=gcc-ar export NM=gcc-nm export RANLIB=gcc-ranlib EOF - echo 'ac_add_options --with-system-icu' >> ../mozconfig # ld.lld: error: undefined hidden symbol: std::type_info::operator==(std::type_info const&) const - # archarm has these differences in ## general configuration ## above - sed -i ' - /--enable-hardening/d - /--enable-optimize/d - /--enable-rust-simd/d - s| --with-wasi-sysroot=.*| --without-wasm-sandboxed-libraries| - /--disable-eme/d - ' ../mozconfig + # ld.lld: error: undefined hidden symbol: std::type_info::operator==(std::type_info const&) const + echo 'ac_add_options --with-system-icu' >> ../mozconfig + + + # archarm configuration # if [[ $CARCH == "armv7h" ]]; then echo "ac_add_options --disable-elf-hack" >> .mozconfig @@ -306,55 +382,67 @@ EOF # archarm `export` commands are under the '[ARCH-SPECIFIC BUILD ENV]' section - patch -p1 -i ../build-arm-libopus.patch + # archarm patching is under the 'technical patching' section + + # archarm has these differences in ## general configuration ## above + # NOTE: '--disable-eme' is currently an invalid option for armv7h. + # It must be deleted in order to compile. + # If ever it becomes valid, it should not be deleted below. + sed -i ' + /--enable-hardening/d + /--enable-optimize/d + /--enable-rust-simd/d + s| --with-wasi-sysroot=.*| --without-wasm-sandboxed-libraries| + /--disable-eme/d + ' ../mozconfig - # At this point in the script, the arch, arch32, and parabola PKGBUILDs - # have prepared a temporary ${srcdir}/mozconfig; but the archarm PKGBUILD + # At this point in the recipe (this `case` block), the arch, arch32, and parabola + # PKGBUILDs have prepared a temporary ${srcdir}/mozconfig; but the archarm PKGBUILD # writes directly to the final firefox-$pkgver/.mozconfig. # We allowed .mozconfig to be written above, only to minimize the diff against archarm. - # For consistency across arches, we move it to ${srcdir}/mozconfig now. - # ${srcdir}/mozconfig will clobber firefox-$pkgver/.mozconfig later, in build(). + # For consistency across arches, we append those changes to ${srcdir}/mozconfig now. + # ${srcdir}/mozconfig will clobber firefox-$pkgver/.mozconfig later, during build(). cat .mozconfig >> ../mozconfig ;; i686) - export MOZ_SOURCE_CHANGESET="DEVEDITION_${pkgver//./_}_RELEASE" + # experimental/version-specific hacks # + + (( ! _SHOULD_USE_GCC )) || + cat >>../mozconfig <<END +export CC=gcc +export CXX=g++ +export AR=gcc-ar +export NM=gcc-nm +export RANLIB=gcc-ranlib +END + + + # arch32 configuration # + + # arch32 `export` commands are under the '[ARCH-SPECIFIC BUILD ENV]' section + # NOTE: these diffs and the compiler flags above, were moved to mozconfig-i686.patch + # they are more handy to tweak in-line though # disable LTO as it has little benefit and uses too many resources # don't compile with clang, use gcc toolchain (clang has issues on IA32) # disable SIMD (SSE2 for i686) # set correct compiler and toochain tools cat >>../mozconfig <<END -ac_add_options --disable-linker=lld -ac_add_options --enable-linker=bfd +#ac_add_options --disable-linker=lld +#ac_add_options --enable-linker=bfd ac_add_options --disable-lto ac_add_options --disable-rust-simd -ac_add_options --enable-strip ac_add_options --disable-debug ac_add_options --disable-debug-symbols -export CC=gcc -export CXX=g++ -export AR=gcc-ar -export NM=gcc-nm -export RANLIB=gcc-ranlib -export STRIP=strip END - # readelf: Error: Unable to seek to 0x801db328 for section headers - echo "applying avoid-libxul-OOM-python-check.patch" - patch -p1 -i ../avoid-libxul-OOM-python-check.patch + # FIXME GCC: /usr/lib/gcc/i686-pc-linux-gnu/12.1.0/include/xmmintrin.h:208:1: error: inlining failed in call to ‘always_inline’ ‘__m128 _mm_sqrt_ps(__m128)’: target specific option mismatch + # FIXME LLVM: /build/iceweasel/src/firefox-106.0.1/third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc:110:27: error: always_inline function '_mm_loadu_ps' requires target feature 'sse', but would be inlined into function 'ComputeFrequencyResponse_Sse2' that is compiled without support for 'sse' + echo "ac_add_options --disable-webrtc" >> ../mozconfig - # test failure in rust code (complaining about network functions) when PGO is used, - # see https://bugzilla.mozilla.org/show_bug.cgi?id=1565757 - echo "applying rust-static-disable-network-test-on-static-libraries.patch" - patch -p1 -i ../rust-static-disable-network-test-on-static-libraries.patch + sed -i '/cargo_rustc_flags += -Clto/d' config/makefiles/rust.mk # FIXME: is this needed? - # FIXME: this patch is probably temporary - it comes from mozilla - # https://bugzilla.mozilla.org/show_bug.cgi?id=1729459 - # /build/iceweasel/src/firefox-96.0.1/modules/fdlibm/src/math_private.h:34:21: - # error: conflicting declaration ‘typedef __double_t double_t’ - # /usr/include/math.h:156:21: note: previous declaration as ‘typedef long double double_t’ - echo "applying firefox-99.0.1-fdlibm-double.patch" - patch -p1 -i "$srcdir/firefox-99.0.1-fdlibm-double.patch" + # arch32 patching is under the 'technical patching' section ;; x86_64) ;; @@ -374,7 +462,6 @@ END ## patching sanity checks ## - _check_patching } @@ -434,22 +521,19 @@ build() { aarch64|armv7h) ;; i686) - # /usr/bin/ld.bfd: error: libxul.so(.debug_info) is too large (0x54c5369a bytes) - options=( ${options[*]/\!strip/} ) - # 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 ; + *) echo "no [ARCH-SPECIFIC BUILD CONFIG] for arch: ${CARCH}" ; return 1 ; ;; esac ## PGO build ## - if (( $_should_skip_pgo )) + if (( _SHOULD_SKIP_PGO )) then # skipping "3-tier PGO" "instrumented browser"; so the final .mozconfig is ready now cp ../mozconfig .mozconfig @@ -478,13 +562,14 @@ END echo "Removing instrumented browser..." ./mach clobber + echo "Building optimized browser..." 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 + fi # _SHOULD_SKIP_PGO ## sanity checks ## @@ -494,7 +579,7 @@ END ## main build ## - echo "Building optimized browser..." + (( ! _SHOULD_SKIP_PGO )) || echo "Building optimized browser..." ./mach build # echo "Building symbol archive..." # anti-feature @@ -579,15 +664,10 @@ END # libxul.so cannot find it's libraries install -dm 755 "${pkgdir}/etc/ld.so.conf.d" echo "/usr/lib/${pkgname}" > "${pkgdir}"/etc/ld.so.conf.d/${pkgname}.conf - - # disable stripping in mozconfig.<arch> (insists to use llvm-strip which runs - # out of memory on libxul.so). Now 2.5 GB can be stripped to 166 MB, so we do - # that with the normal 'strip' from binutils after 'mach install' - strip "$pkgdir/usr/lib/$pkgname/libxul.so" ;; x86_64) ;; - *) echo "no [ARCH-SPECIFIC INSTALL] for arch: ${CARCH}" ; return 1 ; + *) echo "no [ARCH-SPECIFIC INSTALL] for arch: ${CARCH}" ; return 1 ; ;; esac |