117 lines
2.6 KiB
Bash
117 lines
2.6 KiB
Bash
# Maintainer: nyyu <mail at nyyu dot dev>
|
|
|
|
pkgbase=woodpecker
|
|
pkgname=(
|
|
'woodpecker-server'
|
|
'woodpecker-agent'
|
|
'woodpecker-cli'
|
|
)
|
|
pkgver=2.1.1
|
|
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' 'pnpm')
|
|
options=('!lto')
|
|
source=(git+https://github.com/woodpecker-ci/woodpecker.git#tag=v$pkgver
|
|
'woodpecker-server.service'
|
|
'woodpecker-agent.service'
|
|
'agent.conf'
|
|
'server.conf')
|
|
sha256sums=('SKIP'
|
|
'6e22e6939222aaad07311e37a086935ca32dd149c3688b2809db5f55df816516'
|
|
'1081a646cf645bc09ddda8472cf9a341e545bf03f5738d56ae427b33806e538c'
|
|
'a6c2bdfc934e40a9636e7447ecd5bf7b200444116085cd7c69d304dfb822eba9'
|
|
'd983da1df22d00338aa82be5844554f27f789361f405fe381f73896623bd2c7a')
|
|
|
|
prepare() {
|
|
cd "$pkgbase"
|
|
|
|
find web/src/assets/locales ! -name 'en.json' -type f -exec rm -f {} +
|
|
|
|
mkdir -p build-server build-agent build-cli
|
|
|
|
go mod download
|
|
}
|
|
|
|
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 go.woodpecker-ci.org/woodpecker/v2/version.Version=${pkgver}"
|
|
)
|
|
|
|
cd web
|
|
pnpm install --frozen-lockfile
|
|
pnpm 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
|
|
install -vDm755 build-cli/cli "$pkgdir/usr/bin/woodpecker"
|
|
}
|