summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1d5e145b11d1382b852a6e1fab5ac5e2a76b93c2 (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
# Maintainer: Kainoa Kanter <kainoa@t1c.dev>

_pkgname=cdpcurl
pkgname="$_pkgname-git"
pkgver=r12.g8dc4b89
pkgrel=1
pkgdesc='CLI for the Coinbase Developer Platform (CDP)'
url='https://github.com/coinbase/cdpcurl'
arch=('aarch64' 'i686' 'x86_64')
license=('custom:none')
depends=('glibc')
makedepends=('git' 'go')
provides=("$_pkgname")
source=("$_pkgname::git+$url")
sha256sums=('SKIP')

pkgver() {
    cd "${srcdir}/${_pkgname}" || exit
    printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "$_pkgname"
	go mod download
}

build() {
	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"
	cd "$_pkgname"
	go build
}

check() {
	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"
	cd "$_pkgname"
	go test ./...
}

package() {
	cd "$_pkgname"
	install -Dv cdpcurl -t "$pkgdir/usr/bin/"
}