summaryrefslogtreecommitdiff
path: root/libre/icedove/PKGBUILD
blob: 9229acde6b3f5e9be08e5fe13f3d5d6c052cbcc4 (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
258
259
260
# $Id$
# Contributor (Arch): Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor (Arch): Ionut Biru <ibiru@archlinux.org>
# Contributor (Arch): Alexander Baldeck <alexander@archlinux.org>
# Contributor (Arch): Dale Blount <dale@archlinux.org>
# Contributor (Arch): Anders Bostrom <anders.bostrom@home.se>
# Maintainer: Andreas Grapentin <andreas@grapentin.org>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: Luke R. <g4jc@openmailbox.org>
# Contributor: Isaac David <isacdaavid@isacdaavid.info>

# parabola changes and rationale:
#  - rebranded to icedove
#  - added makedepends: quilt mozilla-searchplugins python2-blessings
#  - added replaces, conflicts: thunderbird
#  - disabled tests, they break in an environment without network access.

_pkgname=thunderbird
pkgname=icedove
epoch=1
pkgver=52.7.0
pkgrel=5
_bver=52.1
_brel=1
pkgdesc="Libre standalone mail and news reader based on Mozilla Thunderbird"
arch=(x86_64)
arch+=(i686 armv7h)
license=(MPL GPL LGPL)
url="https://wiki.parabola.nu/$pkgname"
depends=(gtk3 gtk2 mozilla-common libxt startup-notification mime-types dbus-glib alsa-lib ffmpeg
         nss hunspell sqlite ttf-font icu libvpx)
depends+=('icu>=63' 'icu<64')
makedepends=(unzip zip diffutils python2 yasm mesa imake gconf libpulse inetutils xorg-server-xvfb
             autoconf2.13 rust clang llvm)
makedepends+=(quilt mozilla-searchplugins python2-blessings)
optdepends=('libcanberra: sound support')
replaces=("$_pkgname")
conflicts=("$_pkgname")
options=(!emptydirs !makeflags)
source=(https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/$pkgver/source/thunderbird-$pkgver.source.tar.xz
        $pkgname.desktop
        0001-Bug-1338655-Don-t-try-to-build-mp4parse-bindings.-r-.patch
        rust-i686.patch fix-wifi-scanner.diff
        $pkgname-install-dir.patch no-crmf.diff)
source+=(https://repo.parabola.nu/other/icedove/${pkgname}_$_bver-$_brel.branding.tar.xz{,.sig}
         libre.patch)
sha256sums=('82462890d393ed78c03226924a6166596b7b6d1562b5071e713a7558cd292ea3'
            'af8199a12ebe09189d143458bd1e2d0071aff3410ed121dc2329a448a56632f0'
            '413cd6d366d78f325d80ebebccfd0afa0d266b40b2e54b66ba2fa03c15f3ea67'
            'f61ea706ce6905f568b9bdafd1b044b58f20737426f0aa5019ddb9b64031a269'
            '9765bca5d63fb5525bbd0520b7ab1d27cabaed697e2fc7791400abc3fa4f13b8'
            'a3f2431a6e9eb01d3e20dfa5110e769180b4a752ea834c1162088aa90d99e8f3'
            'a7317caba56e89932bd9e3b9352d94701dd9a419685057f238b1ded8dc0adcd7'
            '246418976524fbead5b99e6227f97322f8d4c45e0edf9ce75561ae8eccdefc65'
            'SKIP'
            '4a09569394f1b4e154fdcd53f2947b7be7f065baaa31c964629dff9117fdf49b')
validpgpkeys=(BFA8008A8265677063B11BF47171986E4B745536) # Andreas Grapentin

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

  cd $_pkgname-$pkgver
  patch -Np1 -i ../$pkgname-install-dir.patch

  # https://bugzilla.mozilla.org/show_bug.cgi?id=1314968
  patch -d mozilla -Np1 < ../fix-wifi-scanner.diff

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

  # Build with the rust targets we actually ship
  patch -d mozilla -Np1 < ../rust-i686.patch

  # https://bugs.archlinux.org/task/53890
  patch -d mozilla -Np1 < ../0001-Bug-1338655-Don-t-try-to-build-mp4parse-bindings.-r-.patch

  cat >.mozconfig <<END
ac_add_options --enable-application=mail
ac_add_options --enable-calendar

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

# Branding
ac_add_options --disable-official-branding
ac_add_options --with-branding=mail/branding/icedove
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=nu.parabola

# 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 --disable-jack
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
ac_add_options --disable-tests
END

  if [[ "$CARCH" == arm* ]]; then
    sed -i \
        -e '/enable-gold/s/^/#/' \
        -e '/enable-pie/s/^/#/' \
        -e '/enable-optimize/s/^/#/' \
        -e '/enable-rust/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

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

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

  # Patch and remove anything that's left
  patch -Np1 -i "$srcdir/libre.patch"
  sed -i '\|Phishing Protection|d
          \|UrlClassifier|d
          \|URLClassifier|d
          \|url-classifier|d
         ' mail/installer/package-manifest.in
  sed -i '\|extensions[.]getAddons[.]get[.]url| s|https://services[.]addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
          \|extensions[.]getAddons[.]search[.]browseURL| s|https://addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
          \|extensions[.]getAddons[.]search[.]url| s|https://services[.]addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
          \|extensions[.]webservice[.]discoverURL| s|https://services[.]addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
         ' mail/app/profile/all-thunderbird.js

  for i in 16 22 24 32 48 64 128 256; do
    install -Dm644 $srcdir/$pkgname-$_bver/app-icons/$pkgname$i.png \
      mail/branding/$pkgname/mailicon$i.png
  done
  for i in 48 64; do
    install -Dm644 $srcdir/$pkgname-$_bver/app-icons/$pkgname$i.png \
      mail/branding/$pkgname/content/icon$i.png
  done
  cp -av $srcdir/$pkgname-$_bver/preview.png \
    mail/themes/linux/mail/preview.png

  # Load our searchplugins
  rm -rv mail/locales/en-US/searchplugins
  cp -av /usr/lib/mozilla/searchplugins mail/locales/en-US/
}

