summaryrefslogtreecommitdiff
path: root/pcr/postsrsd/PKGBUILD
blob: 3ed2b7095bff3e9c743f94cfb2c1a9cffd3287d7 (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
# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
# Maintainer (AUR:postsrsd-git): Radek Podgorny <radek@podgorny.cz>
# Maintainer (AUR:postsrsd-git): Thomas Haider <t.haider@deprecate.de>
# Maintainer (AUR:postsrsd): fordprefect <fordprefect@dukun.de>

pkgname=postsrsd
pkgver=1.4
pkgrel=3
pkgdesc="Sender Rewriting Scheme (SRS) daemon for Postfix"
arch=('i686' 'x86_64' 'armv7h')
makedepends=('cmake' 'help2man')
backup=('etc/default/postsrsd')
url="https://github.com/roehling/postsrsd"
license=('GPL2') # postsrsd.c is GPLv2+, but the vendored libsrs2 is
                 # GPLv2|BSD3; the intersection of these is GPLv2
source=("$pkgname-$pkgver.tar.gz::https://github.com/roehling/postsrsd/archive/${pkgver}.tar.gz"
        0001-systemd-populate-SRS_DOMAIN-default-using-postconf.patch
        postsrsd-genkey.service
        postsrsd.service-genkey.conf)
md5sums=('cb6e13a06d6bbd7d383efb9bbf0867ce'
         '55c38abef2084405eee3d4b7619d71dd'
         '621d1ac7a15aec5d0cf91ec9b3ae7266'
         '3441061474bd5da0d5f8148f53b05917')

prepare() {
  cd "$srcdir/${pkgname}-${pkgver}"

  local patch
  for patch in ../*.patch; do
    patch -Np1 -i "$patch"
  done
}

build() {
  cd "$srcdir/${pkgname}-${pkgver}"
  mkdir -p build
  cd build
  cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DGENERATE_SRS_SECRET=OFF \
        -DUSE_APPARMOR=ON \
        -DINIT_FLAVOR=systemd \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DSYSD_UNIT_DIR='/usr/lib/systemd/system'
  make all
}

package() {
  cd "$srcdir/${pkgname}-${pkgver}/build"
  make DESTDIR="$pkgdir/" install

  mv "$pkgdir"/usr/{sbin,bin}

  # This is to defer running the keygen until runtime; because of
  # GENERATE_SRS_SECRET=OFF.
  install -Dm644 "$srcdir/postsrsd-genkey.service"      "$pkgdir/usr/lib/systemd/system/postsrsd-genkey.service"
  install -Dm644 "$srcdir/postsrsd.service-genkey.conf" "$pkgdir/usr/lib/systemd/system/postsrsd.service.d/genkey.conf"
}