summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4fbe04c3b9e2a4e345e43b19bb10b57c49a29e10 (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
# Maintainer: Luis Martinez <luis dot martinez at disroot dot org>
# Contributor: oss@fastly.com

## GPG key: https://github.com/web-flow.gpg

pkgname=fastly
pkgver=9.0.3
pkgrel=1
pkgdesc='CLI for the Fastly platform'
url='https://github.com/fastly/cli'
arch=('aarch64' 'i686' 'x86_64')
license=('Apache')
depends=('glibc')
makedepends=('git' 'go' 'tomlq')
changelog=CHANGELOG.md
source=("$pkgname::git+$url#tag=v$pkgver?signed")
sha256sums=('SKIP')
validpgpkeys=('A4C2C78656BA5E3DD5F122E4BCE379A5D550C407' ## Mark McDonnell (Integralist)
              '5DE3E0509C47EA3CF04A42D34AEE18F83AFDEB23') ## GitHub

prepare() {
	cd "$pkgname"
	go mod download
	sed -i '/CGO_ENABLED=/s/0/1/g' Makefile
}

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"
	make build \
		VERSION="$pkgver" \
		CLI_ENV="production" \
		GORELEASER_ARGS="--rm-dist --single-target" \
		GO_ARGS="${GOFLAGS}"
	./fastly --completion-script-bash > fastly.bash
	./fastly --completion-script-zsh > _fastly
}

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 fastly -t "$pkgdir/usr/bin/"
	install -Dvm644 fastly.bash "$pkgdir/usr/share/bash-completion/completions/$pkgname"
	install -Dvm644 _fastly -t "$pkgdir/usr/share/zsh/site-functions/"
}