summaryrefslogtreecommitdiff
path: root/libre/icedove-extension-enigmail/PKGBUILD
blob: 82cd6c4f194371c80cdf954c188f4cea5ab30457 (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
# Maintainer (Arch): Eli Schwartz <eschwartz@archlinux.org>
# Contributor (Arch): Daniel Landau <daniel.landau@iki.fi>
# Contributor (Arch): Einhard Leichtfuß <alguien@respiranto.de>
# Contributor (Arch): Xyne
# Contributor (Arch): David Manouchehri <d@32t.ca>
# Contributor (Arch): Alexander Fehr <pizzapunk gmail com>
# Contributor (Arch): Thomas Jost <schnouki schnouki net>
# Contributor (Arch): Hinrich Harms <arch hinrich de>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

# parabola changes and rationale:
# * allow building arch-dependent versioned packages
# * apply dependency version constraints


_pkgname=thunderbird-extension-enigmail
pkgname=icedove-extension-enigmail
_pkgver_x86_64=2.1.6
_pkgver_i686=2.1.6
_pkgver_armv7h=2.1.6
_pkgrel_x86_64=1
_pkgrel_i686=1
_pkgrel_armv7h=1
eval "pkgver=\$_pkgver_${CARCH}" # this is actually an 'any' package
eval "pkgrel=\$_pkgrel_${CARCH}" # but our different arches do not always roll at the same speed
pkgdesc="OpenPGP message encryption and authentication for Icedove"
arch=('armv7h' 'i686' 'x86_64')
url="https://www.enigmail.net/"
license=('MPL' 'GPL3')
makedepends=('zip' 'python' 'perl')
replaces=($_pkgname 'icedove-enigmail')
conflicts=($_pkgname)
provides=($_pkgname)
source=("https://www.enigmail.net/download/source/enigmail-${pkgver}.tar.gz"{,.asc}
        "0001-preferences-disable-pEpAutoDownload-by-default.patch")
_sha512sums_x86_64=('72159287601ed95052fcdeb3c973714e775150ba41894ecb6474798fd5109ab18dee0e3b8874a920fd07d3b184ed2034cf75f7baff4e14307d8739a312193919'
                    'SKIP'
                    'baebd963400574db89be747a4419534f945bdc64136d4014656ff98a9615a23984bca724da3f3840670979aab08ce441eee067921e21d0cb216938a20ed785b2')
_sha512sums_i686=('72159287601ed95052fcdeb3c973714e775150ba41894ecb6474798fd5109ab18dee0e3b8874a920fd07d3b184ed2034cf75f7baff4e14307d8739a312193919'
                  'SKIP'
                  'baebd963400574db89be747a4419534f945bdc64136d4014656ff98a9615a23984bca724da3f3840670979aab08ce441eee067921e21d0cb216938a20ed785b2'))
_sha512sums_armv7h=('72159287601ed95052fcdeb3c973714e775150ba41894ecb6474798fd5109ab18dee0e3b8874a920fd07d3b184ed2034cf75f7baff4e14307d8739a312193919'
                    'SKIP'
                    'baebd963400574db89be747a4419534f945bdc64136d4014656ff98a9615a23984bca724da3f3840670979aab08ce441eee067921e21d0cb216938a20ed785b2')
eval "sha512sums=(\${_sha512sums_${CARCH}[*]})"
validpgpkeys=('4F9F89F5505AC1D1A260631CDB1187B9DD5F693B') # Patrick Brunschwig <patrick@enigmail.net>


_version_constraint() # (dep_pkgname)
{
  local dep_pkgname=$1
  local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} | tail -n 1)

  if   [[ -z "${full_version}" ]] || [[ "${full_version}" =~ ' ' ]]
  then echo "ERROR: _version_constraint() full_version='${full_version}'" >&2
       exit 1
  else local version=${full_version%-*}
       local version_inc=${version%.*}.$(( ${version##*.} + 1 ))

       echo -n "${dep_pkgname}>=${version}" "${dep_pkgname}<${version_inc}"
  fi
}

prepare() {
    cd "${srcdir}"/enigmail

    # Using vendor settings via /usr/lib/thunderbird/defaults/preferences/enigmail.js
    # does not seem to work.
    patch -p1 -i ../0001-preferences-disable-pEpAutoDownload-by-default.patch
}

build() {
    cd "${srcdir}"/enigmail

    ./configure
    make -j1 # fails with -j greater than 1
}

package() {
    cd "${srcdir}"/enigmail

    depends+=( $(_version_constraint 'icedove') \
               $(_version_constraint 'gnupg'  ) )

    if ! _extension_id="$(sed -n '/.*<em:id>\(.*\)<\/em:id>.*/{s//\1/p;q}' build-tb/dist/install.rdf 2>/dev/null)" ||
            [[ -z $_extension_id ]]; then
        _extension_id="$(sed -n 's/.*"id": "\(.*\)".*/\1/p' build-tb/dist/manifest.json)"
    fi
    _extension_dest="${pkgdir}/usr/lib/icedove/extensions/${_extension_id}"
    # Should this extension be unpacked or not?
    if grep -q '<em:unpack>true</em:unpack>' build-tb/dist/install.rdf 2>/dev/null; then
        install -dm755 "${_extension_dest}"
        cp -R build-tb/dist/* "${_extension_dest}"
        chmod -R ugo+rX "${_extension_dest}"
    else
        install -Dm644 build-tb/enigmail-${pkgver}.xpi "${_extension_dest}.xpi"
    fi
}