PKGBUILD 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. # Maintainer (arch): Eli Schwartz <eschwartz@archlinux.org>
  2. # Maintainer (arch): Jonas Witschel <diabonas@archlinux.org>
  3. # Contributor: Daniel Landau <daniel.landau@iki.fi>
  4. # Contributor: Einhard Leichtfuß <alguien@respiranto.de>
  5. # Contributor: Xyne
  6. # Contributor: David Manouchehri <d@32t.ca>
  7. # Contributor: Alexander Fehr <pizzapunk gmail com>
  8. # Contributor: Thomas Jost <schnouki schnouki net>
  9. # Contributor: Hinrich Harms <arch hinrich de>
  10. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  11. # parabola changes and rationale:
  12. # * replace 'thunderbird' dependency with 'icedove'
  13. # * apply dependency version constraints
  14. # * allow building arch-specific packages (different version constraints)
  15. # * pin to strongly-coupled dependency versions
  16. _pkgname=thunderbird-extension-enigmail
  17. pkgname=icedove-extension-enigmail
  18. pkgver=2.1.7
  19. pkgrel=3
  20. pkgrel+=.parabola3
  21. _icedove_epoch=1
  22. pkgdesc="OpenPGP message encryption and authentication for Icedove"
  23. arch=(armv7h i686 x86_64) # this could be an 'any' package; but arches roll at different speeds
  24. url="https://www.enigmail.net/"
  25. license=('MPL' 'GPL3')
  26. depends=('gnupg' 'icedove')
  27. makedepends=('zip' 'python' 'perl')
  28. replaces=($_pkgname)
  29. source=("https://www.enigmail.net/download/source/enigmail-${pkgver}.tar.gz"{,.asc}
  30. "0001-preferences-disable-pEpAutoDownload-by-default.patch"
  31. "0001-Disable-Thunderbird-78-upgrade-warning-message.patch"
  32. "0001-genxpi-make-XPI-files-reproducible.patch")
  33. sha512sums=('1b57091c8ab9aaa086f327b78d904d688c850b6d39e37e2dac82e0629c0279723eae4608ecd08a24efe9ed1bdc86fbc497e97cd800c7349a70612a42b98f3e41'
  34. 'SKIP'
  35. 'baebd963400574db89be747a4419534f945bdc64136d4014656ff98a9615a23984bca724da3f3840670979aab08ce441eee067921e21d0cb216938a20ed785b2'
  36. '4ddf887765e4296b3c639748d875b179d1e2a5fb38ad16e2918f115a9ff9a05e2f9c66218544f7ab8189f096908df761d4047fd5d23972c02737e46c4a0c843c'
  37. '3902e09d801f8a3fd493450a85c23d3cd95c68465df0025599e6c923b9708a6cb0cb09920170ec5055d55a56e287ae468460fca150f7be8af9d83cffa1a40427')
  38. b2sums=('8f6d1ec16b48219c75c6dbcddf4807ed57965eeec29776e7c757d5aa34da6bfdbbb58964ee3d7de2efcb65ab69fa5b020f1a8ec01cd8eee662d8195a217cdc69'
  39. 'SKIP'
  40. 'c593ed7b094d9feecb2f14624cf0628ab390c96f0fb0212ab0069333508b59057ef4b0518da1bf59eb8aaf0942303c4c45afab76d0b8e77a93763eab975cb4c0'
  41. 'a2ba38e56f14a87834023076a75a6c59bc17488104227d8db3e31072f2dcc6488808a980b4073111dec4cf4661349c3e995b8226808c3038d96f2cab666eb90b'
  42. '55709a3fd099fab4b11289518a44f2b53e81031606529cec5b4786e796de438faefa52f2a7ab3d29d6b3aca120e279f30d6d7ba3c3e3d02ca2abcb85f1652661')
  43. validpgpkeys=('4F9F89F5505AC1D1A260631CDB1187B9DD5F693B') # Patrick Brunschwig <patrick@enigmail.net>
  44. _version_constraint() # (dep_pkgname [precision])
  45. {
  46. Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }
  47. local dep_pkgname=$1
  48. declare -i req_precision=$2
  49. local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
  50. local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  51. local def_precision=$(( n_dots + 1 ))
  52. local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
  53. local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
  54. local pkgver_rx='[0-9A-Za-z_]+'
  55. pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
  56. # but some pkgver have it (eg: 5.15.10+kde+r130)
  57. local subver_rx='\.'${pkgver_rx}
  58. local pkgrel_rx='[0-9]+'
  59. local garbage_rx='[^0-9].*'
  60. local capture_rx=${pkgver_rx}
  61. for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
  62. local version pkgrel has_dot_char version_min version_max constraint_string
  63. declare -i subver subver_inc pkgrel_inc
  64. if [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
  65. then version=${BASH_REMATCH[1]} # pkgver cut to the requested precision
  66. #unused=${BASH_REMATCH[2]} # discarded pkgver segments
  67. pkgrel=${BASH_REMATCH[3]} # pkgrel with non-numerics right-trimmed
  68. has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
  69. subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
  70. version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
  71. subver_inc=$(( subver + 1 ))
  72. pkgrel_inc=$(( pkgrel + 1 ))
  73. version_min=$( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel} || \
  74. echo ${version} )
  75. version_max=$( ( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
  76. ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
  77. echo ${subver_inc} )
  78. constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
  79. Log "Applied version constraint: '${constraint_string}'"
  80. else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
  81. exit 1
  82. fi
  83. unset -f Log
  84. echo -n "${constraint_string}"
  85. }
  86. prepare() {
  87. cd "${srcdir}"/enigmail
  88. # Using vendor settings via /usr/lib/thunderbird/defaults/preferences/enigmail.js
  89. # does not seem to work.
  90. patch -p1 -i ../0001-preferences-disable-pEpAutoDownload-by-default.patch
  91. # Disable warning message in favour of a versioned dependency to discourage partial upgrades
  92. patch -p1 -i ../0001-Disable-Thunderbird-78-upgrade-warning-message.patch
  93. # Make timestamps in the generated XPI file respect SOURCE_DATE_EPOCH
  94. # (https://gitlab.com/enigmail/enigmail/-/merge_requests/45)
  95. patch -p1 -i ../0001-genxpi-make-XPI-files-reproducible.patch
  96. }
  97. build() {
  98. cd "${srcdir}"/enigmail
  99. ./configure
  100. make -j1 # fails with -j greater than 1
  101. }
  102. package() {
  103. # pin to strongly-coupled dependency versions
  104. depends=( ${depends[*]/gnupg/} $(_version_constraint 'gnupg' ) )
  105. depends=( ${depends[*]/icedove/} $(_version_constraint 'icedove') )
  106. # upstream min thunderbird version contraint
  107. local min_icedove_ver=$(grep strict_min_version "${srcdir}"/enigmail/build-tb/dist/manifest.json | sed 's|.*: "\([0-9]*\)\..*|\1|g')
  108. if (( min_icedove_ver + 0 ))
  109. then local constraint_string="icedove>=${_icedove_epoch}:${min_icedove_ver}"
  110. depends+=(${constraint_string})
  111. echo "applied upstream icedove version constraint: ${constraint_string}"
  112. fi
  113. cd "${srcdir}"/enigmail
  114. if ! _extension_id="$(sed -n '/.*<em:id>\(.*\)<\/em:id>.*/{s//\1/p;q}' build-tb/dist/install.rdf 2>/dev/null)" ||
  115. [[ -z $_extension_id ]]; then
  116. _extension_id="$(sed -n 's/.*"id": "\(.*\)".*/\1/p' build-tb/dist/manifest.json)"
  117. fi
  118. _extension_dest="${pkgdir}/usr/lib/icedove/extensions/${_extension_id}"
  119. # Should this extension be unpacked or not?
  120. if grep -q '<em:unpack>true</em:unpack>' build-tb/dist/install.rdf 2>/dev/null; then
  121. install -dm755 "${_extension_dest}"
  122. cp -R build-tb/dist/* "${_extension_dest}"
  123. chmod -R ugo+rX "${_extension_dest}"
  124. else
  125. install -Dm644 build-tb/enigmail-${pkgver}.xpi "${_extension_dest}.xpi"
  126. fi
  127. }