void-packages/srcpkgs/firefox-esr/template

166 lines
5.3 KiB
Bash

# Template file for 'firefox-esr'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/firefox-esr-i18n".
#
pkgname=firefox-esr
version=60.6.1
revision=1
build_helper="rust"
wrksrc="firefox-${version}"
short_desc="Mozilla Firefox web browser - Extended Support Release (ESR)"
maintainer="Eivind Uggedal <eivind@uggedal.com>"
license="MPL-2.0, GPL-2.0-or-later, LGPL-2.1-or-later"
homepage="https://www.mozilla.org/firefox/organizations/"
distfiles="${MOZILLA_SITE}/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"
checksum=94037fdceb83785ef6748de196eae562d9fa83ab7ec858b07ed13c1f540a04f5
lib32disabled=yes
hostmakedepends="autoconf213 unzip zip pkg-config perl python yasm
cargo llvm clang rust cbindgen"
makedepends="nss-devel libjpeg-turbo-devel gtk+-devel gtk+3-devel icu-devel
pixman-devel sqlite-devel libevent-devel libnotify-devel libvpx5-devel
libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
libXdamage-devel $(vopt_if alsa alsa-lib-devel)
$(vopt_if dbus dbus-glib-devel) $(vopt_if pulseaudio pulseaudio-devel)
$(vopt_if startup_notification startup-notification-devel)
$(vopt_if xscreensaver libXScrnSaver-devel) $(vopt_if sndio sndio-devel)"
depends="nss>=3.37.3 desktop-file-utils hicolor-icon-theme"
conflicts="firefox>=0"
build_options="alsa dbus gtk3 pulseaudio startup_notification xscreensaver sndio"
build_options_default="alsa dbus gtk3 pulseaudio startup_notification xscreensaver sndio"
case $XBPS_TARGET_MACHINE in
armv6*)
broken="required NEON extensions are not supported on armv6"
;;
esac
post_extract() {
case "$XBPS_TARGET_MACHINE" in
*-musl)
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 --disable-gold" >>.mozconfig
echo "ac_add_options --enable-release" >>.mozconfig
;;
esac
case "$XBPS_TARGET_MACHINE" in
arm*|x86_64*|i686*)
echo "ac_add_options --disable-elf-hack" >>.mozconfig
;;
esac
if [ "$CROSS_BUILD" ]; then
BINDGEN_INCLUDE_FLAGS=$( $CPP -x c++ -v /dev/null -o /dev/null 2>&1 | \
sed -n '/#include <...> search starts here:/,/End of search list./p' | \
sed '1,1d;$d' | sed 's/^ /-I/' | paste -s )
export BINDGEN_CFLAGS="--target=$XBPS_CROSS_TRIPLET \
--sysroot=${XBPS_CROSS_BASE} ${BINDGEN_INCLUDE_FLAGS}"
export HOST_CC=cc
export TARGET_CC="${CC}"
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
case "$XBPS_TARGET_MACHINE" in
*-musl) _host_triplet=${XBPS_MACHINE%-musl}-unknown-linux-musl;;
*) _host_triplet=${XBPS_MACHINE}-unknwon-linux-gnu;;
esac
echo "ac_add_options --target=$XBPS_CROSS_TRIPLET" >>.mozconfig
echo "ac_add_options --host=$_host_triplet" >>.mozconfig
else
echo "ac_add_options --target=$XBPS_TRIPLET" >>.mozconfig
echo "ac_add_options --host=$XBPS_TRIPLET" >>.mozconfig
fi
mkdir -p third_party/rust/libloading/.deps
case "$XBPS_TARGET_MACHINE" in
i686*)
export CFLAGS+=" -D_FILE_OFFSET_BITS=64"
export CXXFLAGS+=" -D_FILE_OFFSET_BITS=64"
;;
armv7*)
export CFLAGS+=" -mfpu=neon -Wno-psabi"
export CXXFLAGS+=" -mfpu=neon -Wno-psabi"
;;
esac
case "$XBPS_MACHINE" in
i686*)
# ENOMEM
echo "ac_add_options --disable-debug-symbols" >>.mozconfig
;;
esac
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}"
export MOZ_NOSPAM=1
export MOZBUILD_STATE_PATH="${wrksrc}/mozbuild"
export AS=$CC
cat <<! >>.mozconfig
ac_add_options --with-google-location-service-api-keyfile="${wrksrc}/google-api-key"
ac_add_options --with-google-safebrowsing-api-keyfile="${wrksrc}/google-api-key"
ac_add_options --with-mozilla-api-keyfile="${wrksrc}/mozilla-api-key"
ac_add_options $(vopt_enable alsa)
ac_add_options $(vopt_enable sndio)
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 startup_notification startup-notification)
!
rm -f old-configure
./mach build
}
do_install() {
DESTDIR="$DESTDIR" ./mach install
vinstall ${FILESDIR}/vendor.js 644 usr/lib/firefox/browser/defaults/preferences
vinstall taskcluster/docker/firefox-snap/firefox.desktop 644 usr/share/applications
for i in 16x16 22x22 24x24 32x32 48x48 128x128 256x256; do
vinstall ${wrksrc}/browser/branding/official/default${i%x*}.png 644 \
usr/share/icons/hicolor/${i}/apps firefox.png
done
# 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
}