11# Template file for 'librewolf'
22pkgname=librewolf
3- version=134.0.2
3+ version=135.0
44revision=1
55_rev=1
66wrksrc=${pkgname}-${version}-${_rev}
@@ -10,33 +10,42 @@ maintainer="index <index@mailbox.org>"
1010license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later"
1111homepage="https://librewolf.net/"
1212distfiles="https://gitlab.com/api/v4/projects/32320088/packages/generic/librewolf-source/${version}-${_rev}/${pkgname}-${version}-${_rev}.source.tar.gz"
13- checksum=146c61a725a849a6b0ffb8d85b3cea6b925bc5b21847c65b8ed5ae70e4ea8025
13+ checksum=d195ed879a969271d0afe2d63c08805ae6e0e16af2a80841475b1d97accd331f
1414
1515lib32disabled=yes
1616
1717_llvmver=19
18- hostmakedepends="autoconf213 unzip zip pkg-config perl python yasm rust
19- cargo llvm${_llvmver} clang${_llvmver} lld${_llvmver} nodejs cbindgen nasm which tar"
18+ hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust
19+ cargo llvm${_llvmver} clang${_llvmver} lld${_llvmver} nodejs cbindgen nasm which
20+ tar xz $(vopt_if pgo 'xvfb-run dbus mesa-dri vulkan-loader pciutils')
21+ $(vopt_if wasi wasi-sdk)"
2022makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel
2123 pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel
2224 libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
23- libXdamage-devel freetype-devel zlib-devel
25+ libXdamage-devel freetype-devel $(vopt_if wasi wasi-sdk)
2426 $(vopt_if alsa alsa-lib-devel) $(vopt_if dbus dbus-glib-devel)
2527 $(vopt_if pulseaudio pulseaudio-devel) $(vopt_if xscreensaver libXScrnSaver-devel)
2628 $(vopt_if sndio sndio-devel) $(vopt_if jack jack-devel)"
27- depends="nss>=3.72 nspr>=4.32 desktop-file-utils hicolor-icon-theme"
29+ depends="nss>=3.72 nspr>=4.32 desktop-file-utils hicolor-icon-theme pciutils "
2830
29- build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland lto"
30- build_options_default="alsa jack dbus pulseaudio xscreensaver sndio wayland"
31+ build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland lto pgo clang wasi "
32+ build_options_default="alsa jack dbus pulseaudio xscreensaver sndio wayland clang wasi "
3133
3234desc_option_lto="Enable Link Time Optimization"
35+ desc_option_pgo="Enable Profile-guided Optimization"
36+ desc_option_clang="Build with clang"
37+ desc_option_wasi="Build wasm sandboxed libraries"
3338
3439case $XBPS_TARGET_MACHINE in
3540 armv[56]*) broken="required NEON extensions are not supported on armv6" ;;
3641 ppc64*) ;;
3742 ppc*) broken="xptcall bitrot" ;;
3843esac
3944
45+ if [ "$CROSS_BUILD" -a "$build_option_pgo" ]; then
46+ broken="pgo can't be enabled for cross-compilation"
47+ fi
48+
4049# we need this because cargo verifies checksums of all files in vendor
4150# crates when it builds and gives us no way to override or update the
4251# file sanely... so just clear out the file list
@@ -61,57 +70,23 @@ post_patch() {
6170}
6271
6372do_build() {
64- export CC=clang
65- export CXX=clang++
66-
67- if [ "$CROSS_BUILD" ]; then
68- mkdir -p wrapper
69-
70- local gcc_version=$(gcc -dumpversion)
71- local clang_version=$(clang -dumpversion)
72-
73- cat <<-! >"wrapper/${XBPS_TARGET_MACHINE}-clang"
74- #!/bin/sh
75- exec clang \
76- --target="${XBPS_CROSS_TRIPLET}" \
77- --sysroot="${XBPS_CROSS_BASE}" \
78- --gcc-toolchain=/usr \
79- -isystem "${XBPS_CROSS_BASE}/usr/include" \
80- "\$@"
81- !
82-
83- cat <<-! >"wrapper/${XBPS_TARGET_MACHINE}-clang++"
84- #!/bin/sh
85- exec clang++ \
86- --target="${XBPS_CROSS_TRIPLET}" \
87- --sysroot="${XBPS_CROSS_BASE}" \
88- --gcc-toolchain=/usr \
89- -isystem "${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}" \
90- -isystem "${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}" \
91- -isystem "${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward" \
92- -isystem "${XBPS_CROSS_BASE}/usr/include" \
93- "\$@"
94- !
95-
96- chmod +x wrapper/*
97-
98- export PATH="${wrksrc}/wrapper:$PATH"
99- export CC=${XBPS_TARGET_MACHINE}-clang
100- export CXX=${XBPS_TARGET_MACHINE}-clang++
101- fi
102-
103- export AR=llvm-ar
104- export NM=llvm-nm
10573 export AS="${CC}"
10674 export CFLAGS="-O2"
10775 export CXXFLAGS="-O2"
108- export HOST_CC=clang
109- export HOST_CXX=clang++
11076 export HOST_CFLAGS=""
11177 export HOST_CXXFLAGS=""
11278 export LDFLAGS="-Wl,-rpath=/usr/lib/librewolf"
11379 # export LDFLAGS+="-Wl,--threads=${XBPS_MAKEJOBS}"
11480
81+ if [ "$build_option_clang" ]; then
82+ export CC=clang
83+ export CXX=clang++
84+ export AR=llvm-ar
85+ export NM=llvm-nm
86+ export HOST_CC=clang
87+ export HOST_CXX=clang++
88+ fi
89+
11590 disable_jemalloc() {
11691 if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
11792 echo "ac_add_options --disable-jemalloc"
@@ -145,14 +120,23 @@ do_build() {
145120 fi
146121 }
147122
123+ disable_wasi() {
124+ if [ "$build_option_wasi" ]; then
125+ echo "ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot"
126+ else
127+ echo "ac_add_options --without-wasm-sandboxed-libraries"
128+ fi
129+ }
130+
148131 cat <<-! >mozconfig
149132 ac_add_options --prefix=/usr
150133 ac_add_options --libdir=/usr/lib
151134 ac_add_options --host=${XBPS_TRIPLET}
152135 ac_add_options --target=${XBPS_CROSS_TRIPLET:-${XBPS_TRIPLET}}
153- ac_add_options --enable-linker=lld
136+ ac_add_options --enable-linker=$(vopt_if clang lld bfd)
154137 $(vopt_if lto 'ac_add_options --enable-lto=cross')
155- ac_add_options --with-libclang-path=/usr/lib
138+ $(vopt_if clang 'ac_add_options --with-libclang-path=/usr/lib')
139+
156140 ac_add_options --enable-application=browser
157141 ac_add_options --enable-release
158142 ac_add_options --enable-hardening
@@ -167,10 +151,7 @@ do_build() {
167151 $(disable_jemalloc)
168152 $(disable_elfhack)
169153 $(disable_webrtc)
170-
171- # XXX: wasi currently not ready
172- # ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
173- ac_add_options --without-wasm-sandboxed-libraries
154+ $(disable_wasi)
174155 ac_add_options --with-mozilla-api-keyfile="${wrksrc}/mozilla-api-key"
175156 ac_add_options --enable-system-pixman
176157 ac_add_options --with-system-ffi
@@ -194,6 +175,8 @@ do_build() {
194175 ac_add_options $(vopt_enable sndio)
195176 ac_add_options --enable-default-toolkit=$(vopt_if wayland 'cairo-gtk3-wayland' 'cairo-gtk3')
196177
178+ mk_add_options MOZ_OBJDIR="${wrksrc}/obj"
179+
197180 # LibreWolf
198181 MOZ_APP_REMOTINGNAME=librewolf
199182 ac_add_options --disable-debug
@@ -217,9 +200,6 @@ do_build() {
217200 echo "ac_add_options --disable-debug-symbols" >>mozconfig
218201 echo "ac_add_options --disable-debug" >>mozconfig
219202 export LDFLAGS+=" -Wl,--no-keep-memory"
220- # patch the rust debug level, this is hardcoded
221- vsed -i 's/debug_info = "2"/debug_info = "0"/' \
222- build/moz.configure/toolchain.configure
223203 fi
224204
225205 if [ "$SOURCE_DATE_EPOCH" ]; then
@@ -232,6 +212,36 @@ do_build() {
232212 export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
233213
234214 rm -f old-configure
215+
216+ if [ "$build_option_pgo" ]; then
217+ cp mozconfig{,.orig}
218+ echo "ac_add_options --enable-profile-generate=cross" >> mozconfig
219+
220+ ./mach build
221+ ./mach package
222+ LLVM_PROFDATA=llvm-profdata \
223+ JARLOG_FILE="$PWD/jarlog" \
224+ GDK_BACKEND=x11 \
225+ LD_LIBRARY_PATH="$PWD/obj/dist/firefox" \
226+ XDG_RUNTIME_DIR="$(mktemp -d "${wrksrc}/pgo-runtime-XXXXXX")" \
227+ MOZ_ENABLE_WAYLAND=0 \
228+ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
229+ dbus-run-session -- ./mach python build/pgo/profileserver.py
230+
231+ test -s merged.profdata
232+ test -s jarlog
233+
234+ ./mach clobber objdir
235+
236+ cp mozconfig{.orig,}
237+ cat <<-! >>mozconfig
238+ ac_add_options --enable-lto=cross,full
239+ ac_add_options --enable-profile-use=cross
240+ ac_add_options --with-pgo-profile-path=${PWD@Q}/merged.profdata
241+ ac_add_options --with-pgo-jarlog=${PWD@Q}/jarlog
242+ !
243+ fi
244+
235245 ./mach build
236246}
237247
0 commit comments