165 lines
6.5 KiB
Plaintext
165 lines
6.5 KiB
Plaintext
# Description: The Mozilla Firefox browser with Alsa support
|
|
# URL: https://www.mozilla.com/firefox/
|
|
# Maintainer: Danny Rawlins, crux at romster dot me
|
|
# Depends on: alsa-lib autoconf-2.13 brotli cbindgen dav1d dbus-glib ffmpeg graphite2 libaom libdav1d libevent libnotify libvpx libwebp libxkbcommon lld nodejs pulseaudio nss unzip wasi-libc++ xorg-libxcomposite xorg-libxcursor xorg-libxinerama xorg-libxt zip
|
|
# Optional: sccache jack pipewire
|
|
|
|
name=firefox
|
|
version=105.0.1
|
|
release=1
|
|
source=(https://archive.mozilla.org/pub/firefox/releases/$version/source/$name-$version.source.tar.xz
|
|
firefox.desktop
|
|
node-stdout-nonblocking-wrapper
|
|
0001-Don-t-use-build-id.patch
|
|
0002-Fortify-sources-properly.patch
|
|
0003-Check-additional-plugins-dir.patch
|
|
0004-bmo-847568-Support-system-harfbuzz.patch
|
|
0005-bmo-847568-Support-system-graphite2.patch
|
|
0006-bmo-1559213-Support-system-av1.patch
|
|
0007-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch
|
|
0008-bmo-1516803-Fix-building-sandbox.patch
|
|
0009-musl-Add-alternate-name-for-private-siginfo-struct-m.patch
|
|
0010-musl-Fix-syscall-wrappers.patch
|
|
0011-musl-Only-use-system-heap-reporter-with-glibc.patch
|
|
0012-musl-Set-pthread-name-for-non-glibc-systems.patch
|
|
0013-musl-getcontext-is-only-avaliable-on-glibc-systems.patch
|
|
0014-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch
|
|
0015-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch
|
|
0016-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch
|
|
0017-Make-PGO-use-toolchain.patch
|
|
0018-bmo-1516081-Disable-watchdog-during-PGO-builds.patch
|
|
0019-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch
|
|
0020-Fix-building-with-PGO-when-using-GCC.patch
|
|
0021-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch
|
|
0022-build-Disable-Werror.patch
|
|
0023-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch
|
|
0024-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch
|
|
0025-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch
|
|
0026-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch
|
|
0027-bgo-816975-fix-build-on-x86.patch
|
|
0028-bmo-1559213-fix-system-av1-libs.patch
|
|
0029-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch
|
|
0030-bmo-1754469-memory_mozalloc_throw.patch
|
|
0031-bmo-1769631-python-3.11-compatibility.patch
|
|
0033-rhbz-2115253-vaapi-fixes.patch
|
|
0034-bgo-860033-firefox-wayland-no-dbus.patch
|
|
libwebrtc-screen-cast-sync-1.patch
|
|
no-ccache-stats.patch)
|
|
|
|
_clear_vendor_checksums() {
|
|
sed -i 's/\("files":{\)[^}]*/\1/' third_party/rust/$1/.cargo-checksum.json
|
|
}
|
|
|
|
build() {
|
|
cd $name-$version
|
|
|
|
for p in $SRC/*.patch; do
|
|
patch -p1 -i $p
|
|
done
|
|
|
|
if [ "$(/usr/bin/python3 -c "import sys; print(sys.stdout.encoding)")" != 'utf-8' ]; then
|
|
printf "\e[031mError: set an UTF-8 locale to compile this!\033[0m\n"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -e '/usr/bin/ccache' ]; then
|
|
export OS_CCACHE_COMPILERCHECK="$(/usr/bin/clang -dumpversion | sed -z 's/\n/ /g'; crux | cut -d' ' -f3)"
|
|
export CCACHE_COMPILERCHECK="string:$OS_CCACHE_COMPILERCHECK"
|
|
PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')
|
|
fi
|
|
|
|
prt-get isinst sccache && export RUSTC_WRAPPER='/usr/bin/sccache'
|
|
mkdir "$PKGMK_SOURCE_DIR/rust" || true
|
|
export CARGO_HOME="$PKGMK_SOURCE_DIR/rust"
|
|
|
|
cat <<- EOF > .mozconfig
|
|
export NODEJS="$SRC/node-stdout-nonblocking-wrapper"
|
|
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-shared
|
|
unset MOZ_TELEMETRY_REPORTING
|
|
ac_add_options --prefix=/usr
|
|
ac_add_options --enable-application=browser
|
|
ac_add_options --with-system-harfbuzz
|
|
#ac_add_options --with-system-graphite2
|
|
ac_add_options --with-system-av1
|
|
ac_add_options --with-system-jpeg
|
|
ac_add_options --with-system-zlib
|
|
ac_add_options --with-system-png
|
|
ac_add_options --with-system-nspr
|
|
ac_add_options --with-system-nss
|
|
ac_add_options --with-system-libevent
|
|
ac_add_options --with-system-libvpx
|
|
ac_add_options --with-system-webp
|
|
ac_add_options --with-wasi-sysroot=/usr/share/wasi-sysroot
|
|
ac_add_options --enable-av1
|
|
ac_add_options --enable-system-ffi
|
|
ac_add_options --enable-system-pixman
|
|
ac_add_options --enable-optimize
|
|
ac_add_options --enable-release
|
|
ac_add_options --enable-rust-simd
|
|
ac_add_options --enable-sandbox
|
|
ac_add_options --disable-debug-symbols
|
|
ac_add_options --enable-official-branding
|
|
ac_add_options --with-distribution-id=nu.crux
|
|
ac_add_options --enable-linker=lld
|
|
ac_add_options --enable-lto=thin
|
|
ac_add_options --disable-tests
|
|
ac_add_options --disable-debug-symbols
|
|
ac_add_options --disable-updater
|
|
ac_add_options --disable-crashreporter
|
|
ac_add_options --disable-necko-wifi
|
|
ac_add_options --disable-parental-controls
|
|
ac_add_options --disable-elf-hack
|
|
EOF
|
|
|
|
# audio
|
|
prt-get isinst alsa-lib && echo 'ac_add_options --enable-alsa' >> .mozconfig
|
|
prt-get isinst jack && echo 'ac_add_options --enable-jack' >> .mozconfig
|
|
prt-get isinst pulseaudio && echo 'ac_add_options --enable-pulseaudio' >> .mozconfig
|
|
|
|
prt-get isinst wayland-protocols && \
|
|
echo 'ac_add_options --enable-default-toolkit=cairo-gtk3-wayland' >> .mozconfig || \
|
|
echo 'ac_add_options --enable-default-toolkit=cairo-gtk3' >> .mozconfig
|
|
|
|
[[ -e '/usr/bin/ccache' ]] && echo 'ac_add_options --enable-ccache' >> .mozconfig
|
|
|
|
export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib RUSTFLAGS="-C opt-level=2 $RUSTFLAGS"
|
|
export MOZ_MAKE_FLAGS="-j ${JOBS-1}" LDFLAGS+=" -Wl,--thinlto-jobs=$((JOBS / 2))"
|
|
export MOZBUILD_STATE_PATH="$SRC"/mozbuild
|
|
|
|
# Disable notification when build system has finished
|
|
export MOZ_NOSPAM=1
|
|
|
|
# Use system's Python environment
|
|
export PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS=mach
|
|
#export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
|
|
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=pip
|
|
mkdir $SRC/bin
|
|
ln -s /usr/bin/pip3 $SRC/bin/pip
|
|
ln -s /usr/bin/python3 $SRC/bin/python
|
|
export PATH="$SRC/bin:$PATH"
|
|
|
|
# Show flags set at the beginning
|
|
echo "Current BINDGEN_CFLAGS:\t${BINDGEN_CFLAGS:-no value set}"
|
|
echo "Current CFLAGS:\t\t${CFLAGS:-no value set}"
|
|
echo "Current CXXFLAGS:\t\t${CXXFLAGS:-no value set}"
|
|
echo "Current LDFLAGS:\t\t${LDFLAGS:-no value set}"
|
|
echo "Current RUSTFLAGS:\t\t${RUSTFLAGS:-no value set}"
|
|
|
|
# python/mach/mach/mixin/process.py fails to detect SHELL
|
|
export SHELL='/usr/bin/bash'
|
|
|
|
./mach build
|
|
#./mach build toolkit/library/rust
|
|
DESTDIR=$PKG ./mach install
|
|
|
|
install -d $PKG/usr/share/pixmaps
|
|
ln -s /usr/lib/firefox/browser/chrome/icons/default/default48.png $PKG/usr/share/pixmaps/firefox_default48.png
|
|
install -D -m 0644 $SRC/firefox.desktop $PKG/usr/share/applications/firefox.desktop
|
|
# Remove crap
|
|
rm -r $PKG/usr/lib/firefox/browser/features
|
|
rm $PKG/usr/lib/firefox/removed-files
|
|
|
|
install -d $PKG/etc/revdep.d
|
|
echo "/usr/lib/firefox" > $PKG/etc/revdep.d/firefox
|
|
}
|