summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 449e3c753c0f9eb710e88defaeaabac97b077da9 (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
# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=passphrase2pgp
pkgver=1.2.1
pkgrel=1
pkgdesc='Predictable, passphrase-based PGP key generator'
arch=('x86_64')
url='https://github.com/skeeto/passphrase2pgp'
license=('Unlicense')
depends=('glibc')
makedepends=('git' 'go')
checkdepends=('bash' 'gnupg' 'openssh')
options=('!lto')
_commit='f7c8d7d04855b9d7805b9c36c7e0ba677dc28965'
source=("$pkgname::git+$url.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$pkgname"

  # download dependencies
  go mod download

  # prevent recompilation during tests
  sed \
    -i 'test.bash' \
    -e '/go build/d'
}

build() {
  cd "$pkgname"

  # set Go flags
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"

  go build -v \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-linkmode external -extldflags ${LDFLAGS}" \
    .
}

check() {
  cd "$pkgname"

  bash test.bash
}

package() {
  cd "$pkgname"

  # binary
  install -vDm755 -t "$pkgdir/usr/bin" "$pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
}