void-packages/srcpkgs/firefox-esr/template

134 lines
4.8 KiB
Bash

# Template file for 'firefox-esr'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/firefox-esr-i18n".
#
pkgname=firefox-esr
version=52.9.0
revision=5
wrksrc="firefox-${version}esr"
short_desc="Mozilla Firefox web browser - Extended Support Release (ESR)"
maintainer="Eivind Uggedal <eivind@uggedal.com>"
homepage="https://www.mozilla.org/firefox/organizations/"
license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later"
distfiles="${MOZILLA_SITE}/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz
https://aur.archlinux.org/cgit/aur.git/plain/ffmpeg4.patch.gz?h=firefox-esr52>ffmpeg4.patch.gz"
checksum="c01d09658c53c1b3a496e353a24dad03b26b81d3b1d099abc26a06f81c199dd6
2a285e0c31968e3fe9b65a585838b46f9342ff0a369e786a729b4c3886617034"
lib32disabled=yes
hostmakedepends="autoconf213 unzip zip pkg-config perl python yasm
$(vopt_if rust cargo)"
makedepends="
libatomic-devel nss-devel gtk+-devel
sqlite-devel libevent-devel libnotify-devel libvpx-devel
hunspell-devel libXcomposite-devel libSM-devel libXt-devel
$(vopt_if alsa alsa-lib-devel) $(vopt_if dbus dbus-glib-devel)
$(vopt_if gtk3 gtk+3-devel) $(vopt_if pulseaudio pulseaudio-devel)
$(vopt_if startup_notification startup-notification-devel)
$(vopt_if xscreensaver libXScrnSaver-devel)"
depends="nss>=3.27 desktop-file-utils hicolor-icon-theme"
conflicts="firefox>=0"
build_options="alsa dbus gtk3 rust pulseaudio startup_notification xscreensaver"
build_options_default="alsa dbus gtk3 pulseaudio startup_notification xscreensaver"
desc_option_rust="Build rust components"
case "$XBPS_TARGET_MACHINE" in
i686|x86_64*) build_options_default+=" rust";;
esac
post_extract() {
patch -Np0 -i ../ffmpeg4.patch
case "$XBPS_TARGET_MACHINE" in
*-musl)
# fix musl rust triplet
sed -i "s/\(x86_64-unknown-linux\)-gnu/\1-musl/" build/moz.configure/rust.configure
cp "${FILESDIR}/stab.h" toolkit/crashreporter/google-breakpad/src/
;;
esac
# Google API key (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: This is for Void Linux use ONLY.
echo -n "AIzaSyCIFdBA7eQP43R6kXRwTq7j6Mvj1ITze90" > google-api-key
# Mozilla API keys (see https://location.services.mozilla.com/api)
# Note: This is for Void Linux use ONLY.
echo -n "cd894504-7a2a-4263-abff-ff73ee89ffca" > mozilla-api-key
}
do_build() {
cp "${FILESDIR}/mozconfig" "${wrksrc}/.mozconfig"
case "$XBPS_TARGET_MACHINE" in
*-musl)
echo "ac_add_options --disable-jemalloc" >>.mozconfig
echo "ac_add_options --enable-gold=no" >>.mozconfig
;;
arm*|aarch64*)
echo "ac_add_options --enable-gold=no" >>.mozconfig
;;
esac
if [ "$CROSS_BUILD" ]; then
export HOST_CFLAGS="${XBPS_CFLAGS}"
export HOST_CXXFLAGS="${XBPS_CXXFLAGS}"
export ac_cv_sqlite_secure_delete=yes \
ac_cv_sqlite_threadsafe=yes \
ac_cv_sqlite_enable_fts3=yes \
ac_cv_sqlite_dbstat_vtab=yes \
ac_cv_sqlite_enable_unlock_notify=yes \
ac_cv_prog_hostcxx_works=1
echo "ac_add_options --target=$XBPS_CROSS_TRIPLET" >>.mozconfig
fi
# Append CFLAGS and CXXFLAGS to set work around code which gcc6 would
# otherwise regard as out-of-specification and allow it to produce a
# working program.
export CFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
export CXXFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
export LDFLAGS+=" -Wl,-rpath=/usr/lib/firefox"
if [ "$SOURCE_DATE_EPOCH" ]; then
export MOZ_BUILD_DATE=$(date --date "@$SOURCE_DATE_EPOCH" "+%Y%m%d%H%M%S")
fi
export MOZ_MAKE_FLAGS="${makejobs}"
cat <<! >>.mozconfig
ac_add_options --with-google-api-keyfile="${wrksrc}/google-api-key"
ac_add_options --with-mozilla-api-keyfile="${wrksrc}/mozilla-api-key"
ac_add_options --enable-default-toolkit=cairo-gtk$(vopt_if gtk3 '3' '2')
ac_add_options $(vopt_enable alsa)
ac_add_options $(vopt_enable dbus)
ac_add_options $(vopt_enable dbus necko-wifi)
ac_add_options $(vopt_enable pulseaudio)
ac_add_options $(vopt_enable rust)
ac_add_options $(vopt_enable startup_notification startup-notification)
!
make -f client.mk build
}
do_install() {
make -f client.mk DESTDIR="$DESTDIR" install
vinstall ${FILESDIR}/vendor.js 644 usr/lib/firefox/browser/defaults/preferences
vinstall ${FILESDIR}/firefox.desktop 644 usr/share/applications
for i in 16x16 22x22 24x24 32x32 48x48 256x256; do
vinstall ${wrksrc}/browser/branding/official/default${i%x*}.png 644 \
usr/share/icons/hicolor/${i}/apps firefox.png
done
# Use system-provided dictionaries
rm -rf ${DESTDIR}/usr/lib/firefox/{dictionaries,hyphenation}
ln -s /usr/share/hunspell ${DESTDIR}/usr/lib/firefox/dictionaries
ln -s /usr/share/hyphen ${DESTDIR}/usr/lib/firefox/hyphenation
# We don't want the development stuff
rm -rf ${DESTDIR}/usr/{include,lib/firefox-devel,share/idl}
# https://bugzilla.mozilla.org/show_bug.cgi?id=658850
ln -sf firefox ${DESTDIR}/usr/lib/firefox/firefox-bin
}