summaryrefslogtreecommitdiff
path: root/libre/icedove/PKGBUILD
blob: 8d5afb25cb6921a9b15b106721f1621e3e04abe3 (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
# Maintainer (Arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
# 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
replaces=("$_pkgname")
pkgver=68.1.0
pkgrel=1
pkgrel+=.parabola1
_brandingver=60.5
_brandingrel=1
pkgdesc="Libre standalone mail and news reader based on Mozilla Thunderbird"
url="https://wiki.parabola.nu/$pkgname"
arch=(x86_64)
arch+=(i686 armv7h)
license=(MPL GPL LGPL)

depends=(gtk3 mozilla-common libxt startup-notification mime-types dbus-glib alsa-lib
         nss hunspell sqlite ttf-font icu)  # libvpx
makedepends=(unzip zip diffutils python python2 yasm nasm mesa imake libpulse inetutils xorg-server-xvfb
             autoconf2.13 rust clang llvm gtk2 cbindgen nodejs)
makedepends+=(quilt mozilla-searchplugins python2-blessings imagemagick)
optdepends=('libcanberra: sound support')
options=(!emptydirs !makeflags)
source=(https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/$pkgver/source/thunderbird-$pkgver.source.tar.xz{,.asc}
        $pkgname.desktop
        https://repo.parabola.nu/other/icedove/${pkgname}_$_brandingver-$_brandingrel.branding.tar.xz{,.sig}
        libre-searchengines.patch)
sha256sums=('de0e5c7d1d5576f451e386e4779f155b7af97621a4e22caac0c6dee3c9d76eef'
            'SKIP'
            'af8199a12ebe09189d143458bd1e2d0071aff3410ed121dc2329a448a56632f0'
            '590862b39ba7baf60e47240e33de5839a8e85b6831c839ea57481968c9020241'
            'SKIP'
            '9ef9dd18ac1f76ccc3d5d2ace866bb40199fd00a1192da83aef376c585be2ec3')
validpgpkeys=(14F26682D0916CDD81E37B6D61B7B526D98F0353) # Mozilla Software Releases <release@mozilla.com>
validpgpkeys+=(BFA8008A8265677063B11BF47171986E4B745536) # Andreas Grapentin

prepare() {
  cd $_pkgname-$pkgver

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

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
# https://bugzilla.mozilla.org/show_bug.cgi?id=1521249
#ac_add_options --enable-rust-simd
# https://bugzilla.mozilla.org/show_bug.cgi?id=1423822
ac_add_options --disable-elf-hack

# Branding
ac_add_options --disable-official-branding
ac_add_options --with-branding=comm/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
# FIXME: does not build against libvpx-1.8.0 or libvpx-1.8.1
# 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-gconf
# tests require network access.
ac_add_options --disable-tests
END

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

  if [[ $CARCH = i686 ]]; then
    sed -i 's/--enable-linker=gold/--enable-linker=bfd/' .mozconfig
  fi

  # perform rebranding
  local brandingdir="$srcdir/$pkgname-$_brandingver"
  rm -rf -- comm/mail/branding/$pkgname
  cp -aT -- $brandingdir/$pkgname-branding/ comm/mail/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

  # produce icons
  for i in 16 22 24 32; do
    rsvg-convert -w $i -h $i "$brandingdir/app-icons/${pkgname}_small.svg" \
      -o "comm/mail/branding/$pkgname/default$i.png"
  done
  for i in 48 64 128 256; do
    rsvg-convert -w $i -h $i "$brandingdir/app-icons/${pkgname}_big.svg" \
      -o "comm/mail/branding/$pkgname/default$i.png"
  done
  cp "$brandingdir/logo/icedove_icon.svg" "comm/mail/branding/$pkgname/"

  # Patch and remove anything that's left
  patch -Np1 -i "$srcdir/libre-searchengines.patch"
  sed -i '\|Phishing Protection|d
          \|UrlClassifier|d
          \|URLClassifier|d
          \|url-classifier|d
         ' comm/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;
         ' comm/mail/app/profile/all-thunderbird.js

  cp -av $srcdir/$pkgname-$_brandingver/preview.png \
    comm/mail/themes/linux/mail/preview.png

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

build() {
  cd $_pkgname-$pkgver

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

  if [[ $CARCH = i686 ]]; then
    sed -i 's/\(cargo_rustc_flags += -C lto\)/#\1/' config/rules.mk
    export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  fi

  ./mach configure
  ./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 $_pkgname-$pkgver
  DESTDIR="$pkgdir" ./mach 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.requested", "");

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

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

// TODO: this "whats new" page should be in the branding package or abslibre
// 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 comm/mail/branding/$pkgname/default${i}.png \
      "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  done
  install -Dm644 comm/mail/branding/$pkgname/${pkgname}_icon.svg \
    "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.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"
}

# vim:set sw=2 et: