summaryrefslogtreecommitdiff
path: root/libre/icecat/PKGBUILD
blob: dacfa2ba7824cd9ceb79b7373e4b91b98a26a785 (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
245
246
247
248
249
250
251
252
253
254
255
256
257
# 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=60.7.0-gnu1
pkgver=${_pkgver//-/_}
pkgrel=2
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 mozilla-common libxt startup-notification mime-types dbus-glib
         ffmpeg nss ttf-font libpulse sqlite icu)
makedepends=(unzip zip diffutils python2-setuptools yasm mesa imake inetutils
             xorg-server-xvfb autoconf2.13 rust=1:1.39.0 clang llvm9 jack gtk2
             mozilla-searchplugins)
# FIXME: rust=1:1.39.0 and llvm9 are special constraints for the 60.7.0-gnu1-2 rebuild
optdepends=('networkmanager: Location detection via available WiFi networks'
            'libnotify: Notification integration'
            'pulseaudio: Audio support'
            'speech-dispatcher: Text-to-Speech'
            'hunspell-en_US: Spell checking, American English')
options=(!emptydirs !makeflags !debug)
source=(http://ftp.gnu.org/gnu/gnuzilla/${_pkgver%-*}/$pkgname-$_pkgver.tar.bz2{,.sig}
        $pkgname.desktop
        gnu_headshadow.png
        libre-searchengines.patch
        libre.patch
        mozilla-1463035.patch
        deny_missing_docs.patch
        fix-double-definition-of-gettid.patch)
sha256sums=('6873d55b13e2d95ede3bf5bb59769179e91b1c4e05d8538d1576f18c9a6bb827'
            'SKIP'
            '2f9d117c1524312fb45f3e953cb0de02c525fd385a9b2b6d47308c8aaab0aedd'
            '93e3001ce152e1d142619e215a9ef07dd429943b99d21726c25da9ceb31e31cd'
            '99c279d04315c332a973a29b6ee540962364cd6d53cdaafc4055b3e1973e20da'
            '65a560566db10e11bb1114805a653feaa40f4ff3775ac7e5f84d956deee2ed0a'
            '6c3781e13d3e8343aa2435bdb78d2e2666891154c7abd847388e5331e0424edb'
            'cb1116c783995b8187574f84acb8365681aedaa2c76222cf060d31fedcb063c4'
            '3ea006eafe4cee790955024faca3b3d7ac6cd6968b50635b9da3c254a07f4791')
validpgpkeys=('318C679D94F17700CC847DE646A70073E4E50D4E') # Ruben Rodriguez

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

  patch -Np1 -i ../deny_missing_docs.patch

  patch -Np1 -i ../fix-double-definition-of-gettid.patch

  # needed for 60.7-esr
  export CXXFLAGS="$CXXFLAGS -fpermissive"

  # Patch to move files directly to /usr/lib/icecat. No more symlinks.
  sed -e 's;$(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME);g' -i config/baseconfig.mk
  sed -e 's;$(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION);$(libdir)/$(MOZ_APP_NAME)-devel;g' -i config/baseconfig.mk

  cat >.mozconfig <<END
ac_add_options --enable-application=browser

ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-linker=gold
ac_add_options --enable-hardening
ac_add_options --enable-optimize
# Bug 1521249 --enable-rust-simd fails to build using Rust 1.33
# https://bugzilla.mozilla.org/show_bug.cgi?id=1521249
#ac_add_options --enable-rust-simd

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

# System libraries
ac_add_options --enable-system-ffi
ac_add_options --enable-system-sqlite
ac_add_options --with-system-bz2
ac_add_options --with-system-icu
ac_add_options --with-system-jpeg
# FIXME: firefox does currently not build against libvpx-1.8.0
# ac_add_options --with-system-libvpx
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-zlib

# Features
ac_add_options --enable-alsa
ac_add_options --enable-jack
ac_add_options --enable-startup-notification
ac_add_options --disable-crashreporter
ac_add_options --disable-gconf
ac_add_options --disable-updater
ac_add_options --disable-eme

# broken by rust-1.38 in esr60
ac_add_options --disable-stylo
END

  if [[ $CARCH = arm* ]]; then
    sed -i '/--enable-linker=gold/d' .mozconfig
    sed -i '/--enable-rust-simd/d' .mozconfig

    # https://bugzilla.mozilla.org/show_bug.cgi?id=1463035
    patch -Np1 -i "$srcdir"/mozilla-1463035.patch

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

  if [[ $CARCH = i686 ]]; then
    sed -i '/--enable-linker=gold/d' .mozconfig
  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

  # Load our searchplugins
  rm -r -- browser/locales/searchplugins
  cp -aT -- /usr/lib/mozilla/searchplugins browser/locales/searchplugins
  patch -Np1 -i "$srcdir/libre-searchengines.patch"
}

build() {
  cd "$srcdir/$pkgname-${pkgver%_*}"
  export MOZ_NOSPAM=1
  export MOZBUILD_STATE_PATH="$srcdir/mozbuild"

  if [[ $CARCH = armv7h ]]; then
    export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off"
    export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  fi

  if [[ $CARCH = i686 ]]; then
    export RUSTFLAGS+=" -Cdebuginfo=0 -Clto=off"
    export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  fi

  # LTO needs more open files
  ulimit -n 4096

  ./mach build
  ./mach buildsymbols
}

package() {
  local _icu_ver
  _icu_ver=$(pacman -S --print-format='%v' icu)
  depends+=("icu>=${_icu_ver}" "icu<$((${_icu_ver%%.*} + 1))")

  cd "$srcdir/$pkgname-${pkgver%_*}"
  DESTDIR="$pkgdir" ./mach 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.requested", "");

// Use system-provided dictionaries
pref("spellchecker.dictionary_path", "/usr/share/hunspell");

// 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

  install -m755 -d ${pkgdir}/usr/share/applications
  install -m755 -d ${pkgdir}/usr/share/pixmaps

  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"

  # 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"
}