summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 79d202e0ec03e2aae25eb2feed521836c583f7b2 (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
# Maintainer: Mike Swanson <mikeonthecomputer@gmail.com>

pkgname=ntpsec-git
pkgver=0.9.6.r146.36adfe859
pkgrel=1
pkgdesc="Security-hardened Network Time Protocol implementation (Git HEAD)"
arch=('i686' 'x86_64')
url="https://www.ntpsec.org/"
license=('custom')
depends=('avahi' 'libevent' 'libseccomp' 'python')
makedepends=('asciidoc' 'git' 'pps-tools' 'w3m')
optdepends=('gnuplot: for ntpviz'
            'libevent: for ntpdig'
            'python-psutil: Optional for ntpviz, allows running with ionice'
            'ttf-liberation: Improves font quality in ntpviz renderings')
provides=('ntp' 'ntpsec')
conflicts=('ntp' 'ntpsec')
source=("git+https://gitlab.com/NTPsec/ntpsec")
sha256sums=('SKIP')
validpgpkeys=('DA3FDF774CC70FA64729EC4505D9B371477C7528')

pkgver() {
  cd "${pkgname%%-git}"
  printf "%s" "$(git describe --long | sed -e 's/NTPsec_//' -e 's/\_/-/g' -e 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

prepare() {
  cd "${pkgname%%-git}"

  for patch in ../*.patch; do
    if [ ! -f "$patch" ]; then
      break;
    else
      patch -p1 -i "$patch"
    fi
  done

  sed -i -e 's/sbin/bin/g' "etc/ntpd.service"
}

build() {
  cd "${pkgname%%-git}"
  ./waf configure --prefix=/usr --bindir=/usr/bin --libdir=/usr/lib \
        --enable-debug-gdb --enable-seccomp --refclock=all \
        --sbindir=/usr/bin --enable-doc --htmldir=/usr/share/doc/${pkgname}
  ./waf build
  a2x -f text docs/copyright.txt
}

check() {
  cd "${pkgname%%-git}"
  ./waf check
}

package() {
  cd "${pkgname%%-git}"
  ./waf install --destdir="$pkgdir/"

  install -d "$pkgdir/etc/logrotate.d"
  install -d "$pkgdir/usr/lib/systemd/system"
  install -d "$pkgdir/usr/share/licenses/${pkgname}"
  install -m 644 etc/logrotate-config.ntpd "$pkgdir/etc/logrotate.d/ntpd"
  install -m 644 etc/ntpd.service "$pkgdir/usr/lib/systemd/system/ntpd.service"
  install -m 644 docs/copyright.text "$pkgdir/usr/share/licenses/${pkgname}/COPYING"

  # --mandir, it does nothing!
  mv "$pkgdir/usr/man" "$pkgdir/usr/share/man"
}