build() {
  cd $_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 $_pkgname-$pkgver
  make -f client.mk DESTDIR="$pkgdir" INSTALL_SDK= install

  _vendorjs="$pkgdir/usr/lib/$pkgname/defaults/preferences/vendor.js"
  install -Dm644 /dev/stdin "$_vendorjs" <<END
// Use LANG environment variable to choose locale
pref("intl.locale.matchOS", true);

// Disable default mailer checking.
pref("mail.shell.checkDefaultMail", false);

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

// Disable Social API for content
pref("social.remote-install.enabled", false);
pref("social.toast-notifications.enabled", false);

// Make sure that whitelisted and directory installs are empty
pref("social.whitelist", "");
pref("social.directories", "");

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

// Pointing the "Help -> What's new" menu entry to mozilla.debian.net
pref("mailnews.start_page.override_url", "http://wiki.debian.org/Icedove/WhatsNew45");
END

  _distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  install -Dm644 /dev/stdin "$_distini" <<END
[Global]
id=parabola
version=1.0
about=Icedove 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 256; do
    install -Dm644 "$srcdir/$pkgname-$_bver/app-icons/$pkgname$i.png" \
      "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  done
  install -Dm644 "$srcdir/$pkgname-$_bver/app-icons/${pkgname}big.svg" \
    "$pkgdir/usr/share/icons/hicolor/scalable/apps/$pkgname.svg"
  install -Dm644 $srcdir/$pkgname-$_bver/$pkgname.xpm \
    "$pkgdir/usr/share/pixmaps/$pkgname.xpm"


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