summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8785b837fd603413ce35d84971a185ab96f9a8c0 (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
# Maintainer: Jeremy Kescher <jeremy@kescher.at>

pkgname=hellpot-git
_targetname=hellpot
pkgver=v0.4.5.r0.g00e908a
pkgrel=1
pkgdesc="HellPot is a portal to endless suffering meant to punish unruly HTTP bots. (Git version)"
arch=('x86_64' 'aarch64' 'riscv64')
url="https://github.com/yunginnanet/HellPot"
license=('MIT')
makedepends=('go' 'git')
provides=('hellpot')
conflicts=('hellpot')
source=(
    "$_targetname::git+https://github.com/yunginnanet/HellPot.git"
    "service"
    "tmpfiles"
    "sysusers"
    "config.toml"
)
backup=('etc/hellpot/config.toml')
sha256sums=('SKIP'
            '0136fd65b73e678d12ddff09cd5f71bfea360787cf7955770fe95b64dabe8274'
            'a370bd1f4f1caa1aa4777e3a6cb6c752f711721c9913e09c78a11d304bc53b37'
            'd462d4a84021cb2ce0052ba6c46ad0ea6e7aab7a9459d048de892d8503a99aee'
            '5663856679a38a69572683f9720c4a20aeaf3eb6a26f5ca067e23d4fcc2b28ac')

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

build() {
  cd "$srcdir/$_targetname"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOPATH="${srcdir}"
  export GOFLAGS="-buildmode=pie -mod=readonly -modcacherw"

  go build -ldflags "-compressdwarf=false -X main.version=$(git tag --sort=-version:refname | head -n 1) -linkmode external" -o $_targetname ./cmd/HellPot
}

package() {
  cd "$srcdir"

  install -Dm755 $_targetname/$_targetname "${pkgdir}"/usr/bin/$_targetname
  install -Dm644 config.toml "${pkgdir}"/etc/$_targetname/config.toml
  install -Dm644 service "${pkgdir}"/usr/lib/systemd/system/$_targetname.service
  install -Dm644 tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/$_targetname.conf
  install -Dm644 sysusers "${pkgdir}"/usr/lib/sysusers.d/$_targetname.conf
}