PKGBUILD 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. # Maintainer (Arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
  2. # Contributor (Arch): Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
  3. # Contributor (Arch): Ionut Biru <ibiru@archlinux.org>
  4. # Contributor (Arch): Alexander Baldeck <alexander@archlinux.org>
  5. # Contributor (Arch): Dale Blount <dale@archlinux.org>
  6. # Contributor (Arch): Anders Bostrom <anders.bostrom@home.se>
  7. # Maintainer: Andreas Grapentin <andreas@grapentin.org>
  8. # Contributor: André Silva <emulatorman@hyperbola.info>
  9. # Contributor: Márcio Silva <coadde@hyperbola.info>
  10. # Contributor: Luke R. <g4jc@openmailbox.org>
  11. # Contributor: Isaac David <isacdaavid@isacdaavid.info>
  12. # Contributor: bill-auger <bill-auger@programmer.net>
  13. # parabola changes and rationale:
  14. # - rebranded to icedove
  15. # - added makedepends: quilt mozilla-searchplugins python2-blessings
  16. # - added replaces, conflicts: thunderbird
  17. # - disabled tests, they break in an environment without network access.
  18. # - disabled geo-location
  19. _pkgname=thunderbird
  20. pkgname=icedove
  21. replaces=("$_pkgname")
  22. epoch=1
  23. pkgver=68.9.0
  24. pkgrel=1
  25. pkgrel+=.parabola1
  26. _brandingver=68.6
  27. _brandingrel=1
  28. pkgdesc='Standalone mail and news reader based on Mozilla Thunderbird'
  29. url="https://wiki.parabola.nu/$pkgname"
  30. arch=(x86_64)
  31. arch+=(i686 armv7h)
  32. license=(MPL GPL LGPL)
  33. depends=(gtk3 libxt startup-notification mime-types dbus-glib alsa-lib
  34. nss hunspell sqlite ttf-font) # libvpx
  35. depends+=(libicui18n.so libicuuc.so)
  36. makedepends=(unzip zip diffutils python python2 yasm nasm mesa imake libpulse inetutils xorg-server-xvfb
  37. autoconf2.13 rust clang llvm gtk2 cbindgen nodejs)
  38. makedepends+=(quilt mozilla-searchplugins imagemagick)
  39. optdepends=('libcanberra: sound support')
  40. options=(!emptydirs !makeflags)
  41. source=(https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/$pkgver/source/thunderbird-$pkgver.source.tar.xz{,.asc}
  42. $pkgname.desktop)
  43. source+=(https://repo.parabola.nu/other/icedove/${pkgname}_$_brandingver-$_brandingrel.branding.tar.xz{,.sig}
  44. libre-searchengines.patch
  45. mozilla-1338795-regression.patch)
  46. source_armv7h=(arm-wasm-vfp.patch)
  47. sha512sums=('891472c95ba6ff46061131504e89010da512a84b0e1dea0482e603fd4c87f11e099280a245c7dd9fc9320c48229c26602565c089d86f1a1f4271b29b6fc606f0'
  48. 'SKIP'
  49. 'a3c9815491d9bed0440c60f35867a5b8a2a1343521f288035fcc46e651a11b926c75a9eca2d262b43d510a7a7119709b53637f1b00ddbbee8e5b0a4b33d7b8fd'
  50. '5784493253f9b2b231a7f18d7c3c4a4bb9aec7ac4fa801772ac223342676e388ae0c094b95d89d92c1bd38c2f19feb6f51e074d0ea20228a256b6240ecf34832'
  51. 'SKIP'
  52. '3f3160441aa17a50b8bf9f95a0fed8e3428864901d7368409903289f069f51fa94e24b6140bf17981b91b55df77c7c29adb870dda9f1596a77ce1a54a62cac00'
  53. 'f4e892fc7af85877ef6cedd82313f6c0f335cb676cfb30badaa127c51aed00773212b99f1598f5709d6f481f12264463d6334bcde8e8da38ec1ea666622d28a1')
  54. sha512sums_armv7h=('c25883c4860e511a99d9fbfba5b824145c0862729101721605725f609ca2a41848b741dd100eff390f57031dc5f14af3ea30133de30f75cb20197c420ae20972')
  55. validpgpkeys=(14F26682D0916CDD81E37B6D61B7B526D98F0353) # Mozilla Software Releases <release@mozilla.com>
  56. validpgpkeys+=(BFA8008A8265677063B11BF47171986E4B745536) # Andreas Grapentin
  57. prepare() {
  58. cd $_pkgname-$pkgver
  59. # see: https://labs.parabola.nu/issues/2267
  60. # upstream BR: https://bugzilla.mozilla.org/show_bug.cgi?id=1628296
  61. patch -Np1 -i "$srcdir"/mozilla-1338795-regression.patch
  62. cat >.mozconfig <<END
  63. ac_add_options --enable-application=comm/mail
  64. ac_add_options --enable-calendar
  65. ac_add_options --prefix=/usr
  66. ac_add_options --enable-release
  67. ac_add_options --enable-linker=gold
  68. ac_add_options --enable-hardening
  69. ac_add_options --enable-optimize
  70. # https://bugzilla.mozilla.org/show_bug.cgi?id=1521249
  71. #ac_add_options --enable-rust-simd
  72. # https://bugzilla.mozilla.org/show_bug.cgi?id=1423822
  73. ac_add_options --disable-elf-hack
  74. # Branding
  75. ac_add_options --disable-official-branding
  76. ac_add_options --enable-update-channel=release
  77. ac_add_options --with-distribution-id=nu.parabola
  78. ac_add_options --with-branding=comm/mail/branding/icedove
  79. # System libraries
  80. ac_add_options --with-system-zlib
  81. ac_add_options --with-system-bz2
  82. ac_add_options --with-system-icu
  83. ac_add_options --with-system-jpeg
  84. # ac_add_options --with-system-libvpx
  85. ac_add_options --with-system-nspr
  86. ac_add_options --with-system-nss
  87. ac_add_options --enable-system-sqlite
  88. ac_add_options --enable-system-ffi
  89. # Features
  90. ac_add_options --enable-alsa
  91. ac_add_options --disable-jack
  92. ac_add_options --enable-startup-notification
  93. ac_add_options --disable-crashreporter
  94. ac_add_options --disable-updater
  95. ac_add_options --disable-gconf
  96. # tests require network access.
  97. ac_add_options --disable-tests
  98. END
  99. if [[ $CARCH = arm* ]]; then
  100. patch -Np1 -i "$srcdir"/arm-wasm-vfp.patch
  101. sed -i '/--enable-linker=gold/d' .mozconfig
  102. sed -i '/--enable-hardening/d' .mozconfig
  103. sed -i '/--enable-optimize/d' .mozconfig
  104. export MOZ_DEBUG_FLAGS=" "
  105. export CFLAGS+=" -g0"
  106. export CXXFLAGS+=" -g0"
  107. export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  108. export RUSTFLAGS="-Cdebuginfo=0"
  109. cat >> .mozconfig <<END
  110. ac_add_options --disable-webrtc
  111. ac_add_options --disable-elf-hack
  112. ac_add_options --enable-optimize="-g0 -O2"
  113. END
  114. fi
  115. if [[ $CARCH = i686 ]]; then
  116. sed -i 's/--enable-linker=gold/--enable-linker=bfd/' .mozconfig
  117. LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  118. export LDFLAGS
  119. fi
  120. # perform rebranding
  121. local brandingdir="$srcdir/$pkgname-$_brandingver"
  122. rm -rf -- comm/mail/branding/$pkgname
  123. cp -aT -- $brandingdir/$pkgname-branding/ comm/mail/branding/$pkgname
  124. export QUILT_PATCHES=$brandingdir/patches
  125. export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
  126. export QUILT_DIFF_ARGS='--no-timestamps'
  127. quilt push -av
  128. # produce icons
  129. for i in 16 22 24 32; do
  130. rsvg-convert -w $i -h $i "$brandingdir/app-icons/${pkgname}_small.svg" \
  131. -o "comm/mail/branding/$pkgname/default$i.png"
  132. done
  133. for i in 48 64 128 256; do
  134. rsvg-convert -w $i -h $i "$brandingdir/app-icons/${pkgname}_big.svg" \
  135. -o "comm/mail/branding/$pkgname/default$i.png"
  136. done
  137. cp "$brandingdir/logo/icedove_icon.svg" "comm/mail/branding/$pkgname/"
  138. # Patch and remove anything that's left
  139. patch -Np1 -i "$srcdir/libre-searchengines.patch"
  140. sed -i '\|Phishing Protection|d
  141. \|UrlClassifier|d
  142. \|URLClassifier|d
  143. \|url-classifier|d
  144. ' comm/mail/installer/package-manifest.in
  145. sed -i '\|extensions[.]getAddons[.]get[.]url| s|https://services[.]addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
  146. \|extensions[.]getAddons[.]search[.]browseURL| s|https://addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
  147. \|extensions[.]getAddons[.]search[.]url| s|https://services[.]addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
  148. \|extensions[.]webservice[.]discoverURL| s|https://services[.]addons[.]mozilla[.]org.\+["][)][;]|https://directory.fsf.org/wiki/Icedove");|g;
  149. ' comm/mail/app/profile/all-thunderbird.js
  150. cp -av $srcdir/$pkgname-$_brandingver/preview.png \
  151. comm/mail/themes/linux/mail/preview.png
  152. # Load our searchplugins
  153. rm -rv comm/suite/locales/en-US/searchplugins
  154. cp -av /usr/lib/mozilla/searchplugins comm/suite/locales/en-US/
  155. }
  156. build() {
  157. cd $_pkgname-$pkgver
  158. # clang-{9,10,11} -> error: unknown argument: '-fvar-tracking-assignments'
  159. CFLAGS="${CFLAGS/-fvar-tracking-assignments/}"
  160. CXXFLAGS="${CXXFLAGS/-fvar-tracking-assignments/}"
  161. case "${CARCH}" in
  162. armv*)
  163. export LDFLAGS+=" -Wl,--no-keep-memory -Wl,--reduce-memory-overheads"
  164. sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk
  165. sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure
  166. export MOZ_MAKE_FLAGS=-j1
  167. ;;
  168. i686)
  169. sed -i "s/\(cargo_rustc_flags += -C lto\)/#\1/" config/rules.mk
  170. sed -i "s/debug_info = '2'/debug_info = '1'/" build/moz.configure/toolchain.configure
  171. export MOZ_MAKE_FLAGS=-j1
  172. ;;
  173. esac
  174. ./mach configure
  175. ./mach build
  176. ./mach buildsymbols
  177. }
  178. package() {
  179. cd $_pkgname-$pkgver
  180. DESTDIR="$pkgdir" ./mach install
  181. _vendorjs="$pkgdir/usr/lib/$pkgname/defaults/preferences/vendor.js"
  182. install -Dm644 /dev/stdin "$_vendorjs" <<END
  183. // Use LANG environment variable to choose locale
  184. pref("intl.locale.requested", "");
  185. // Use system-provided dictionaries
  186. pref("spellchecker.dictionary_path", "/usr/share/hunspell");
  187. // Disable default mailer checking.
  188. pref("mail.shell.checkDefaultMail", false);
  189. // Don't disable our bundled extensions in the application directory
  190. pref("extensions.autoDisableScopes", 11);
  191. pref("extensions.shownSelectionUI", true);
  192. // Disable Social API for content
  193. pref("social.remote-install.enabled", false);
  194. pref("social.toast-notifications.enabled", false);
  195. // Make sure that whitelisted and directory installs are empty
  196. pref("social.whitelist", "");
  197. pref("social.directories", "");
  198. // Disable the GeoLocation API for content
  199. pref("geo.enabled", false);
  200. // TODO: this "whats new" page should be in the branding package or abslibre
  201. // Pointing the "Help -> What's new" menu entry to mozilla.debian.net
  202. //pref("mailnews.start_page.override_url", "http://wiki.debian.org/Icedove/WhatsNew45");
  203. END
  204. _distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  205. install -Dm644 /dev/stdin "$_distini" <<END
  206. [Global]
  207. id=parabola
  208. version=1.0
  209. about=Icedove for Parabola GNU/Linux-libre
  210. [Preferences]
  211. app.distributor=parabola
  212. app.distributor.channel=$pkgname
  213. app.partner.parabola=parabola
  214. END
  215. for i in 16 22 24 32 48 64 128 256; do
  216. install -Dm644 comm/mail/branding/$pkgname/default${i}.png \
  217. "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  218. done
  219. install -Dm644 comm/mail/branding/$pkgname/${pkgname}_icon.svg \
  220. "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"
  221. install -Dm644 ../$pkgname.desktop \
  222. "$pkgdir/usr/share/applications/$pkgname.desktop"
  223. # Use system-provided dictionaries
  224. ln -Ts /usr/share/hunspell "$pkgdir/usr/lib/$pkgname/dictionaries"
  225. ln -Ts /usr/share/hyphen "$pkgdir/usr/lib/$pkgname/hyphenation"
  226. # Install a wrapper to avoid confusion about binary path
  227. install -Dm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
  228. #!/bin/sh
  229. exec /usr/lib/$pkgname/$pkgname "\$@"
  230. END
  231. # Replace duplicate binary with wrapper
  232. # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  233. ln -srf "$pkgdir/usr/bin/$pkgname" \
  234. "$pkgdir/usr/lib/$pkgname/$pkgname-bin"
  235. }