aur/drone-runner-docker/PKGBUILD

67 lines
1.6 KiB
Bash

# Maintainer: Sl@ny <webmaster [at] slany [dot] work>
pkgname=drone-runner-docker
pkgver=1.8.3
pkgrel=1
pkgdesc='Drone pipeline runner that executes builds inside Docker containers'
arch=('x86_64')
url="https://drone.io"
license=('custom')
makedepends=('go' 'git')
options=('!lto')
depends=('docker')
backup=('etc/drone/agent')
source=(git+https://github.com/drone-runners/$pkgname.git#tag=v$pkgver
'drone-agent.service'
'agent.conf')
sha256sums=('SKIP'
'a739e3efeffdf93dd13ba4947608ecd17ea585473de55a2323f6f3e89f787dca'
'2c1a13f0d4bf83c1716db1b3179f38da7b9f0e762f781a8a6ab13cc683f057fe')
prepare() {
cd "$pkgname"
# create directory for build output
mkdir -p build
# download dependencies
go mod download
}
build() {
cd "$pkgname"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
go build -v \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \
-o build \
.
}
package() {
# service
install -Dm644 drone-agent.service "$pkgdir/usr/lib/systemd/system/drone-agent.service"
# config
install -Dm644 agent.conf "$pkgdir/etc/drone/agent"
cd "$pkgname"
# binary
install -vDm755 -t "$pkgdir/usr/bin" build/*
# licenses
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" licenses/* LICENSE.md
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md CHANGELOG.md
}