summaryrefslogtreecommitdiff
path: root/nonprism/icedove/PKGBUILD
blob: 733c3e8c953d744d967e8d8ba54bb41bb267f874 (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
# Maintainer: Andreas Grapentin <andreas@grapnentin.org>
# Contributor: André Silva <emulatorman@riseup.net>
# Contributor: Márcio Silva <coadde@riseup.net>
# Contributor: Luke R. <g4jc@openmailbox.org>
# Contributor: Isaac David <isacdaavid@isacdaavid.info>

_oldname=thunderbird
pkgname=icedove

epoch=1
pkgver=52.1.1
pkgrel=2.nonprism1
_brandingver=52.1
_brandingrel=1

arch=(i686 x86_64 armv7h)

pkgdesc="Icedove, the libre standalone mail and news reader based on Mozilla Thunderbird, without support for unsafe and dangerous for privacy protocols"
url="https://wiki.parabola.nu/$pkgname"
license=(MPL GPL LGPL)

depends=(alsa-lib dbus-glib gtk2 gtk3 hunspell icu=59.1 libevent libvpx libxt mime-types mozilla-common nss sqlite startup-notification ttf-font)
makedepends=(autoconf2.13 diffutils gconf imake inetutils libpulse mesa mozilla-searchplugins pkg-config python2 quilt unzip yasm zip)
makedepends_i686=(cargo)
makedepends_x86_64=("${makedepends_i686[@]}")
optdepends=('libcanberra: for sound support')

replaces=("$pkgname-libre" "$_oldname")
conflicts=("$pkgname-libre" "$_oldname")
provides=("$_oldname")

options=(!emptydirs !makeflags)

install=$pkgname.install

_parabolarepo=https://repo.parabola.nu/other/icedove

source=("https://ftp.mozilla.org/pub/$_oldname/releases/$pkgver/source/$_oldname-$pkgver.source.tar.xz"
        "$_parabolarepo/${pkgname}_$_brandingver-$_brandingrel.branding.tar.xz"
        "$_parabolarepo/${pkgname}_$_brandingver-$_brandingrel.branding.tar.xz.sig"
        mozconfig
        $pkgname.desktop
        $pkgname-install-dir.patch
        changing-the-default-search-engine.patch
        vendor.js
        rust-fix-rusty-cheddar-crate-setup.patch
        rust-target-i586-to-i686.patch
        libre-searchengines.patch
        no-neon.patch)
sha256sums=('88211d0d57dfdae9232617244f9c5406520a538e9e7be6ceec79fdfed175ba84'
            '246418976524fbead5b99e6227f97322f8d4c45e0edf9ce75561ae8eccdefc65'
            'SKIP'
            'd552b793e17fb1c09637d6fdf4680eee32b849941f7181d104e42fbe17e5d593'
            '0b0d25067c64c6b829c84e5259ffca978e3971f85acc8483f47bdbed5b0b5b6a'
            '36e0a5ac0e994bfc939b4ac69a1a4aa365210e9dd5b49317d647c683817b2c5d'
            'ff3474b7d8f7ad245a324c14f01daf05834462b4f0144fbc50f055ebb573dac8'
            '058b58074368b57acf8a6df9a9ffac848b7d7b39f5abd84cb2039bcee42b73e2'
            'e03cdc40e4ea39560aa230ef7a9c494f3a343c0feb8f43b68a47769f88f6b315'
            '069fab4b99dd51d7d004124d0052ea7b864cf060ea943348d290ba6aae50b0ab'
            '0db12bef46e0ad68dbdf6ce0c767956d6758b073531012a850e7975eda3fc7fe'
            '59f40d8b2480aa67bf76f4f119826b6828a6a59cc040caf1ab5a6e19eef44c6e')
validpgpkeys=(
              'BFA8008A8265677063B11BF47171986E4B745536' # Andreas Grapentin
)

prepare() {
  cd "$srcdir/$_oldname-$pkgver"

  local brandingdir="$srcdir/$pkgname-$_brandingver"

  # prepare branding for icedove
  mkdir -v mail/branding/$pkgname

  # copy the branding filev
  cp -va $brandingdir/$pkgname-branding/* mail/branding/$pkgname

  # patch
  export QUILT_PATCHES=$brandingdir/patches
  export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
  export QUILT_DIFF_ARGS='--no-timestamps'

  quilt push -av

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

  # install to /usr/lib/icedove
  patch -Np1 -i "$srcdir/$pkgname-install-dir.patch"

  # fix rust build
  patch -Np1 -i "$srcdir/rust-fix-rusty-cheddar-crate-setup.patch"
  patch -Np1 -i "$srcdir/rust-target-i586-to-i686.patch"

  # fix freedom issues
  patch -Np1 -i "$srcdir/libre-searchengines.patch"

  # Remove url-classifier from package-manifest.in to build and disable Phishing Protection
  sed -i '\|Phishing Protection|d
          \|UrlClassifier|d
          \|URLClassifier|d
          \|url-classifier|d
         ' mail/installer/package-manifest.in

  # Replace common URLs
  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

  # Remove support for unsafe and dangerous for privacy protocols
  sed -i '\|facebook|d
          \|gtalk|d
          \|odnoklassniki|d
          \|twitter|d
          \|yahoo|d
         ' chat/moz.build
  sed -i '\|facebook[.]js|d
          \|facebook[.]manifest|d
          \|gtalk[.]js|d
          \|gtalk[.]manifest|d
          \|twitter[.]js|d
          \|twitter[.]manifest|d
          \|yahoo[.]js|d
          \|yahoo[.]manifest|d
         ' mail/installer/package-manifest.in
  rm -rv chat/protocols/{facebook,gtalk,twitter,yahoo}

  cp -v "$srcdir/mozconfig" .mozconfig

  # make sure we use python2
  mkdir "$srcdir/path"
  ln -s /usr/bin/python2 "$srcdir/path/python"

  # Change the default search engine using our system-provided searchplugins
  patch -Np1 -i "$srcdir/changing-the-default-search-engine.patch"

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

  # ARM-specific changes:
  if [[ "$CARCH" == arm* ]]; then
    # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850984
    sed -i 's/\^\[:space:\]\*/^[[:space:]]*/' mozilla/{,js/src/}configure

    patch -Np0 -i ../no-neon.patch
    patch -p2 -d mozilla < ../mozilla-1253216.patch
    sed -i '/ac_add_options --enable-gold/d' .mozconfig
    cat >> .mozconfig <<- EOF
	ac_add_options --disable-elf-hack
	ac_add_options --disable-neon
	ac_add_options --disable-ion
	ac_add_options --disable-webrtc
	ac_add_options --disable-debug
	ac_add_options --disable-debug-symbols
	EOF
  fi
}

build() {
  cd "$srcdir/$_oldname-$pkgver"

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

  # Hardening
  LDFLAGS+=" -Wl,-z,now"

  # GCC 6
  CFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
  CXXFLAGS+=" -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"

  export PATH="$srcdir/path:$PATH"
  export PYTHON="/usr/bin/python2"

  make -f client.mk build
}

package() {
  cd "$srcdir/$_oldname-$pkgver"

  make -f client.mk DESTDIR="$pkgdir" INSTALL_SDK= install

  install -Dm644 ../vendor.js "$pkgdir/usr/lib/$pkgname/defaults/preferences/vendor.js"

  local brandingdir="$srcdir/$pkgname-$_brandingver"

  # Install Icedove menu icon
  install -Dm644 $brandingdir/$pkgname.xpm "$pkgdir/usr/share/pixmaps/$pkgname.xpm"

  # Install Icedove icons
  local icondir="$pkgdir/usr/share/icons/hicolor"
  for i in 16 22 24 32 48 64 128 256; do
    install -Dm644 "$brandingdir/app-icons/$pkgname$i.png" \
      "$icondir/${i}x${i}/apps/$pkgname.png"
  done
  install -Dm644 "$brandingdir/app-icons/${pkgname}big.svg" \
    "$icondir/scalable/apps/$pkgname.svg"

  # Install Icedove desktop
  install -d "$pkgdir/usr/share/applications"
  install -m644 "$srcdir/$pkgname.desktop" \
    "$pkgdir/usr/share/applications"

  # Use system-provided dictionaries
  rm -rf "$pkgdir/usr/lib/$pkgname/"{dictionaries,hyphenation}
  ln -s /usr/share/hunspell "$pkgdir/usr/lib/$pkgname/dictionaries"
  ln -s /usr/share/hyphen   "$pkgdir/usr/lib/$pkgname/hyphenation"

  # Replace duplicate binary with symlink
  # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  ln -sf $pkgname "$pkgdir/usr/lib/$pkgname/$pkgname-bin"
}