PKGBUILDs/extra/firefox/PKGBUILD
2017-09-22 23:08:09 +00:00

226 lines
8.1 KiB
Bash

# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Jakub Schmidtke <sjakub@gmail.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - mozconfig changes for ARM
# - patches to build on ARM
# - remove makedepend on cargo
# - use tarball source
buildarch=12
highmem=1
pkgname=firefox
pkgver=55.0.3
pkgrel=3
pkgdesc="Standalone web browser from mozilla.org"
arch=(i686 x86_64)
license=(MPL GPL LGPL)
url="https://www.mozilla.org/firefox/"
depends=(gtk3 gtk2 mozilla-common libxt startup-notification mime-types dbus-glib alsa-lib ffmpeg
nss hunspell sqlite ttf-font libpulse icu)
makedepends=(unzip zip diffutils python2 yasm mesa imake gconf inetutils xorg-server-xvfb
autoconf2.13 rust)
optdepends=('networkmanager: Location detection via available WiFi networks'
'libnotify: Notification integration'
'pulseaudio: Audio support'
'speech-dispatcher: Text-to-Speech')
options=(!emptydirs !makeflags !strip)
source=(https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$pkgver/source/firefox-$pkgver.source.tar.xz
$pkgname.desktop firefox-symbolic.svg
wifi-disentangle.patch wifi-fix-interface.patch
clip-ft-glyph.diff harmony-fix.diff
firefox-install-dir.patch no-crmf.diff glibc-2.26-fix.diff
rhbz-1354671.patch
https://src.fedoraproject.org/rpms/firefox/raw/master/f/build-cubeb-pulse-arm.patch)
sha256sums=('891836df85f8798c49f7b25661820f64d1311d59703c716eda471819b93ccda2'
'ada313750e6fb14558b37c764409a17c1672a351a46c73b350aa1fe4ea9220ef'
'a2474b32b9b2d7e0fb53a4c89715507ad1c194bef77713d798fa39d507def9e9'
'f068b84ad31556095145d8fefc012dd3d1458948533ed3fff6cbc7250b6e73ed'
'e98a3453d803cc7ddcb81a7dc83f883230dd8591bdf936fc5a868428979ed1f1'
'd5e5580a96ecc4a66ce12dde0737c1ed5cb31017a6ec488ffe372192ed893e1b'
'16bb776e9f3039321db747b2eaece0cda1320f3711fb853a68d67247b0aa065d'
'd86e41d87363656ee62e12543e2f5181aadcff448e406ef3218e91865ae775cd'
'fb85a538044c15471c12cf561d6aa74570f8de7b054a7063ef88ee1bdfc1ccbb'
'cd7ff441da66a287f8712e60cdc9e216c30355d521051e2eaae28a66d81915e8'
'22d5e5c07e759422027867121b24cdbcab8812670ca8e2e92825029f30eecbbd'
'434298ee0e91990967af03614c0d3232024e35dd38ca9f7dce52a8a7363e2382')
validpgpkeys=('2B90598A745E992F315E22C58AB132963A06537A')
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
# get your own set of keys. Feel free to contact foutrelis@archlinux.org for
# more information.
# - Arch Linux ARM has obtained permission to use the Arch Linux keys.
_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM
# Mozilla API keys (see https://location.services.mozilla.com/api)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
# get your own set of keys. Feel free to contact heftig@archlinux.org for
# more information.
_mozilla_api_key=16674381-f021-49de-8622-3021c5942aff
prepare() {
mkdir path
ln -s /usr/bin/python2 path/python
cd $pkgname-$pkgver
patch -Np1 -i ../firefox-install-dir.patch
# https://bugzilla.mozilla.org/show_bug.cgi?id=1371991
patch -Np1 -i ../no-crmf.diff
# https://bugzilla.mozilla.org/show_bug.cgi?id=1385667
# https://bugzilla.mozilla.org/show_bug.cgi?id=1394149
patch -Np1 -i ../glibc-2.26-fix.diff
# https://bugzilla.mozilla.org/show_bug.cgi?id=1314968
patch -Np1 -i ../wifi-disentangle.patch
patch -Np1 -i ../wifi-fix-interface.patch
# https://bugzilla.mozilla.org/show_bug.cgi?id=1393467
patch -Np1 -i ../clip-ft-glyph.diff
# https://bugzilla.mozilla.org/show_bug.cgi?id=1400721
patch -Np1 -i ../harmony-fix.diff
echo -n "$_google_api_key" >google-api-key
echo -n "$_mozilla_api_key" >mozilla-api-key
cat >.mozconfig <<END
ac_add_options --enable-application=browser
ac_add_options --prefix=/usr
ac_add_options --enable-release
#ac_add_options --enable-gold
#ac_add_options --enable-pie
# Branding
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=org.archlinux
export MOZILLA_OFFICIAL=1
export MOZ_TELEMETRY_REPORTING=1
export MOZ_ADDON_SIGNING=1
export MOZ_REQUIRE_SIGNING=1
# Keys
ac_add_options --with-google-api-keyfile=${PWD@Q}/google-api-key
ac_add_options --with-mozilla-api-keyfile=${PWD@Q}/mozilla-api-key
# ALARM
ac_add_options --disable-webrtc
# System libraries
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-icu
ac_add_options --with-system-zlib
ac_add_options --with-system-bz2
ac_add_options --enable-system-hunspell
ac_add_options --enable-system-sqlite
ac_add_options --enable-system-ffi
ac_add_options --enable-system-pixman
# Features
ac_add_options --enable-startup-notification
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
END
if [[ $CARCH == "armv7h" ]]; then
echo "ac_add_options --disable-elf-hack" >> .mozconfig
echo 'ac_add_options --enable-optimize="-g -O2 -fno-schedule-insns"' >> .mozconfig
elif [[ $CARCH == "aarch64" ]]; then
echo 'ac_add_options --enable-optimize="-O2"' >> .mozconfig
patch -p1 -i ../rhbz-1354671.patch
fi
patch -p1 -i ../build-cubeb-pulse-arm.patch
}
build() {
cd $pkgname-$pkgver
# _FORTIFY_SOURCE causes configure failures
CPPFLAGS+=" -O2"
export PATH="$srcdir/path:$PATH"
export MOZ_SOURCE_REPO="$_repo"
# Do PGO
#xvfb-run -a -n 95 -s "-extension GLX -screen 0 1280x1024x24" \
# MOZ_PGO=1 ./mach build
./mach build
./mach buildsymbols
}
package() {
cd $pkgname-$pkgver
DESTDIR="$pkgdir" ./mach install
find . -name '*crashreporter-symbols.zip' -exec cp -fvt "$startdir" {} +
_vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
install -Dm644 /dev/stdin "$_vendorjs" <<END
// Use LANG environment variable to choose locale
pref("intl.locale.matchOS", true);
// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);
// Don't disable our bundled extensions in the application directory
pref("extensions.autoDisableScopes", 11);
pref("extensions.shownSelectionUI", true);
// Opt all of us into e10s, instead of just 50%
pref("browser.tabs.remote.autostart", true);
END
_distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
install -Dm644 /dev/stdin "$_distini" <<END
[Global]
id=archlinux
version=1.0
about=Mozilla Firefox for Arch Linux
[Preferences]
app.distributor=archlinux
app.distributor.channel=$pkgname
app.partner.archlinux=archlinux
END
for i in 16 22 24 32 48 256; do
install -Dm644 browser/branding/official/default$i.png \
"$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
done
install -Dm644 browser/branding/official/content/icon64.png \
"$pkgdir/usr/share/icons/hicolor/64x64/apps/$pkgname.png"
install -Dm644 browser/branding/official/mozicon128.png \
"$pkgdir/usr/share/icons/hicolor/128x128/apps/$pkgname.png"
install -Dm644 browser/branding/official/content/about-logo.png \
"$pkgdir/usr/share/icons/hicolor/192x192/apps/$pkgname.png"
install -Dm644 browser/branding/official/content/about-logo@2x.png \
"$pkgdir/usr/share/icons/hicolor/384x384/apps/$pkgname.png"
install -Dm644 ../firefox-symbolic.svg \
"$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"
install -Dm644 ../$pkgname.desktop \
"$pkgdir/usr/share/applications/$pkgname.desktop"
# Use system-provided dictionaries
rm -r "$pkgdir"/usr/lib/$pkgname/dictionaries
ln -Ts /usr/share/hunspell "$pkgdir/usr/lib/$pkgname/dictionaries"
ln -Ts /usr/share/hyphen "$pkgdir/usr/lib/$pkgname/hyphenation"
# Install a wrapper to avoid confusion about binary path
install -Dm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
#!/bin/sh
exec /usr/lib/$pkgname/firefox "\$@"
END
# Replace duplicate binary with wrapper
# https://bugzilla.mozilla.org/show_bug.cgi?id=658850
ln -srf "$pkgdir/usr/bin/$pkgname" \
"$pkgdir/usr/lib/$pkgname/firefox-bin"
}