From bb2a568aebd3667344572da13cd2dbe7fc469761 Mon Sep 17 00:00:00 2001 From: Duncaen Date: Tue, 4 Feb 2025 14:19:26 +0100 Subject: [PATCH] firefox: update to 135.0. --- .../patches/clang-sysroot-toolchain-fix.patch | 18 +++ srcpkgs/firefox/template | 105 +++++++----------- 2 files changed, 59 insertions(+), 64 deletions(-) create mode 100644 srcpkgs/firefox/patches/clang-sysroot-toolchain-fix.patch diff --git a/srcpkgs/firefox/patches/clang-sysroot-toolchain-fix.patch b/srcpkgs/firefox/patches/clang-sysroot-toolchain-fix.patch new file mode 100644 index 00000000000..898603f5293 --- /dev/null +++ b/srcpkgs/firefox/patches/clang-sysroot-toolchain-fix.patch @@ -0,0 +1,18 @@ +We need to pass --sysroot and --gcc-toolchain explicitly for cross compiling with glibc +because when the lld tries to link libc, it will read the gcc libc linker script which +includes absolute paths to actual libc files and without the sysroot argument it picks +the host ones, even though it discovered the linker script in the sysroot already. +linker-script = /usr/aarch64-linux-gnu/lib64/libc.so +--- a/build/moz.configure/toolchain.configure ++++ b/build/moz.configure/toolchain.configure +@@ -725,6 +725,10 @@ + flags.append("--target=%s" % toolchain) + has_target = True + ++ if info.type == "clang" and not target.os == "WASI" and (info.cpu != target.cpu): ++ flags.append("--sysroot=/usr/%s" % toolchain) ++ flags.append("--gcc-toolchain=/usr") ++ + if not has_target and (not info.cpu or info.cpu != target.cpu): + same_arch = same_arch_different_bits() + if (target.cpu, info.cpu) in same_arch: diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template index 277ffd6c666..e195f0a7446 100644 --- a/srcpkgs/firefox/template +++ b/srcpkgs/firefox/template @@ -3,7 +3,7 @@ # THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/firefox-i18n". # pkgname=firefox -version=134.0 +version=135.0 revision=1 build_helper="rust" short_desc="Mozilla Firefox web browser" @@ -12,29 +12,31 @@ license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later" homepage="https://www.mozilla.org/firefox/" changelog="https://www.mozilla.org/en-US/firefox/${version}/releasenotes/" distfiles="${MOZILLA_SITE}/firefox/releases/${version/beta/b}/source/firefox-${version/beta/b}.source.tar.xz" -checksum=ca88068bd72784c10de16df62359b2dc354672a1a427b4fd6a5fcdb34c06457e +checksum=827e12a962ef47511089af4498f65ebf42fa57ca31db790bfd7e9a820d16b960 lib32disabled=yes _llvmver=19 # needs to match rust hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust - cargo llvm${_llvmver} clang${_llvmver} lld${_llvmver} nodejs cbindgen nasm which tar - $(vopt_if pgo 'xvfb-run dbus')" + cargo llvm${_llvmver} clang${_llvmver} lld${_llvmver} nodejs cbindgen nasm which + tar xz $(vopt_if pgo 'xvfb-run dbus mesa-dri vulkan-loader pciutils') + $(vopt_if wasi wasi-sdk)" makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std - libXdamage-devel freetype-devel + libXdamage-devel freetype-devel $(vopt_if wasi wasi-sdk) $(vopt_if alsa alsa-lib-devel) $(vopt_if dbus dbus-glib-devel) $(vopt_if pulseaudio pulseaudio-devel) $(vopt_if xscreensaver libXScrnSaver-devel) $(vopt_if sndio sndio-devel) $(vopt_if jack jack-devel)" -depends="nss>=3.72 nspr>=4.32 desktop-file-utils hicolor-icon-theme" +depends="nss>=3.72 nspr>=4.32 desktop-file-utils hicolor-icon-theme pciutils" conflicts="firefox-esr>=0" -build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland lto pgo clang" -build_options_default="alsa jack dbus pulseaudio xscreensaver sndio wayland clang" +build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland lto pgo clang wasi" +build_options_default="alsa jack dbus pulseaudio xscreensaver sndio wayland clang wasi" desc_option_lto="Enable Link Time Optimization" desc_option_pgo="Enable Profile-guided Optimization" desc_option_clang="Build with clang" +desc_option_wasi="Build wasm sandboxed libraries" case $XBPS_TARGET_MACHINE in armv[56]*) broken="required NEON extensions are not supported on armv6" ;; @@ -42,6 +44,10 @@ case $XBPS_TARGET_MACHINE in ppc*) broken="xptcall bitrot" ;; esac +if [ "$CROSS_BUILD" -a "$build_option_pgo" ]; then + broken="pgo can't be enabled for cross-compilation" +fi + # we need this because cargo verifies checksums of all files in vendor # crates when it builds and gives us no way to override or update the # file sanely... so just clear out the file list @@ -66,52 +72,6 @@ post_patch() { } do_build() { - if [ "$build_option_clang" ]; then - export CC=clang - export CXX=clang++ - - if [ "$CROSS_BUILD" ]; then - mkdir -p wrapper - - local gcc_version=$(gcc -dumpversion) - local clang_version=$(clang -dumpversion) - - cat <<-! >"wrapper/${XBPS_TARGET_MACHINE}-clang" - #!/bin/sh - exec clang \ - --target="${XBPS_CROSS_TRIPLET}" \ - --sysroot="${XBPS_CROSS_BASE}" \ - --gcc-toolchain=/usr \ - -isystem "${XBPS_CROSS_BASE}/usr/include" \ - "\$@" - ! - - cat <<-! >"wrapper/${XBPS_TARGET_MACHINE}-clang++" - #!/bin/sh - exec clang++ \ - --target="${XBPS_CROSS_TRIPLET}" \ - --sysroot="${XBPS_CROSS_BASE}" \ - --gcc-toolchain=/usr \ - -isystem "${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}" \ - -isystem "${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}" \ - -isystem "${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward" \ - -isystem "${XBPS_CROSS_BASE}/usr/include" \ - "\$@" - ! - - chmod +x wrapper/* - - export PATH="${wrksrc}/wrapper:$PATH" - export CC=${XBPS_TARGET_MACHINE}-clang - export CXX=${XBPS_TARGET_MACHINE}-clang++ - fi - - export AR=llvm-ar - export NM=llvm-nm - export HOST_CC=clang - export HOST_CXX=clang++ - fi - export AS="${CC}" export CFLAGS="-O2" export CXXFLAGS="-O2" @@ -120,6 +80,15 @@ do_build() { export LDFLAGS="-Wl,-rpath=/usr/lib/firefox" # export LDFLAGS+="-Wl,--threads=${XBPS_MAKEJOBS}" + if [ "$build_option_clang" ]; then + export CC=clang + export CXX=clang++ + export AR=llvm-ar + export NM=llvm-nm + export HOST_CC=clang + export HOST_CXX=clang++ + fi + disable_jemalloc() { if [ "$XBPS_TARGET_LIBC" = "musl" ]; then echo "ac_add_options --disable-jemalloc" @@ -153,6 +122,14 @@ do_build() { fi } + disable_wasi() { + if [ "$build_option_wasi" ]; then + echo "ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot" + else + echo "ac_add_options --without-wasm-sandboxed-libraries" + fi + } + cat <<-! >.mozconfig ac_add_options --prefix=/usr ac_add_options --libdir=/usr/lib @@ -178,9 +155,7 @@ do_build() { $(disable_elfhack) $(disable_webrtc) - # XXX: wasi currently not ready - # ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot - ac_add_options --without-wasm-sandboxed-libraries + $(disable_wasi) ac_add_options --with-mozilla-api-keyfile="${wrksrc}/mozilla-api-key" @@ -208,6 +183,8 @@ do_build() { ac_add_options $(vopt_enable sndio) ac_add_options --enable-default-toolkit=$(vopt_if wayland 'cairo-gtk3-wayland' 'cairo-gtk3') + mk_add_options MOZ_OBJDIR="${wrksrc}/obj" + MOZ_APP_REMOTINGNAME=Firefox ! @@ -235,16 +212,16 @@ do_build() { ./mach build ./mach package - LLVM_PROFDATA=llvm-profdata JARLOG_FILE="$PWD/jarlog" \ - dbus-run-session \ + LLVM_PROFDATA=llvm-profdata \ + JARLOG_FILE="$PWD/jarlog" \ + GDK_BACKEND=x11 \ + LD_LIBRARY_PATH="$PWD/obj/dist/firefox" \ + XDG_RUNTIME_DIR="$(mktemp -d "${wrksrc}/pgo-runtime-XXXXXX")" \ + MOZ_ENABLE_WAYLAND=0 \ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ - ./mach python build/pgo/profileserver.py + dbus-run-session -- ./mach python build/pgo/profileserver.py - - stat -c "Profile data found (%s bytes)" merged.profdata test -s merged.profdata - - stat -c "Jar log found (%s bytes)" jarlog test -s jarlog ./mach clobber objdir