mirror of
https://gitdl.cn/https://github.com/chakralinux/gtk.git
synced 2025-01-24 18:12:13 +08:00
333 lines
12 KiB
Bash
333 lines
12 KiB
Bash
pkgname=firefox-kde
|
|
pkgver=57.0
|
|
pkgrel=2
|
|
pkgdesc="Standalone web browser from mozilla.org with OpenSUSE patch, integrate better with KDE"
|
|
arch=('x86_64')
|
|
license=('MPL' 'GPL' 'LGPL')
|
|
url="https://www.mozilla.org/firefox/"
|
|
depends=(gtk3 mozilla-common libxt startup-notification mime-types dbus-glib alsa-lib ffmpeg
|
|
libvpx libevent hunspell libproxy nss nspr pixman
|
|
"sqlite3>=3.17.0"
|
|
kio knotifications kwindowsystem ki18n)
|
|
makedepends=(unzip zip diffutils python2 yasm mesa imake libpulse inetutils xorg-server-xvfb
|
|
autoconf2.13 gtk2 gobject-introspection jack rust
|
|
cmake extra-cmake-modules llvm clang)
|
|
optdepends=('networkmanager: Location detection via available WiFi networks'
|
|
'libnotify: Notification integration'
|
|
'upower: Battery API'
|
|
'firefox-i18n: for multilanguage support')
|
|
options=(!emptydirs)
|
|
screenshot="http://img864.imageshack.us/img864/5116/firefoxm.png"
|
|
provides=("firefox=${pkgver}" "kmozillahelper")
|
|
conflicts=('kmozillahelper')
|
|
replaces=('kmozillahelper')
|
|
install=firefox.install
|
|
#
|
|
# For whom want to update this package
|
|
#
|
|
# Alternative firefox source url:
|
|
# http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${pkgver}/source/firefox-${pkgver}.source.tar.bz2
|
|
# This URL uses CDN so it's faster, but maybe out of date when new firefox release comes out.
|
|
#
|
|
# Find Firefox KDE related patch:
|
|
# patch http://www.rosenauer.org/hg/mozilla/
|
|
# patch https://build.opensuse.org/package/show?package=MozillaFirefox&project=mozilla%3AFactory
|
|
#
|
|
# Usually, we also port non-openSUSE specific patch together.
|
|
#
|
|
_patchrev=77c890186192
|
|
_kmozillahelper_commit=47e708e
|
|
_patchurl=http://www.rosenauer.org/hg/mozilla/raw-file/$_patchrev
|
|
source=("https://download-installer.cdn.mozilla.net/pub/firefox/releases/${pkgver}/source/firefox-${pkgver}.source.tar.xz"
|
|
"git://github.com/openSUSE/kmozillahelper#commit=${_kmozillahelper_commit}"
|
|
'firefox.desktop'
|
|
'firefox-install-dir.patch'
|
|
'pgo-fix-missing-kdejs.patch'
|
|
'wifi-disentangle.patch'
|
|
'wifi-fix-interface.patch'
|
|
'no-plt.diff'
|
|
'no-crmf.diff'
|
|
'mozilla-1399611.patch'
|
|
|
|
# Firefox patchset
|
|
"$_patchurl/firefox-kde.patch"
|
|
"$_patchurl/firefox-branded-icons.patch"
|
|
"$_patchurl/firefox-no-default-ualocale.patch" # try to refer to chrome://global/locale/intl.properties(which is defined in language pack) for ua locale
|
|
|
|
# Gecko/toolkit patchset
|
|
"$_patchurl/mozilla-nongnome-proxies.patch"
|
|
"$_patchurl/mozilla-kde.patch"
|
|
'ddg-branding.patch'
|
|
"$_patchurl/mozilla-openaes-decl.patch"
|
|
"$_patchurl/mozilla-bindgen-systemlibs.patch"
|
|
|
|
# Useless patchset
|
|
#"$_patchurl/gecko-lockdown.patch"
|
|
#"$_patchurl/mozilla-idldir.patch"
|
|
#$_patchurl/firefox-ui-lockdown.patch
|
|
#"$_patchurl/toolkit-ui-lockdown.patch"
|
|
#"$_patchurl/mozilla-bmo1088588.patch" # Specify for ARM and PPC
|
|
#"$_patchurl/toolkit-download-folder.patch"
|
|
#"$_patchurl/mozilla-language.patch" # making use of LANGUAGE= env var which isn't part of our standard
|
|
#"$_patchurl/mozilla-prefer_plugin_pref.patch" removed from opensuse. reason: dropped mozilla-prefer_plugin_pref.patch as this feature is likely not worth maintaining further
|
|
#"$_patchurl/mozilla-shared-nss-db.patch" shared by default now
|
|
)
|
|
sha1sums=('ce4fb33c451a2fbd0ed24d5f4b2c3c2e4ea22f33'
|
|
'SKIP'
|
|
'1a8ecc6d2cfd97791d8182882a74929f2a7289e9'
|
|
'693b54b9206ad854e4d75cbbf393029b77e82153'
|
|
'12327a932bdb70d884277a7b781d2d17bff78b1c'
|
|
'b979e1a2f3361fe76dbe2766d48033bf20e3d619'
|
|
'8b38e2640c848adbc0cffa93918ff42fa9bbdea1'
|
|
'2ee940cd4801e288e1825221c7115177228b0942'
|
|
'1842e9c213e2289cc7fa49b22e2a1809a687ace9'
|
|
'4dde21cd48ac9c61c4d4835d41eb2b379e373b16'
|
|
'd1026670e4cf6c7c64d499cb9075590e99cab5eb'
|
|
'37c10bb9ca6c61ae10cf069078426a75ed4db439'
|
|
'c6f2fdac2e7706d7c05ac60f05e021049fb62b53'
|
|
'1cb412a081404db6ee50dd20438b96857dcfe58f'
|
|
'bfd2254e261e232053cbf5eae6db1a2e8f8c4e3d'
|
|
'9cf8c5a03bcc97b66d97d62d72c325ddb14102cb'
|
|
'ef73665d3eb3e39d4f005e38e6f0d0dc2baad2e8'
|
|
'edecd379e327956f21b5e873ad213ac4ddf185f0')
|
|
|
|
|
|
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
|
|
# Note: These are for Chakra Linux use ONLY. For your own distribution, please
|
|
# get your own set of keys. Feel free to contact totte@chakralinux.org for
|
|
# more information.
|
|
_google_api_key=AIzaSyDjyg8EmaRUIsewzdjZXFZ0O8N5ARDUDGU
|
|
|
|
# Mozilla API keys (see https://location.services.mozilla.com/api)
|
|
# Note: These are for Chakra Linux use ONLY. For your own distribution, please
|
|
# get your own set of keys. Feel free to contact totte@chakralinux.org for
|
|
# more information.
|
|
_mozilla_api_key=bf05f841-e0bd-4644-81f5-3c132755f2e9
|
|
|
|
|
|
prepare() {
|
|
cd ${srcdir}/firefox-${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=1314968
|
|
patch -Np1 -i ../wifi-disentangle.patch
|
|
patch -Np1 -i ../wifi-fix-interface.patch
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1341234
|
|
patch -Np1 -i ../mozilla-bindgen-systemlibs.patch
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1382942
|
|
patch -Np1 -i ../no-plt.diff
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1399611
|
|
# Experimental patch for CSD on toolkit base, default to off
|
|
patch -Np1 -i ../mozilla-1399611.patch
|
|
|
|
echo -n "$_google_api_key" > google-api-key
|
|
echo -n "$_mozilla_api_key" > mozilla-api-key
|
|
|
|
msg 'Generating kde.js'
|
|
cat >kde.js <<END
|
|
pref("browser.preferences.instantApply", false);
|
|
pref("browser.backspace_action", 0);
|
|
END
|
|
|
|
msg 'Generating mozconfig'
|
|
cat >.mozconfig <<END
|
|
# There multiple default mozconfigs in the soruce tree with references across directories
|
|
# $topsrcdir/build/unix/mozconfig.gtk
|
|
# $topsrcdir/build/unix/mozconfig.linux
|
|
# $topsrcdir/build/mozconfig.common
|
|
# $topsrcdir/browser/config/mozconfigs/linux64/release
|
|
# $topsrcdir/browser/config/mozconfigs/linux64/common-opt
|
|
# $topsrcdir/browser/config/mozconfig
|
|
# $topsrcdir/build/mozconfig.rust
|
|
# But we intend to mantain our own mozconfig without reference to any of the mozilla upstream configuration to keep it simple
|
|
# This mozconfig would inlcude most of the configurations listed above into one file
|
|
|
|
ac_add_options --prefix=/usr
|
|
ac_add_options --enable-release
|
|
ac_add_options --enable-pie
|
|
ac_add_options --enable-gold
|
|
ac_add_options --enable-optimize="-O2"
|
|
ac_add_options --enable-jemalloc
|
|
ac_add_options --enable-pthreads
|
|
ac_add_options --enable-stylo
|
|
|
|
# Release branding
|
|
ac_add_options --enable-application=browser
|
|
ac_add_options --enable-official-branding
|
|
ac_add_options --enable-update-channel=release
|
|
ac_add_options --with-distribution-id=org.chakralinux
|
|
ac_add_options --enable-default-toolkit=cairo-gtk3
|
|
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
|
|
|
|
# System libraries
|
|
ac_add_options --with-system-jpeg
|
|
ac_add_options --with-system-zlib
|
|
ac_add_options --with-system-bz2
|
|
ac_add_options --with-system-libevent
|
|
ac_add_options --with-system-libvpx
|
|
ac_add_options --with-system-nspr
|
|
ac_add_options --with-system-nss
|
|
ac_add_options --with-system-icu
|
|
ac_add_options --with-system-png
|
|
ac_add_options --enable-system-pixman
|
|
ac_add_options --enable-system-hunspell
|
|
ac_add_options --enable-system-sqlite
|
|
ac_add_options --enable-system-ffi
|
|
ac_add_options --enable-system-cairo
|
|
ac_add_options --enable-libproxy
|
|
|
|
# Features
|
|
ac_add_options --enable-startup-notification
|
|
ac_add_options --enable-jack
|
|
ac_add_options --disable-gconf
|
|
ac_add_options --disable-updater
|
|
ac_add_options --disable-crashreporter
|
|
|
|
# PGO
|
|
mk_add_options PROFILE_GEN_SCRIPT='EXTRA_TEST_ARGS=10 $(MAKE) -C $(MOZ_OBJDIR) pgo-profile-run'
|
|
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff
|
|
STRIP_FLAGS="--strip-debug"
|
|
END
|
|
|
|
msg "Gecko/toolkit patchset"
|
|
patch -Np1 -i "$srcdir/mozilla-nongnome-proxies.patch"
|
|
patch -Np1 -i "$srcdir/mozilla-kde.patch"
|
|
patch -Np1 -i "$srcdir/mozilla-openaes-decl.patch"
|
|
|
|
msg "Firefox patchset"
|
|
patch -Np1 -i "$srcdir/firefox-kde.patch"
|
|
patch -Np1 -i "$srcdir/firefox-branded-icons.patch"
|
|
patch -Np1 -i "$srcdir/ddg-branding.patch"
|
|
patch -Np1 -i "$srcdir"/pgo-fix-missing-kdejs.patch
|
|
patch -Np1 -i "$srcdir/firefox-no-default-ualocale.patch"
|
|
}
|
|
|
|
build() {
|
|
msg "build_kmozillahelper"
|
|
build_kmozillahelper
|
|
msg "build_firefox"
|
|
build_firefox
|
|
}
|
|
|
|
build_kmozillahelper() {
|
|
cd $srcdir/
|
|
mkdir -p kmozillahelper-build
|
|
cd kmozillahelper-build
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DCMAKE_BUILD_TYPE=Release ../kmozillahelper
|
|
make
|
|
}
|
|
|
|
build_firefox() {
|
|
cd "$srcdir/firefox-${pkgver}"
|
|
|
|
# _FORTIFY_SOURCE causes configure failures
|
|
CPPFLAGS+=" -O2"
|
|
|
|
# Hardening
|
|
LDFLAGS+=" -Wl,-z,now"
|
|
|
|
# GCC 6
|
|
CXXFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
|
|
|
|
export SHELL=/bin/bash
|
|
|
|
# Do PGO
|
|
xvfb-run -a -n 95 -s "-extension GLX -screen 0 1280x1024x24" \
|
|
make -f client.mk profiledbuild
|
|
#make -f client.mk build
|
|
}
|
|
|
|
package() {
|
|
msg "package() kmozillahelper"
|
|
cd $srcdir/kmozillahelper-build
|
|
make DESTDIR=$pkgdir install
|
|
|
|
msg "package() Firefox"
|
|
cd "$srcdir/firefox-${pkgver}"
|
|
|
|
export SHELL=/bin/bash
|
|
make -f client.mk DESTDIR="$pkgdir" MOZ_PKG_FATAL_WARNINGS=0 INSTALL_SDK= install
|
|
|
|
_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);
|
|
pref("browser.search.defaultenginename", "DuckDuckGo");
|
|
pref("browser.search.order.extra.duckduckgo", "DuckDuckGo");
|
|
pref("browser.search.selectedEngine", "DuckDuckGo");
|
|
|
|
// Don't disable our bundled extensions in the application directory
|
|
pref("extensions.autoDisableScopes", 11);
|
|
pref("extensions.shownSelectionUI", true);
|
|
|
|
// Default e10s support to be enabled
|
|
pref("browser.tabs.remote.autostart", true);
|
|
END
|
|
|
|
install -Dm644 kde.js "$pkgdir/usr/lib/firefox/browser/defaults/preferences/kde.js"
|
|
|
|
_distini="$pkgdir/usr/lib/firefox/distribution/distribution.ini"
|
|
install -Dm644 /dev/stdin "$_distini" <<END
|
|
[Global]
|
|
id=chakralinux
|
|
version=1.0
|
|
about=Mozilla Firefox for Chakra GNU/Linux
|
|
|
|
[Preferences]
|
|
app.distributor=chakralinux
|
|
app.distributor.channel=${pkgname%-kde}
|
|
app.partner.chakralinux=chakralinux
|
|
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/firefox.png"
|
|
done
|
|
install -Dm644 browser/branding/official/content/icon64.png \
|
|
"$pkgdir/usr/share/icons/hicolor/64x64/apps/firefox.png"
|
|
install -Dm644 browser/branding/official/mozicon128.png \
|
|
"$pkgdir/usr/share/icons/hicolor/128x128/apps/firefox.png"
|
|
install -Dm644 browser/branding/official/content/about-logo.png \
|
|
"$pkgdir/usr/share/icons/hicolor/192x192/apps/firefox.png"
|
|
install -Dm644 browser/branding/official/content/about-logo@2x.png \
|
|
"$pkgdir/usr/share/icons/hicolor/384x384/apps/firefox.png"
|
|
|
|
install -Dm644 ../firefox.desktop \
|
|
"$pkgdir/usr/share/applications/firefox.desktop"
|
|
|
|
# Use system-provided dictionaries
|
|
rm -r "$pkgdir"/usr/lib/firefox/dictionaries
|
|
ln -Ts /usr/share/hunspell "$pkgdir/usr/lib/firefox/dictionaries"
|
|
ln -Ts /usr/share/hyphen "$pkgdir/usr/lib/firefox/hyphenation"
|
|
|
|
# Install a wrapper to avoid confusion about binary path
|
|
install -Dm755 /dev/stdin "$pkgdir/usr/bin/firefox" <<END
|
|
#!/bin/sh
|
|
exec /usr/lib/firefox/firefox "\$@"
|
|
END
|
|
|
|
# Replace duplicate binary with wrapper
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=658850
|
|
ln -srf "$pkgdir/usr/bin/firefox" \
|
|
"$pkgdir/usr/lib/firefox/firefox-bin"
|
|
}
|