PKGBUILD 9.63 KB
Newer Older
1
pkgname=firefox
AlmAck's avatar
AlmAck committed
2
pkgver=66.0.5
Chaoting Liu's avatar
Chaoting Liu committed
3
pkgrel=1
AlmAck's avatar
AlmAck committed
4 5
pkgdesc="Standalone web browser from mozilla.org with OpenSUSE patch, integrate better with KDE"
arch=('x86_64')
6 7
license=('MPL' 'GPL' 'LGPL')
url="https://www.mozilla.org/firefox/"
Chaoting Liu's avatar
Chaoting Liu committed
8
depends=(gtk3 mozilla-common libxt startup-notification mime-types dbus-glib ffmpeg
9
         libevent libproxy nss xdg-desktop-portal)
Chaoting Liu's avatar
Chaoting Liu committed
10
makedepends=(unzip zip diffutils python2 yasm mesa imake inetutils xorg-server-xvfb
11
             autoconf2.13 gtk2 gobject-introspection jack rust llvm clang lld cbindgen nodejs nasm)
12
optdepends=('networkmanager: Location detection via available WiFi networks'
Xuetian Weng's avatar
Xuetian Weng committed
13
            'libnotify: Notification integration'
Xuetian Weng's avatar
Xuetian Weng committed
14
            'upower: Battery API'
15
            'firefox-i18n: For multilanguage support'
16
            'hunspell: For spellchecking support')
17
screenshot="http://img864.imageshack.us/img864/5116/firefoxm.png"
18 19
conflicts=('firefox-kde')
replaces=('firefox-kde')
20
#
21
# To whom want to update this package
22
#
Chaoting Liu's avatar
Chaoting Liu committed
23
# Notes on mercurial release revision
Chaoting Liu's avatar
Chaoting Liu committed
24
# http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${pkgver}/SOURCE
25 26 27 28 29 30 31 32
# 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.
#
33
_kmozillahelper_commit=2ca28e0 #v5.0.2
Chaoting Liu's avatar
Chaoting Liu committed
34
_kdepatchrev=eca1c1f2fe50
Chaoting Liu's avatar
Chaoting Liu committed
35
_kdepatchurl=http://www.rosenauer.org/hg/mozilla/raw-file/$_kdepatchrev
36
_ubuntuver=build1-0ubuntu1
Chaoting Liu's avatar
Chaoting Liu committed
37 38 39
#_ubuntupatchurl=http://archive.ubuntu.com/ubuntu/pool/main/f/firefox/firefox_${pkgver}+${_ubuntuver}.debian.tar.xz # no TLS @2019, really?
#_gentoopatch=https://dev.gentoo.org/~{anarchy,axs,polynomial-c,whissi}/mozilla/patchsets/${PATCH}.tar.xz

