summaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 1e804492132d95dd2eb8b97bf8389fe5a4b3cca0 (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
# $Id$
# Maintainer (Arch): Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor (Arch): Ionut Biru <ibiru@archlinux.org>
# Contributor (Arch): Jakub Schmidtke <sjakub@gmail.com>
# Maintainer: Andreas Grapentin <andreas@grapentin.org>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor (ConnochaetOS): Henry Jensen <hjensen@connochaetos.org>
# Contributor: Luke Shumaker <lukeshu@sbcglobal.net>
# Contributor: fauno <fauno@kiwwwi.com.ar>
# Contributor: vando <facundo@esdebian.org>
# Contributor: Figue <ffigue at gmail>
# Contributor: taro-k <taro-k@movasense_com>
# Contributor: Michał Masłowski <mtjm@mtjm.eu>
# Contributor: Luke R. <g4jc@openmailbox.org>
# Contributor: Isaac David <isacdaavid@isacdaavid.info>
# Contributor: bill-auger <bill-auger@programmer.net>
# Contributor: evr <evanroman at gmail>
# Contributor: Muhammad 'MJ' Jassim <UnbreakableMJ@gmail.com>

# parabola changes and rationale:
#  - rebranded to iceweasel
#  - removed google api keys and usage
#  - removed use of firefox-symbolic.svg
#  - added makedepends: mozilla-searchplugins, quilt, libxslt, imagemagick
#  - added replaces, conflicts: firefox

_pkgname=firefox
pkgname=iceweasel
pkgver=59.0.2
pkgrel=2
_bver=59.0
_brel=1
pkgdesc="Libre standalone web browser based on Mozilla Firefox"
arch=(x86_64)
arch+=(i686 armv7h)
license=(MPL GPL LGPL)
url="https://wiki.parabola.nu/$pkgname"
depends=(gtk3 mozilla-common libxt startup-notification mime-types dbus-glib ffmpeg
         nss hunspell sqlite ttf-font libpulse libvpx icu)
makedepends=(unzip zip diffutils python2 yasm mesa imake gconf inetutils xorg-server-xvfb
             autoconf2.13 rust mercurial clang llvm jack gtk2)
makedepends+=(mozilla-searchplugins quilt libxslt imagemagick)
optdepends=('networkmanager: Location detection via available WiFi networks'
            'libnotify: Notification integration'
            'pulseaudio: Audio support'
            'speech-dispatcher: Text-to-Speech')
options=(!emptydirs !makeflags !strip)
replaces=("$_pkgname")
conflicts=("$_pkgname")
# https://archive.mozilla.org/pub/firefox/releases/$pkgver/SOURCE
_commit=c61f5f5ead48c78a80c80db5c489bdc7cfaf8175
source=(firefox-$pkgver.tar.bz::https://hg.mozilla.org/releases/mozilla-release/archive/$_commit.tar.bz2
        $pkgname.desktop
        no-crmf.diff)
source+=(https://repo.parabola.nu/other/iceweasel/${pkgname}_$_bver-$_brel.branding.tar.xz{,.sig}
         libre.patch
         vendor.js)
sha256sums=('fb5ff29e2bc68fa5ebb8bd8c800b597fcb2dd5820899aef3372380c99a0acec6'
            'ed350ef2f528b999a621f7080fa80948be6b351e67ce32529fb32bcf47bb21fa'
            '02000d185e647aa20ca336e595b4004bb29cdae9d8f317f90078bdcc7a36e873'
            '7ee098251254cbfbcdf78463d3af95089e38d7942a5c7936dacbcf0c5fb1c5b8'
            'SKIP'
            'ec074da734d847dbd1b93e980304d0a26a2c07232b388322c81235a0e5856887'
            'e52b4c71e556db00200a488e17e2611babf4b5537e75a3781602e06fb1e8532a')
validpgpkeys=('BFA8008A8265677063B11BF47171986E4B745536') # Andreas Grapentin

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

  cd mozilla-release-$_commit

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

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

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-rust-simd

# Branding
ac_add_options --disable-official-branding
ac_add_options --with-branding=browser/branding/iceweasel
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=nu.parabola
export MOZ_TELEMETRY_REPORTING=0
export MOZ_ADDON_SIGNING=0
export MOZ_REQUIRE_SIGNING=0

# 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-jack
ac_add_options --enable-startup-notification
ac_add_options --disable-crashreporter
ac_add_options --disable-eme
ac_add_options --disable-stylo
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --disable-webrtc
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-elf-hack
ac_add_options --enable-optimize="-g -O2 -fno-schedule-insns"
END
  fi

  # perform rebranding
  local brandingdir="$srcdir/$pkgname-$_bver"
  mkdir -v browser/branding/$pkgname
  cp -va $brandingdir/branding/* browser/branding/$pkgname

  export QUILT_PATCHES=$brandingdir/patches
  export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
  export QUILT_DIFF_ARGS='--no-timestamps'
  quilt push -av

  # Put "Start Page" branding images in the source code
  install -m644 "$brandingdir/branding/"{drm-free,gnu_headshadow,parabola-banner}.png \
    browser/base/content/abouthome
  install -m644 "$brandingdir/branding/watermark.svg"       \
    browser/extensions/onboarding/content/img

  # produce icons
  for i in 128; do
    rsvg-convert -w $i -h $i "$srcdir/$pkgname-$_bver/branding/${pkgname}_icon.svg" \
      -o "browser/branding/iceweasel/default$i.png"
  done

  # Patch and remove anything that's left
  patch -Np1 -i "$srcdir/libre.patch"
  sed -i 's|Adobe Flash|SWF Player|g;
         ' browser/base/content/pageinfo/permissions.js \
           browser/base/content/browser-plugins.js
  sed -i '\|["]displayName["][:] ["]Flash["]| s|Flash|SWF Player|
          \|["]displayName["][:] ["]Shockwave["]| s|Shockwave|DCR Player|
          \|["]displayName["][:] ["]QuickTime["]| s|QuickTime|MOV Player|
          \|installLinux| s|true|false|
         ' browser/base/content/browser-plugins.js

  # replace newtab page with abouthome
  #cat browser/base/content/abouthome/aboutHome.xhtml > browser/base/content/newtab/newTab.xhtml

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

  # Disable various components at the source level
  sed -i 's|[;]1|;0|' toolkit/components/telemetry/TelemetryStartup.manifest || die "failed break telemetry startup"
  sed -i 's|[;]1|;0|' browser/experiments/Experiments.manifest || die "failed to break ExperimentsService"
  sed -i '/pocket/d' browser/extensions/moz.build || die "failed to wipe pocket"
  sed -i '/activity-stream/d' browser/extensions/moz.build || die "failed to wipe activity-stream"
}

build() {
  cd mozilla-release-$_commit

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

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

  # Do PGO
  #xvfb-run -a -n 95 -s "-extension GLX -screen 0 1280x1024x24" \
  #  MOZ_PGO=1 ./mach build
  ./mach build
  ./mach buildsymbols
}

package() {
  cd mozilla-release-$_commit
  DESTDIR="$pkgdir" ./mach install
  find . -name '*crashreporter-symbols-full.zip' -exec cp -fvt "$startdir" {} +

  install -Dm644 "$srcdir/vendor.js" "$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
  local shortver=$(echo $pkgver | cut -d'.' -f1,2)
  sed -i "s/@PKGVER@/$shortver/g" "$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"

  _distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  install -Dm644 /dev/stdin "$_distini" <<END
[Global]
id=parabola
version=1.0
about=Iceweasel 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 64 128 192 256 384; do
    rsvg-convert -w $i -h $i "$srcdir/$pkgname-$_bver/branding/${pkgname}_icon.svg" \
      -o "browser/branding/iceweasel/default$i.png"
    install -Dm644 "browser/branding/iceweasel/default$i.png" \
      "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  done

  install -Dm644 "$srcdir/$pkgname-$_bver/branding/${pkgname}_icon.svg" \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"

  install -Dm644 ../$pkgname.desktop \
    "$pkgdir/usr/share/applications/$pkgname.desktop"

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