# Maintainer: Isabell Cowan # Contributor: Thaodan # Contributor: Weng Xuetian # ------------------------ # # --- BUILD PARAMETERS --- # # ------------------------ # # enable this if you run out of memory during linking _lowmem=false # enable this to try to build with PGO (probably will fail to build) _pgo=false # enable this to try to use the system pixman (probably will fail at link time) _system_pixman=false # enable this to build with ccache _ccache=false # enable this to build for debug _debug=false # Use optimization flags (required if -D_FORTIFY_SOURCE is set and non-zero). # Warning, Firefox may crash if set to anything but -O2. _optimize="-O2" # Upstream name, version, and source URL _realname='firefox' _pkgver=57.0rc1 if [[ "$_pkgver" == ?*.?*rc?* ]]; then _mozreleasepath="candidates/${_pkgver%rc?*}-candidates/build${_pkgver#?*.?*rc}" _realver="${_pkgver%rc?*}" elif [[ "$_pkgver" == ?*.?*b?* ]]; then _mozreleasepath="releases/$_pkgver" _realver="$_pkgver" fi _mozffurl="http://archive.mozilla.org/pub/$_realname/$_mozreleasepath/source/$_realname-$_realver.source.tar.xz" # Debian Firefox trunk Debian source revision and URL (for Unity (global) menubar patch). _debianrev=2113 _debianurl="https://bazaar.launchpad.net/~mozillateam/$_realname/$_realname-trunk.head/tarball/$_debianrev" # openSUSE Firefox source revision and URL (for openSUSE patches). _opensuserev=65e317e42eff _opensusebaseurl="http://www.rosenauer.org/hg/mozilla/raw-file/$_opensuserev" # 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. _google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM _google_default_client_id=413772536636.apps.googleusercontent.com _google_default_client_secret=0ZChLK6AxeA3Isu96MkwqDR4 # 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 # Directory where things will be built if [[ "$CARCH" == 'i686' && "$CHOST" == i*86-*-linux-gnu ]]; then _builddir=obj-i686-pc-linux-gnu elif [[ "$CARCH" == 'x86_64' && "$CHOST" == x86_64-*-linux-gnu ]]; then _builddir=obj-x86_64-pc-linux-gnu else error "Please add the correct _builddir variable for your toolchain!" exit 1 fi # ------------------------- # # --- PATCH INFORMATION --- # # ------------------------- # # To support global menu a patch from Ubuntu is applied. # source (replace ${_debianrev} with the revision above): # https://bazaar.launchpad.net/~mozillateam/firefox/firefox-trunk.head/revision/${_debianrev}#debian/patches/unity-menubar.patch # To integrate better with KDE Plasma 5 patches for openSUSE are applied. # source (replace ${_opensuserev} with the revision above): # http://www.rosenauer.org/hg/mozilla/file/${_opensuserev} # ------------------- # # --- SOURCE INFO --- # # ------------------- # pkgname=("$_realname-kde-opensuse-beta") pkgver="$_pkgver" pkgrel=1 pkgdesc="Standalone web browser from mozilla.org with openSUSE patches to integrate better with KDE Plasma 5" arch=('i686' 'x86_64') license=('MPL' 'GPL' 'LGPL') url="https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox" depends=('gtk3' 'gtk2' 'mozilla-common' 'libxt' 'startup-notification' 'mime-types' 'dbus-glib' 'ffmpeg' 'nss>=3.33' 'nspr>=4.17' 'hunspell' 'sqlite' 'ttf-font' 'libpulse' 'hicolor-icon-theme' 'libvpx' 'icu' 'libevent' 'kmozillahelper') makedepends=('unzip' 'zip' 'diffutils' 'python2' 'yasm' 'mesa' 'imake' 'gconf' 'inetutils' 'autoconf2.13' 'rust' 'clang' 'llvm' 'jack') optdepends=('networkmanager: Location detection via available WiFi networks' 'libnotify: Notification integration' 'pulseaudio: Audio support' 'speech-dispatcher: Text-to-Speech' 'firefox-beta-i18n: Localization support') provides=("firefox=${pkgver}") conflicts=('firefox') options=('!emptydirs') # shellcheck disable=SC2140 source=("firefox-$pkgver.source.tar.xz"::"$_mozffurl" "firefox-trunk+r$_debianrev.debian.tar.gz"::"$_debianurl" "mozilla-kde_g$_opensuserev.patch"::"$_opensusebaseurl/mozilla-kde.patch" "mozilla-nongnome-proxies_g$_opensuserev.patch"::"$_opensusebaseurl/mozilla-nongnome-proxies.patch" "firefox-branded-icons_g$_opensuserev.patch"::"$_opensusebaseurl/firefox-branded-icons.patch" "firefox-kde_g$_opensuserev.patch"::"$_opensusebaseurl/firefox-kde.patch" "firefox-no-default-ualocale_g$_opensuserev.patch"::"$_opensusebaseurl/firefox-no-default-ualocale.patch" 'native-menu-doc-listener.patch' 'mozilla-kde-opensuse-patch.patch' 'add-missing-pgo-rule.patch' 'pgo-fix-missing-kdejs.patch' 'wifi-disentangle.patch' 'wifi-fix-interface.patch' 'no-crmf.patch' 'firefox-install-dir.patch' 'mozconfig' 'vendor.js' 'kde.js' 'firefox-fixed-loading-icon.png' 'firefox.desktop') sha256sums=('4dfa360a689410d18263f0e88227101d6052cacfd27f9a5780b343c759520d91' 'SKIP' # Debian source tarball is generated each time it is requested. 'fc0358619be3a63683c680b7c59e024030d96e6dc461217fe451d8289b1236bf' 'ef0f90c9134ef05b950f06a3ffbd699c2e5a5f99a4cdf9868e799534d68c204f' 'f4f919ae5c0921218d7ef7d4502ac8de3212d66d86accc588de04ea24ceb2f36' 'd8cf3221222e97e08dbf704a8b0c9d38e29d7dd1033455404872f04a1df10ccf' '175c61f549b1ea08704d1f051d801d3e566d6ec0b048ca6127eaa922e6ddd266' '70bdf9e58397e6483b7a4d925176be74defbde0221cc3d5f253ec4ede55e6f21' '0468c2399880358b264c98a2b4f29bde1666aad1253735f6e3d6f2a48e9d1bd2' 'f9067f62a25a7a77276e15f91cc9e7ba6576315345cfc6347b1b2e884becdb0c' '2797d1e61031d24ee24bf682c9447b3b9c1bca10f8e6cbd597b854af2de1ec54' 'f068b84ad31556095145d8fefc012dd3d1458948533ed3fff6cbc7250b6e73ed' 'e98a3453d803cc7ddcb81a7dc83f883230dd8591bdf936fc5a868428979ed1f1' 'fb85a538044c15471c12cf561d6aa74570f8de7b054a7063ef88ee1bdfc1ccbb' 'd86e41d87363656ee62e12543e2f5181aadcff448e406ef3218e91865ae775cd' '3a379cafc979bb2cea4380b774a69ac5a79919291060d38464f94b479c4d19a0' '93c5df00f409988bbfa890ac175103476ead3af68f7501973ee70bd11dc472f8' 'b8cc5f35ec35fc96ac5c5a2477b36722e373dbb57eba87eb5ad1276e4df7236d' '68e3a5b47c6d175cc95b98b069a15205f027cab83af9e075818d38610feb6213' '75c526e9669b91b4fe5dcea650a1e8419220abb2e9564184f0d984c71eae82e8') if [[ ! -z "$_system_pixman" ]] && $_system_pixman; then depends+=('pixman') fi if [[ ! -z "$_pgo" ]] && $_pgo; then makedepends+=('xorg-server-xvfb') fi if [[ ! -z "$_ccache" ]] && $_ccache; then makedepends+=('ccache') fi if [[ ! -z "$_debug" ]] && $_debug; then options+=('debug' '!strip') else options+=('!debug' 'strip') fi # ---------------------- # # --- BUILD ROUTINES --- # # ---------------------- # prepare() { warning "Building Firefox takes roughly 10GiB of space, more if built with debugging symbols" warning "Building Firefox can take many hours (1-10) depending on your system" warning "Firefox is much more likely to crash if build with non-standard CXXFLAGS" warning "Firefox will be much more reliable if built from a clean chroot" warning "You have 30 seconds to reconsider your build environment" sleep 30 cd "$srcdir/$_realname-$_realver" msg2 "Creating API key files" echo -n "$_google_api_key" > google-api-key echo -n "$_google_default_client_id $_google_default_client_secret" > google-oauth-api-key echo -n "$_mozilla_api_key" > mozilla-api-key msg2 "Creating .mozconfig (configure flags)" { cat "$srcdir/mozconfig" if [[ ! -z "$_optimize" ]]; then echo "ac_add_options --enable-optimize='${_optimize//\'/\'\\\'\'}'" fi echo "ac_add_options --with-google-api-keyfile='${PWD//\'/\'\\\'\'}/google-api-key'" echo "ac_add_options --with-google-api-keyfile='${PWD//\'/\'\\\'\'}/google-oauth-api-key'" echo "ac_add_options --with-mozilla-api-keyfile='${PWD//\'/\'\\\'\'}/mozilla-api-key'" if [[ ! -z "$_system_pixman" ]] && $_system_pixman; then echo "ac_add_options --enable-system-pixman" fi if [[ ! -z "$_ccache" ]] && $_ccache; then echo "ac_add_options --enable-ccache" fi if [[ ! -z "$_debug" ]] && $_debug; then echo "ac_add_options --enable-debug" else echo "export STRIP_FLAGS='--strip-debug'" fi } > .mozconfig msg2 "Fixing openSUSE patches for Firefox $pkgver" mkdir -p "$srcdir/patched-patches" cd "$srcdir/patched-patches" for patch in mozilla-kde; do cp "$srcdir/${patch}_g$_opensuserev.patch" "$patch.patch" patch -Ni "$srcdir/$patch-opensuse-patch.patch" done cd "$srcdir/$_realname-$_realver" msg2 "Applying Unity (global) menubar patch" patch -Np1 -i "$srcdir/~mozillateam/firefox/firefox-trunk.head/debian/patches/unity-menubar.patch" patch -Np1 -i "$srcdir/native-menu-doc-listener.patch" msg2 "Applying openSUSE patches" patch -Np1 -i "$srcdir/mozilla-nongnome-proxies_g$_opensuserev.patch" patch -Np1 -i "$srcdir/patched-patches/mozilla-kde.patch" patch -Np1 -i "$srcdir/firefox-branded-icons_g$_opensuserev.patch" patch -Np1 -i "$srcdir/firefox-kde_g$_opensuserev.patch" patch -Np1 -i "$srcdir/firefox-no-default-ualocale_g$_opensuserev.patch" msg2 "Applying Arch Linux (vendor) specific patches" patch -Np1 -i "$srcdir/add-missing-pgo-rule.patch" patch -Np1 -i "$srcdir/pgo-fix-missing-kdejs.patch" # https://bugzilla.mozilla.org/show_bug.cgi?id=1371991 patch -Np1 -i "$srcdir/no-crmf.patch" # https://bugzilla.mozilla.org/show_bug.cgi?id=1314968 patch -Np1 -i "$srcdir/wifi-disentangle.patch" patch -Np1 -i "$srcdir/wifi-fix-interface.patch" patch -Np1 -i "$srcdir/firefox-install-dir.patch" msg2 "Creating additional PATH element to python2 (as python)" # WebRTC build tries to execute "python" and expects Python 2 mkdir -p "$srcdir/path" ln -sf /usr/bin/python2 "$srcdir/path/python" msg2 "Replacing loading icon with fixed one" # Fix tab loading icon (flickers with libpng 1.6) # https://bugzilla.mozilla.org/show_bug.cgi?id=841734 # TODO: Remove this; Firefox 34 might use CSS animations for the loading icon # https://bugzilla.mozilla.org/show_bug.cgi?id=759252 cp "$srcdir/firefox-fixed-loading-icon.png" \ browser/themes/linux/tabbrowser/loading.png touch sourcestamp.txt } build() { cd "$srcdir/$_realname-$_realver" export PATH="$srcdir/path:$PATH" export PYTHON="/usr/bin/python2" # Build fails with -D_FORTIFY_SOURCE if optimizations are not in CPPFLAGS if [[ -z "${CPPFLAGS/*-D_FORTIFY_SOURCE*/}" && ! -z "$_optimize" ]]; then CPPFLAGS+=" $_optimize" fi # Hardening LDFLAGS+=" -Wl,-z,now" # Prevent ENOMEM during linking. if [[ ! -z "$_lowmem" ]] && $_lowmem || [[ "$CARCH" == i*86 ]]; then LDFLAGS+=" -Xlinker --no-keep-memory" fi if [[ ! -z "$_pgo" ]] && $_pgo; then export MOZ_PGO=1 BUILDCMD=(xvfb-run -a -s "-extension GLX -screen 0 1280x1024x24" ./mach build) else BUILDCMD=(./mach build) fi msg2 "Building Firefox" "${BUILDCMD[@]}" msg2 "Generating Firefox symbols" ./mach buildsymbols msg2 "Adding KDE Plasma 5 script to default preferences" cp "$srcdir/kde.js" "$_builddir/dist/bin/defaults/pref"/ } package() { cd "$srcdir/$_realname-$_realver" msg2 "Installing Firefox" DESTDIR="$pkgdir" ./mach install msg2 "Copying Firefox symbols zip into start directory" find . -name '*crashreporter-symbols-full.zip' -exec cp -fvt "$startdir" {} + msg2 "Installing KDE Plasma 5 script" install -Dm644 "$srcdir/kde.js" \ "$pkgdir/usr/lib/firefox/browser/defaults/preferences/kde.js" msg2 "Installing Arch Linux (vendor) script" install -Dm644 "$srcdir/vendor.js" \ "$pkgdir/usr/lib/firefox/browser/defaults/preferences/vendor.js" msg2 "Installing distribution metadata file" install -dm755 "$pkgdir/usr/lib/firefox/distribution" cat > "$pkgdir/usr/lib/firefox/distribution/distribution.ini" <