aur/woodpecker/PKGBUILD

120 lines
2.6 KiB
Bash
Raw Normal View History

2022-11-15 23:08:47 +01:00
# Maintainer: nyyu <mail at nyyu dot dev>
2022-11-14 20:24:47 +01:00
pkgbase=woodpecker
pkgname=(
'woodpecker-server'
'woodpecker-agent'
'woodpecker-cli'
)
pkgver=0.15.0+415+gaf2c27872
2022-11-14 20:24:47 +01:00
pkgrel=1
pkgdesc="Woodpecker is a community fork of the Drone CI system"
arch=('x86_64')
url="https://woodpecker-ci.org"
license=('Apache')
makedepends=('go' 'git' 'npm')
options=('!lto')
2022-11-15 23:08:47 +01:00
source=(git+https://github.com/woodpecker-ci/woodpecker.git
2022-11-14 20:24:47 +01:00
'woodpecker-server.service'
'woodpecker-agent.service'
'agent.conf'
'server.conf')
sha256sums=('SKIP'
2022-11-15 23:08:47 +01:00
'6e22e6939222aaad07311e37a086935ca32dd149c3688b2809db5f55df816516'
2022-11-14 20:24:47 +01:00
'176d884407b89da3e83cb0b19c506a3fd5ce39a19fb6346e512562ee73e50373'
2022-11-16 22:17:52 +01:00
'd029760fd48718c579aaa10289786797cb2064201fef4bfbeacf3b96c54c1597'
'a0a4d1e219e37b695b410bbcfffca89b678a2bb9f3de232fbaaf79a0f2fe57cb')
2022-11-15 23:08:47 +01:00
pkgver() {
cd "$pkgbase"
git describe --tags | sed 's/^v//;s/-/+/g'
}
2022-11-14 20:24:47 +01:00
prepare() {
cd "$pkgbase"
mkdir -p build-server build-agent build-cli
2022-11-16 22:17:52 +01:00
go mod download || true
2022-11-14 20:24:47 +01:00
}
build() {
cd "$pkgbase"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
local COMMON_FLAGS=(
-trimpath
-buildmode=pie
-mod=readonly
-modcacherw
-ldflags "-linkmode external -extldflags \"${LDFLAGS}\" -X github.com/woodpecker-ci/woodpecker/version.Version=${pkgver}"
)
cd web
npm install
npm run build
cd ..
go build \
"${COMMON_FLAGS[@]}" \
-o build-server \
./cmd/server/...
go build \
"${COMMON_FLAGS[@]}" \
-o build-agent \
./cmd/agent/...
go build \
"${COMMON_FLAGS[@]}" \
-o build-cli \
./cmd/cli/...
}
check() {
cd "$pkgbase"
go test -v ./...
}
package_woodpecker-server() {
backup=('etc/woodpecker/server')
# service
install -Dm644 woodpecker-server.service "$pkgdir/usr/lib/systemd/system/woodpecker-server.service"
# config
install -Dm644 server.conf "$pkgdir/etc/woodpecker/server"
cd "$pkgbase"
# binary
install -vDm755 build-server/server "$pkgdir/usr/bin/woodpecker-server"
}
package_woodpecker-agent() {
backup=('etc/woodpecker/agent')
# service
install -Dm644 woodpecker-agent.service "$pkgdir/usr/lib/systemd/system/woodpecker-agent.service"
# config
install -Dm644 agent.conf "$pkgdir/etc/woodpecker/agent"
cd "$pkgbase"
# binary
install -vDm755 build-agent/agent "$pkgdir/usr/bin/woodpecker-agent"
}
package_woodpecker-cli() {
cd "$pkgbase"
# binary
2022-11-15 23:08:47 +01:00
install -vDm755 build-cli/cli "$pkgdir/usr/bin/woodpecker"
2022-11-14 20:24:47 +01:00
}