summaryrefslogtreecommitdiff
path: root/libre/icecat/PKGBUILD
blob: 1cf005bd218f6a7d9aeeb8a8669528aa49de608c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# Maintainer (Arch:firefox): Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor (Arch:firefox): Ionut Biru <ibiru@archlinux.org>
# Contributor (Arch:firefox): Jakub Schmidtke <sjakub@gmail.com>

# Contributor (ConnochaetOS:iceweasel): Henry Jensen <hjensen@connochaetos.org>

# Maintainer: Andreas Grapentin <andreas@grapentin.org>
# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: fauno <fauno@kiwwwi.com.ar>
# Contributor: vando <facundo@esdebian.org>
# Contributor: Figue <ffigue at gmail>
# Contributor: evr <evanroman at gmail>
# Contributor: Muhammad 'MJ' Jassim <UnbreakableMJ@gmail.com>

pkgname=icecat
_pkgver=52.6.0-gnu1
pkgver=${_pkgver//-/_}
pkgrel=6
pkgdesc="GNU IceCat - a libre standalone web browser based on Mozilla Firefox."
arch=(x86_64 i686 armv7h)
license=(MPL GPL LGPL)
url="http://www.gnu.org/software/gnuzilla/"
depends=(gtk3 gtk2 mozilla-common libxt startup-notification mime-types dbus-glib ffmpeg
         nss hunspell sqlite ttf-font libpulse libvpx icu)
depends+=('icu>=63' 'icu<64')
makedepends=(unzip zip diffutils python2 yasm mesa imake gconf inetutils xorg-server-xvfb
             autoconf2.13 rust clang llvm jack mozilla-searchplugins)
optdepends=('networkmanager: Location detection via available WiFi networks'
            'libnotify: Notification integration'
            'upower: Battery API')
options=(!emptydirs !makeflags !strip)
source=(http://ftp.gnu.org/gnu/gnuzilla/${_pkgver%-*}/$pkgname-$_pkgver.tar.bz2{,.sig}
        $pkgname.desktop
        $pkgname-install-dir.patch no-crmf.diff
        $pkgname-fixed-loading-icon.png
        disable-crypto-hardening-settings.patch
        disable-spoofSource-referer.patch
        gnu_headshadow.png
        libre.patch)
sha256sums=('0a0cf3acb2067e0580204b44bb5a02fab2033c6bbf7c0b47522a3c4c1f29d625'
            'SKIP'
            '52df9ffeb52166ed4abd9a132ee4a9017b9c4980f0725ba383610ccfb06d4745'
            'a7755c929fed4bc2008319dacad92b543db71168294b124855c5d3a19e46ae8a'
            'd5f0279bcefb5c846ac86c487d540dfc75a5ee45af08e40651e50e778c65f2c0'
            '68e3a5b47c6d175cc95b98b069a15205f027cab83af9e075818d38610feb6213'
            'bb1fc90d117c4a7810e202d23ff44a2dac11b675336533054b5a70dd8606df38'
            'c50043266e69f5844e6dce9ea7193af79587dcaa66806932d7867281a176f03e'
            '93e3001ce152e1d142619e215a9ef07dd429943b99d21726c25da9ceb31e31cd'
            'd32f97e812c536efd9bdc7043efd6f9472a1edd9f814b453805c7c10ffea25a6')
validpgpkeys=('A57369A8BABC2542B5A0368C3C76EED7D7E04784') # Ruben Rodriguez

prepare() {
  mkdir path
  ln -s /usr/bin/python2 path/python

  cd "$srcdir/$pkgname-${pkgver%_*}"
  patch -Np1 -i ../$pkgname-install-dir.patch

  # https://bugzilla.mozilla.org/show_bug.cgi?id=1371991
  patch -Np1 -i ../no-crmf.diff

  cat >.mozconfig <<END
. \$topsrcdir/browser/config/mozconfig

ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-gold
ac_add_options --enable-pie
ac_add_options --enable-optimize="-O2"

ac_add_options --enable-default-toolkit=cairo-gtk3

# Branding
ac_add_options --enable-official-branding
ac_add_options --with-app-basename=icecat
ac_add_options --with-app-name=icecat
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=org.gnu

# System libraries
ac_add_options --with-system-zlib
ac_add_options --with-system-bz2
ac_add_options --with-system-icu
ac_add_options --with-system-jpeg
ac_add_options --with-system-libvpx
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --enable-system-hunspell
ac_add_options --enable-system-sqlite
ac_add_options --enable-system-ffi

# Features
ac_add_options --enable-alsa
ac_add_options --enable-startup-notification
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-safe-browsing
ac_add_options --disable-url-classifier
ac_add_options --disable-eme
END

  if [[ "$CARCH" == arm* ]]; then
    sed -i \
        -e '/enable-gold/s/^/#/' \
        -e '/enable-pie/s/^/#/' \
        -e '/enable-optimize/d' \
      .mozconfig

    cat >> .mozconfig << END
ac_add_options --disable-webrtc
ac_add_options --disable-elf-hack
ac_add_options --enable-optimize="-g -O2 -fno-schedule-insns"
END
  fi

  # Put gnu_headshadow.png in the source code
  install -m644 "$srcdir/gnu_headshadow.png" \
    browser/base/content/abouthome

  # Patch and remove anything that's left
  patch -Np1 -i "$srcdir/libre.patch"
  rm -v browser/base/content/abouthome/snippet*.png || true
  sed -i '\|abouthome/snippet|d
         ' browser/base/jar.mn

  # Fix tab loading icon (doesn't work with libpng 1.6)
  # https://bugzilla.mozilla.org/show_bug.cgi?id=841734
  cp "$srcdir/$pkgname-fixed-loading-icon.png" \
    browser/themes/linux/tabbrowser/loading.png

  # Load our searchplugins
  rm -rv browser/locales/searchplugins
  cp -av /usr/lib/mozilla/searchplugins browser/locales

  # Disable crypto hardening settings for now
  # https://lists.parabola.nu/pipermail/assist/2015-October/000534.html
  # https://labs.parabola.nu/issues/842
  patch -Np1 -i "$srcdir/disable-crypto-hardening-settings.patch"

  # Disable spoofSource referer since it breaks referer function used by some sites
  # https://labs.parabola.nu/issues/1073
  patch -Np1 -i "$srcdir/disable-spoofSource-referer.patch"
}

build() {
  cd "$srcdir/$pkgname-${pkgver%_*}"

  # _FORTIFY_SOURCE causes configure failures
  CPPFLAGS+=" -O2"

  export PATH="$srcdir/path:$PATH"

  # Do PGO
  #xvfb-run -a -n 95 -s "-extension GLX -screen 0 1280x1024x24" \
  #  make -f client.mk build MOZ_PGO=1
  make -f client.mk build
}

package() {
  cd "$srcdir/$pkgname-${pkgver%_*}"
  make -f client.mk DESTDIR="$pkgdir" 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);

// Don't disable our bundled extensions in the application directory
pref("extensions.autoDisableScopes", 11);
pref("extensions.shownSelectionUI", true);

// Disable "alt" as a shortcut key to open full menu bar. Conflicts with "alt" as a modifier
pref("ui.key.menuAccessKeyFocuses", false);

// Make sure that Firefox Social stuff are empty
pref("social.whitelist", "");
pref("social.directories", "");

// Disable the GeoLocation API for content
pref("geo.enabled", false);

// Make sure that the request URL of the GeoLocation backend is empty
pref("geo.wifi.uri", "");

// Disable the least secure encryption protocols
pref("security.ssl3.ecdhe_ecdsa_rc4_128_sha", false);
pref("security.ssl3.ecdhe_rsa_rc4_128_sha", false);
pref("security.ssl3.rsa_rc4_128_md5", false);
pref("security.ssl3.rsa_rc4_128_sha", false);
END

  _distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  install -Dm644 /dev/stdin "$_distini" <<END
[Global]
id=parabola
version=1.0
about=Icecat for Parabola GNU/Linux-libre

[Preferences]
app.distributor=parabola
app.distributor.channel=$pkgname
app.partner.parabola=parabola
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 ../$pkgname.desktop \
    "$pkgdir/usr/share/applications/$pkgname.desktop"

  # fix permissions on extensions folders
  chmod 755 "$pkgdir"/usr/lib/$pkgname/browser/extensions/*/icons

  # 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/$pkgname "\$@"
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/$pkgname-bin"
}