summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d09fdce75d719e59fce095771d2e8acdd178f639 (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
# Maintainer: Rocket Aaron <i at rocka dot me>

pkgname=q-dns
pkgdesc='A tiny command line DNS client with support for UDP, TCP, DoT, DoH, DoQ and ODoH.'
arch=('x86_64')
url='https://github.com/natesales/q'
pkgver=0.19.2
pkgrel=1
license=('GPL-3.0-or-later')
depends=('glibc')
makedepends=('unzip' 'go')
# source zip from GitHub contains commit hash in its comment
source=("q-$pkgver.zip::$url/archive/refs/tags/v$pkgver.zip")
sha256sums=('6c8c571c28a3aa350f81582aedb93b75393fe3160b13a5191d82375614d7c275')

build() {
  local _date=$(date --utc +"%Y-%m-%dT%H:%M:%SZ")
  local _commit=$(unzip -zq "$srcdir/q-$pkgver.zip")
  cd "q-$pkgver"
  # https://wiki.archlinux.org/title/Go_package_guidelines#Supporting_debug_packages
  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 -linkmode external -X main.version=$pkgver -X main.commit=$_commit -X main.date=$_date"
}

package() {
  install -Dm755 "$srcdir/q-$pkgver/q" "$pkgdir/usr/bin/q"
}