40
source=("https://releases.mozilla.org/pub/firefox/releases/${pkgver}/source/${pkgname}-${pkgver}.source.tar.xz"{,.asc}
41
        'firefox.desktop' 'ddg.xml'
42
        '0001-bz-1468911.patch'
Chaoting Liu's avatar
Chaoting Liu committed
43

44
        # Gentoo patch
Chaoting Liu's avatar
Chaoting Liu committed
45 46 47
        1003_foritify_sources_properly.patch
        2000_system_harfbuzz_support.patch
        2001_system_graphite2_support.patch
48

Chaoting Liu's avatar
Chaoting Liu committed
49
        # Ubuntu patch
Chaoting Liu's avatar
Chaoting Liu committed
50
        "http://archive.ubuntu.com/ubuntu/pool/main/f/firefox/firefox_66.0.3+${_ubuntuver}.debian.tar.xz"
Chaoting Liu's avatar
Chaoting Liu committed
51

52
        # Unused patchset
Chaoting Liu's avatar
Chaoting Liu committed
53 54 55
        # gecko-lockdown.patch
        # firefox-ui-lockdown.patch
        # toolkit-ui-lockdown.patch: this and above, Not appliable
56 57 58 59 60 61 62
        # mozilla-gconf-backend.patch: we disabled gconf
        # mozilla-bmo1463035.patch: not our targetted architecture
        # mozilla-bmo256180.patch: don't know what it is for
        # mozilla-cubeb-noreturn.patch looks like this should be upstreamed
        # mozilla-no-stdcxx-check.patch: we just passed it
        # mozilla-ntlm-full-path.patch: not affected it seems
        # mozilla-reduce-files-per-UnifiedBindings.patch
AlmAck's avatar
AlmAck committed
63
)
Chaoting Liu's avatar
Chaoting Liu committed
64
validpgpkeys=('14F26682D0916CDD81E37B6D61B7B526D98F0353') # Mozilla Software Releases <release@mozilla.com>
AlmAck's avatar
AlmAck committed
65
sha256sums=('a2aeb4e036d1365a2d2550e24ba8b4dde061281300f2b11a204cc1e9eb1792b5'
66
            'SKIP'
67
            '6c2ea431c36afef67710547ae67e81975254309e9e1c82d8312f765caa950fe5'
68
            '1190f251471305f4c96a313b32aa66ee1549125300d7ce385356f45bd8ebcb3d'
Chaoting Liu's avatar
Chaoting Liu committed
69
            '821f858bac2e13ce02b8c20d5387d4ecc8ab2d0e4ebe0a517cbf935da6aeb31b'
70
            'e5d8f0410ecd05119119e2d44a88fb5f1eb67a5b1035fd0a66b8cf167fb81c5d'
Chaoting Liu's avatar
Chaoting Liu committed
71 72
            '21949f918907e16919820784bfb51540714c7bb256e219a3d965387b14b18886'
            '8afb2dbc729487aaf6e43e0ce0e86fb51c6f0bd27c3b6580dbb0c431c1cf9aa0'
Chaoting Liu's avatar
Chaoting Liu committed
73
            '2c724ae01a4ef11c72bf836bd1e2974bb667da04279eab9ec704c4c3f1b3612f')
AlmAck's avatar
AlmAck committed
74

Fabian Kosmale's avatar
Fabian Kosmale committed
75

Francesco's avatar
Francesco committed
76 77
# 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
78 79 80
# get your own set of keys. Feel free to contact totte@chakralinux.org for
# more information.
_google_api_key=AIzaSyDjyg8EmaRUIsewzdjZXFZ0O8N5ARDUDGU
Francesco's avatar
Francesco committed
81

82 83 84 85 86 87
# 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

Xuetian Weng's avatar
Xuetian Weng committed
88

