arch-pkgs/drone-cli/PKGBUILD
George Rawlinson c318bd932b
upgpkg: drone-cli 1.3.3-2
Ensure version is present in compiled binary.
2021-09-08 01:07:12 +00:00

55 lines
1.2 KiB
Bash

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
pkgname=drone-cli
pkgver=1.3.3
pkgrel=2
pkgdesc="Command line interface for Drone CI"
arch=('x86_64')
url="https://docs.drone.io/cli"
license=('Apache')
makedepends=('go' 'git')
source=("$pkgname-$pkgver.tar.gz::https://github.com/drone/drone-cli/archive/v$pkgver.tar.gz")
b2sums=('de1068f27ae4da7301898375537a91ceb8a338e6e4f2966381b16957c8e724a0a713fd4b8db3c53e5fba8ac608d2ea111f5025cb2d7a561911f7f197e9d7ac2e')
prepare() {
cd "$pkgname-$pkgver"
# create directory for build output
mkdir build
# download dependencies
go mod vendor
}
build() {
cd "$pkgname-$pkgver"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
go build -v \
-trimpath \
-buildmode=pie \
-mod=vendor \
-modcacherw \
-ldflags "-linkmode external -extldflags ${LDFLAGS} -X main.version=$pkgver" \
-o build \
./...
}
check() {
cd "$pkgname-$pkgver"
go test -v ./...
}
package() {
cd "$pkgname-$pkgver"
# binary
install -vDm755 -t "$pkgdir/usr/bin" build/drone
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" *.md
}