This commit is contained in:
Luca Bilke 2024-10-31 11:12:50 +01:00
parent 0be4c0f88e
commit a63172e653
Signed by: luca
GPG Key ID: F6E11C9BAA7C82F5
1 changed files with 97 additions and 101 deletions

View File

@ -7,8 +7,8 @@ revision=1
archs="x86_64*"
build_helper="rust"
hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust
cargo llvm18 clang18 lld18 nodejs cbindgen nasm which tar
$(vopt_if pgo_xvfb xorg-server-xvfb)"
cargo llvm18 clang18 lld18 nodejs cbindgen nasm which tar"
# $(vopt_if pgo_xvfb xorg-server-xvfb)
makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel icu-devel
pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel
libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
@ -22,17 +22,16 @@ maintainer="Luca Bilke <luca@bil.ke>"
license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later, MIT"
homepage="https://floorp.app/"
distfiles="https://github.com/floorp-Projects/${pkgname}/archive/v${version}.tar.gz
https://github.com/Floorp-Projects/Floorp-core/archive/${_core_commit}.tar.gz
https://github.com/Floorp-Projects/Unified-l10n-central/archive/${_l10n_commit}.tar.gz
"
https://github.com/Floorp-Projects/Floorp-core/archive/${_core_commit}.tar.gz
https://github.com/Floorp-Projects/Unified-l10n-central/archive/${_l10n_commit}.tar.gz"
checksum="de6ab7535f359d084bdedd1f6ee9a6689b35166e0f0100ad1d0a2fcaf0522b84
6837ea84b0cafd89b664e49a5eb9e377013139b5edfc68f3a101c7e9dea5ef39
5fa247cf526045f26c8af80a362f55dcc4731da0ff03dd937a5b47064894b064"
lib32disabled=yes
build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland lto clang pgo_xvfb"
build_options_default="alsa jack dbus pulseaudio xscreensaver sndio lto clang pgo_xvfb"
build_options="alsa jack dbus pulseaudio xscreensaver sndio wayland clang lto" # pgo_xvfb
build_options_default="alsa jack dbus pulseaudio xscreensaver sndio clang lto" # pgo_xvfb
case $XBPS_TARGET_MACHINE in
armv[56]*) broken="required NEON extensions are not supported on armv6" ;;
@ -106,11 +105,9 @@ do_build() {
export AS="${CC}"
export CFLAGS="-O3"
export CXXFLAGS="-O3"
export OPT_LEVEL="3"
export RUSTC_OPT_LEVEL="3"
export HOST_CFLAGS=""
export HOST_CXXFLAGS=""
export LDFLAGS="-Wl,-rpath=/usr/lib/firefox"
export LDFLAGS="-Wl,-rpath=/usr/lib/floorp"
# export LDFLAGS+="-Wl,--threads=${XBPS_MAKEJOBS}"
disable_jemalloc() {
@ -153,47 +150,15 @@ do_build() {
ac_add_options --prefix=/usr
ac_add_options --libdir=/usr/lib
ac_add_options --host=${XBPS_TRIPLET}
ac_add_options --target=${XBPS_CROSS_TRIPLET:-${XBPS_TRIPLET}}
ac_add_options --enable-linker=$(vopt_if clang lld bfd)
$(vopt_if lto 'ac_add_options --enable-lto=cross,full')
$(vopt_if clang 'ac_add_options --with-libclang-path=/usr/lib')
ac_add_options --enable-release
ac_add_options --enable-hardening
ac_add_options --enable-rust-simd
ac_add_options --enable-wasm-simd
ac_add_options --enable-optimize="\${CFLAGS}"
ac_add_options --enable-path-remapping=c,rust
# Debugging
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-debug-js-modules
ac_add_options --enable-strip
ac_add_options --enable-install-strip
export STRIP_FLAGS="--strip-debug --strip-unneeded"
# Features
ac_add_options --disable-tests
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-default-browser-agent
ac_add_options --disable-parental-controls
$(disable_jemalloc)
ac_add_options --enable-linker=$(vopt_if clang lld bfd)
$(disable_elfhack)
$(disable_webrtc)
ac_add_options $(vopt_enable dbus)
ac_add_options $(vopt_enable dbus necko-wifi)
ac_add_options --disable-audio-backends
ac_add_options $(vopt_enable alsa)
ac_add_options $(vopt_enable jack)
ac_add_options $(vopt_enable pulseaudio)
ac_add_options $(vopt_enable sndio)
ac_add_options --enable-av1
ac_add_options --enable-eme=widevine
ac_add_options --enable-jxl
ac_add_options --enable-raw
ac_add_options --enable-sandbox
ac_add_options --disable-bootstrap
# XXX: wasi currently not ready
# ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
# Branding
ac_add_options --with-app-basename=$pkgname
@ -202,20 +167,21 @@ do_build() {
ac_add_options --enable-update-channel=release
ac_add_options --with-unsigned-addon-scopes=app,system
ac_add_options --allow-addon-sideload
export MOZILLA_OFFICIAL=1
export MOZ_APP_REMOTINGNAME=${pkgname}
# Floorp Upstream
ac_add_options --enable-proxy-bypass-protection
ac_add_options --enable-unverified-updates
ac_add_options --with-l10n-base="${wrksrc}/floorp/browser/locales/l10n-central"
MOZ_REQUIRE_SIGNING=
# API Keys
# Keys
ac_add_options --with-mozilla-api-keyfile="${wrksrc}/floorp/apis/api-mozilla-key"
ac_add_options --with-google-location-service-api-keyfile="${wrksrc}/floorp/apis/api-google-location-service-key"
ac_add_options --with-google-safebrowsing-api-keyfile="${wrksrc}/floorp/apis/api-google-safe-browsing-key"
# System libraries
# XXX: wasi currently not ready
# ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
ac_add_options --without-wasm-sandboxed-libraries
ac_add_options --enable-system-pixman
ac_add_options --with-system-ffi
@ -230,70 +196,100 @@ do_build() {
# XXX: the system's libpng doesn't have APNG support
ac_add_options --without-system-png
ac_add_options --enable-default-toolkit=$(vopt_if wayland 'cairo-gtk3-wayland' 'cairo-gtk3')
# Features
ac_add_options $(vopt_enable dbus)
ac_add_options $(vopt_enable dbus necko-wifi)
ac_add_options --disable-audio-backends
ac_add_options $(vopt_enable sndio)
ac_add_options $(vopt_enable alsa)
ac_add_options --enable-av1
ac_add_options --enable-eme=widevine
ac_add_options $(vopt_enable jack)
ac_add_options --enable-jxl
ac_add_options $(vopt_enable pulseaudio)
ac_add_options --enable-raw
ac_add_options --enable-sandbox
ac_add_options --enable-webrtc
ac_add_options --disable-crashreporter
ac_add_options --disable-default-browser-agent
ac_add_options --disable-parental-controls
ac_add_options --disable-tests
ac_add_options --disable-updater
$(disable_webrtc)
$(disable_jemalloc)
# work around large debug symbols on 32-bit hosts
if [ "$XBPS_WORDSIZE" = "32" ]; then
echo "ac_add_options --disable-debug-symbols" >>.mozconfig
echo "ac_add_options --disable-debug" >>.mozconfig
export LDFLAGS+=" -Wl,--no-keep-memory"
fi
# Disable telemetry by default
mk_add_options MOZ_DATA_REPORTING=0
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
mk_add_options MOZ_TELEMETRY_REPORTING=0
# Debugging
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-debug-js-modules
ac_add_options --enable-strip
ac_add_options --enable-install-strip
export STRIP_FLAGS="--strip-debug --strip-unneeded"
# Optimization
ac_add_options --enable-optimize="\${CFLAGS}"
$(vopt_if lto 'ac_add_options --enable-lto=cross,full')
ac_add_options OPT_LEVEL="3"
ac_add_options RUSTC_OPT_LEVEL="3"
# Other
$(vopt_if clang 'ac_add_options --with-libclang-path=/usr/lib')
ac_add_options --enable-path-remapping=c,rust
ac_add_options --enable-default-toolkit=$(vopt_if wayland 'cairo-gtk3-wayland' 'cairo-gtk3')
if [ "$SOURCE_DATE_EPOCH" ]; then
export MOZ_BUILD_DATE=$(date --date "@$SOURCE_DATE_EPOCH" "+%Y%m%d%H%M%S")
fi
export MOZILLA_OFFICIAL=1
export MOZ_APP_REMOTINGNAME=${pkgname}
MOZ_REQUIRE_SIGNING=
mk_add_options MOZ_DATA_REPORTING=0
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
mk_add_options MOZ_TELEMETRY_REPORTING=0
EOF
if [ "$build_option_pgo_xvfb" ]; then
# LTO/PGO needs more open files
ulimit -n 4096
cat ../mozconfig - <<-EOF >.mozconfig
ac_add_options --enable-profile-generate=cross
export MOZ_ENABLE_FULL_SYMBOLS=1
EOF
./mach build
./mach package
LLVM_PROFDATA=llvm-profdata JARLOG_FILE=${wrksrc}/jarlog \
xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
-- ./mach python build/pgo/profileserver.py
./mach clobber
cat ../mozconfig >.mozconfig
if [ -s merged.profdata ]; then
cat <<-EOF >>.mozconfig
ac_add_options --enable-profile-use=cross
ac_add_options --with-pgo-profile-path=${wrksrc}/merged.profdata
EOF
fi
if [ -s jarlog ]; then
cat <<-EOF >>.mozconfig
ac_add_options --with-pgo-jarlog=${wrksrc}/jarlog
EOF
fi
./mach build
fi
export MOZ_MAKE_FLAGS="${makejobs}"
export MOZ_NOSPAM=1
export MOZBUILD_STATE_PATH="${wrksrc}/mozbuild"
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
rm -f old-configure
./mach build
# LTO/PGO needs more open files
ulimit -n 4096
# if [ "$build_option_pgo_xvfb" ]; then
# cat ../mozconfig - <<-EOF >.mozconfig
# ac_add_options --enable-profile-generate=cross
# export MOZ_ENABLE_FULL_SYMBOLS=1
# EOF
# ./mach build
#
# ./mach package
#
# LLVM_PROFDATA=llvm-profdata JARLOG_FILE=${wrksrc}/jarlog \
# xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \
# -- ./mach python build/pgo/profileserver.py
#
# ./mach clobber
#
# cat ../mozconfig >.mozconfig
#
# if [ -s merged.profdata ]; then
# cat <<-EOF >>.mozconfig
# ac_add_options --enable-profile-use=cross
# ac_add_options --with-pgo-profile-path=${wrksrc}/merged.profdata
# EOF
# fi
#
# if [ -s jarlog ]; then
# cat <<-EOF >>.mozconfig
# ac_add_options --with-pgo-jarlog=${wrksrc}/jarlog
# EOF
# fi
#
# ./mach build
# else
cat > .mozconfig ../mozconfig
./mach build
# fi
}
do_install() {