Francesco's avatar
Francesco committed
89
prepare() {
Chaoting Liu's avatar
Chaoting Liu committed
90 91
  mkdir path
  ln -s /usr/bin/python2 path/python
92

Chaoting Liu's avatar
Chaoting Liu committed
93
  #cd ${srcdir}/mozilla-release-${_changeset}
94
  cd ${srcdir}/${pkgname}-${pkgver}
Xuetian Weng's avatar
Xuetian Weng committed
95

96 97
  patch -Np1 -i $srcdir/0001-bz-1468911.patch

Francesco's avatar
Francesco committed
98
  echo -n "$_google_api_key" > google-api-key
99 100
  echo -n "$_mozilla_api_key" > mozilla-api-key

Chaoting Liu's avatar
Chaoting Liu committed
101 102 103 104 105 106 107 108 109 110 111 112
  msg 'Generating mozconfig'
# 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

113
  cat >.mozconfig <<END
Chaoting Liu's avatar
Chaoting Liu committed
114 115 116 117
ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-gold
ac_add_options --enable-optimize="-O2"
Chaoting Liu's avatar
Chaoting Liu committed
118
ac_add_options --disable-elf-hack
119 120 121 122 123 124 125 126
ac_add_options --enable-rust-simd
ac_add_options --enable-lto
ac_add_options --enable-hardening
export CC=clang
export CXX=clang++
export AR=llvm-ar
export NM=llvm-nm
export RANLIB=llvm-ranlib
Chaoting Liu's avatar
Chaoting Liu committed
127 128 129 130 131 132 133 134

# 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
Chaoting Liu's avatar
Chaoting Liu committed
135
export MOZ_TELEMETRY_REPORTING=0
Chaoting Liu's avatar
Chaoting Liu committed
136
export MOZ_REQUIRE_SIGNING=1
Chaoting Liu's avatar
Chaoting Liu committed
137
#export MOZ_PGO=1
Chaoting Liu's avatar
Chaoting Liu committed
138 139

# Keys
140 141
ac_add_options --with-google-location-service-api-keyfile=${PWD@Q}/google-api-key
ac_add_options --with-google-safebrowsing-api-keyfile=${PWD@Q}/google-api-key
Chaoting Liu's avatar
Chaoting Liu committed
142 143 144 145 146 147 148
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
Chaoting Liu's avatar
Chaoting Liu committed
149
#ac_add_options --with-system-libvpx
Chaoting Liu's avatar
Chaoting Liu committed
150 151
ac_add_options --with-system-nss
ac_add_options --with-system-nspr
Chaoting Liu's avatar
Chaoting Liu committed
152
#ac_add_options --with-system-icu
Chaoting Liu's avatar
Chaoting Liu committed
153
ac_add_options --with-system-png
Chaoting Liu's avatar
Chaoting Liu committed
154
ac_add_options --enable-system-pixman
Chaoting Liu's avatar
Chaoting Liu committed
155
ac_add_options --enable-system-sqlite
Chaoting Liu's avatar
Chaoting Liu committed
156 157 158 159 160 161
ac_add_options --enable-system-ffi
ac_add_options --enable-libproxy

# Features
ac_add_options --enable-startup-notification
ac_add_options --enable-jack
162
ac_add_options --enable-alsa
Chaoting Liu's avatar
Chaoting Liu committed
163
ac_add_options --disable-gconf
Chaoting Liu's avatar
Chaoting Liu committed
164
ac_add_options --disable-updater
165
ac_add_options --disable-crashreporter
Chaoting Liu's avatar
Chaoting Liu committed
166

167
mk_add_options MOZ_MAKE_FLAGS="-j9"
Chaoting Liu's avatar
Chaoting Liu committed
168 169
STRIP_FLAGS="--strip-debug"
END
Chaoting Liu's avatar
Chaoting Liu committed
170

171
  msg "Gentoo Patchset"
Chaoting Liu's avatar
Chaoting Liu committed
172 173 174
  patch -Np1 -i $srcdir/1003_foritify_sources_properly.patch
  patch -Np1 -i $srcdir/2000_system_harfbuzz_support.patch
  patch -Np1 -i $srcdir/2001_system_graphite2_support.patch
175

176
  msg "Ubuntu Patchset"
Chaoting Liu's avatar
Chaoting Liu committed
177
  patch -Np1 -i $srcdir/debian/patches/unity-menubar.patch
178 179 180
}

build() {
181
  cd $srcdir/${pkgname}-${pkgver}
Xuetian Weng's avatar
Xuetian Weng committed
182

Chaoting Liu's avatar
Chaoting Liu committed
183
  export PATH="$srcdir/path:$PATH"
184
  export MOZ_NOSPAM=1
Chaoting Liu's avatar
Chaoting Liu committed
185
  export SHELL=/bin/bash
Chaoting Liu's avatar
Chaoting Liu committed
186
  export MOZBUILD_STATE_PATH="$srcdir/mozbuild"
AlmAck's avatar
AlmAck committed
187

188
  # LTO requires opening more files
Chaoting Liu's avatar
Chaoting Liu committed
189 190
  ulimit -n 4096

Xuetian Weng's avatar
Xuetian Weng committed
191
  # Do PGO
Chaoting Liu's avatar
Chaoting Liu committed
192
#  xvfb-run -a -n 97 -s "-extension GLX -screen 0 1280x1024x24" \
193
   ./mach build
AlmAck's avatar
AlmAck committed
194 195 196
}

