summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 186c82d2ff4565be02e5a5e1401264a9b72d6a62 (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
# Maintainer: somini <dev@somini.xyz>

pkgname=tls-redirector
pkgver=2.4
pkgrel=5
pkgdesc='Tiny service for port 80 that rewrites URLs to HTTPS'
arch=('x86_64' 'aarch64')
url='https://git.sr.ht/~ancarda/tls-redirector'
license=('AGPL3')
makedepends=('go')
optdepends=(
  'certbot: For automatic TLS certificate provision'
)
install=tls-redirector.install
source=(
  "$pkgname-$pkgver.tar.gz::https://git.sr.ht/~ancarda/tls-redirector/archive/${pkgver}.tar.gz"
  'tls-redirector.service'
  'tls-redirector.socket'
  'tls-redirector.tmpfiles.conf'
  'tls-redirector.install'
)

sha512sums=('215d2f7de6b19c6e33f2c7e8c153bfe7bb8f50b7c0618529484e7ce4016842db3b339e4d1da11a4a0bab3e27bd27e4f802bf622ea1a05ab77cea0866b492b72a'
            '51e46d9eec50fc48bd4a2f151d338497316e48d0f82db75a2c51201db1fc8a8d525c90c98166df1bd82138c1bc49582ac3f02ffc197b5dd1fa3c1efd812e07cb'
            '8e624b47c4968c10153554fee09867140c336710abf64b87667efcdf8f91476af461c55ec9ddd72b3ef164cdcffbed311c77fd4fa29d33ff2114efe9c80e38e1'
            'b5979192c35595202603947d14d8adc9c39b8db481a7fa356d535f3f33427d3d5acbf3d5f2798ca27df3c7ca657693a46266ecb557839911e34d2df62248b122'
            '081fcd12edbb1f3a069c0b4bcd101db5ba5f432fc456d00a6f47ffa6a446603d087f9a8eab459cffd92f8b3ac1587d8059b561217c5b170f2d3fca4c7b60d902')

build() {
  cd "$pkgname-$pkgver"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"

  go generate ./...
  # Build with optional SystemD activation
  go build -v -tags systemd
}

package() {
  cd "$pkgname-$pkgver"

  install -Dm755  "${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
  # SystemD
  install -Dm644 "../${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
  install -Dm644 "../${pkgname}.socket" "${pkgdir}/usr/lib/systemd/system/${pkgname}.socket"
  install -Dm644 "../${pkgname}.tmpfiles.conf" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
}