From 90f2c91d64ecafc28725fa0c69dec8150f6459e2 Mon Sep 17 00:00:00 2001 From: George Rawlinson Date: Wed, 28 Sep 2022 16:51:51 +1300 Subject: [PATCH] addpkg: go-swagger 0.30.3-1 --- go-swagger/PKGBUILD | 66 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 go-swagger/PKGBUILD diff --git a/go-swagger/PKGBUILD b/go-swagger/PKGBUILD new file mode 100644 index 0000000..79df4e6 --- /dev/null +++ b/go-swagger/PKGBUILD @@ -0,0 +1,66 @@ +# Maintainer: George Rawlinson + +pkgname=go-swagger +pkgver=0.30.3 +pkgrel=1 +pkgdesc='Swagger 2.0 implementation in Go' +arch=('x86_64') +url='https://goswagger.io' +license=('Apache') +depends=('glibc') +makedepends=('git' 'go') +options=('!lto') +_commit='ecf6f05b6ecc1b1725c8569534f133fa27e9de6b' +source=("$pkgname::git+https://github.com/go-swagger/go-swagger#commit=$_commit") +b2sums=('SKIP') + +pkgver() { + cd "$pkgname" + + git describe --tags | sed 's/^v//' +} + +prepare() { + cd "$pkgname" + + # create directory for build output + mkdir 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} \ + -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Commit=$_commit \ + -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Version=$pkgver" \ + -o build \ + ./cmd/... +} + +package() { + cd "$pkgname" + + # binary + install -vDm755 -t "$pkgdir/usr/bin" build/swagger + + # documentation + install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md + + # shell completion + cd cmd/swagger/completion + install -vDm644 swagger.bash-completion "$pkgdir/usr/share/bash-completion/completions/swagger" + install -vDm644 swagger.zsh-completion "$pkgdir/usr/share/zsh/site-functions/_swagger" +}