summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c476c2053576bad634ad6709a83d222a3d0fd7a6 (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
# Maintainer: Daniel Lublin <daniel@lublin.se>

_pkgname=ntsclient
pkgname=$_pkgname-git
pkgver=0.3.1.r0.g9e0937d
pkgrel=1
pkgdesc='Small Network Time Security Client (NTP with NTS). Alpha software.'
arch=('i686' 'x86_64')
url="https://gitlab.com/hacklunch/$_pkgname"
license=('ISC')
makedepends=('git' 'go-pie')
provides=($_pkgname)
conflicts=($_pkgname)
source=("$_pkgname::git+$url")
sha256sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $_pkgname
  GITVERSION="$(git describe --tags --long --dirty)"
  BUILDTIMESTAMP="$(date +%s)"
  go build \
     -gcflags "all=-trimpath=$PWD" \
     -asmflags "all=-trimpath=$PWD" \
     -ldflags "-X main.gitVersion=$GITVERSION -X main.buildTimestamp=$BUILDTIMESTAMP -extldflags $LDFLAGS" \
     -o $_pkgname .
}

package() {
  cd $_pkgname
  install -Dm755 $_pkgname "$pkgdir"/usr/bin/$_pkgname
  install -Dm644 ntsclient.toml "$pkgdir/etc/ntsclient.toml"
  install -Dm644 contrib/ntsclient.service "$pkgdir/usr/lib/systemd/system/ntsclient.service"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
}