package() {
Chaoting Liu's avatar
Chaoting Liu committed
197
  #cd "$srcdir/mozilla-release-${_changeset}"
198
  cd $srcdir/${pkgname}-${pkgver}
199
 
Xuetian Weng's avatar
Xuetian Weng committed
200
  export SHELL=/bin/bash
201
  DESTDIR="$pkgdir" ./mach install
AlmAck's avatar
AlmAck committed
202

203
  _vendorjs="$pkgdir/usr/lib/firefox/browser/defaults/preferences/vendor.js"
Chaoting Liu's avatar
Chaoting Liu committed
204 205
  install -Dm644 /dev/stdin "$_vendorjs" <<END
// Use LANG environment variable to choose locale
Chaoting Liu's avatar
Chaoting Liu committed
206
pref("intl.locale.requested", "");
Chaoting Liu's avatar
Chaoting Liu committed
207

Luca Giambonini's avatar
Luca Giambonini committed
208 209 210
// Use system-provided dictionaries
pref("spellchecker.dictionary_path", "/usr/share/hunspell");

Chaoting Liu's avatar
Chaoting Liu committed
211 212 213
// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);

Chaoting Liu's avatar
Chaoting Liu committed
214 215 216
// Enable Network Manager integration
pref("network.manage-offline-status", true);

Chaoting Liu's avatar
Chaoting Liu committed
217 218 219
// Don't disable our bundled extensions in the application directory
pref("extensions.autoDisableScopes", 11);
pref("extensions.shownSelectionUI", true);
Chaoting Liu's avatar
Chaoting Liu committed
220 221 222 223

// Force HW acceleration
pref("layers.acceleration.force-enabled",  true);
pref("webgl.force-enabled",                true);
Chaoting Liu's avatar
Chaoting Liu committed
224 225
END

226
  msg 'Chakra branding'
Chaoting Liu's avatar
Chaoting Liu committed
227 228 229 230 231
  _distini="$pkgdir/usr/lib/firefox/distribution/distribution.ini"
  install -Dm644 /dev/stdin "$_distini" <<END
[Global]
id=chakralinux
version=1.0
Chaoting Liu's avatar
Chaoting Liu committed
232
about=Mozilla Firefox compiled by Chakra GNU/Linux
Chaoting Liu's avatar
Chaoting Liu committed
233 234 235

[Preferences]
app.distributor=chakralinux
236
app.distributor.channel=firefox
Chaoting Liu's avatar
Chaoting Liu committed
237
app.partner.chakralinux=chakralinux
Chaoting Liu's avatar
Chaoting Liu committed
238
browser.search.geoSpecificDefaults=false
Chaoting Liu's avatar
Chaoting Liu committed
239
END
240
  install -Dm644 $srcdir/ddg.xml $pkgdir/usr/lib/firefox/distribution/searchplugins/common/ddg-chakra.xml
241
  for i in 16 22 24 32 48 64 128 256; do
Xuetian Weng's avatar
Xuetian Weng committed
242 243
    install -Dm644 browser/branding/official/default$i.png \
      "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/firefox.png"
AlmAck's avatar
AlmAck committed
244
  done
245 246 247 248
  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"
AlmAck's avatar
AlmAck committed
249

AlmAck's avatar
AlmAck committed
250
  install -Dm644 ../firefox.desktop \
Francesco's avatar
Francesco committed
251
    "$pkgdir/usr/share/applications/firefox.desktop"
252

Xuetian Weng's avatar
Xuetian Weng committed
253 254 255
  # Install a wrapper to avoid confusion about binary path
  install -Dm755 /dev/stdin "$pkgdir/usr/bin/firefox" <<END
#!/bin/sh
256
export GTK_USE_PORTAL=1
Xuetian Weng's avatar
Xuetian Weng committed
257 258 259 260 261 262 263
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"
AlmAck's avatar
AlmAck committed
264
}