diff options
author | Michael Gebetsroither | 2022-02-19 04:00:13 +0100 |
---|---|---|
committer | Michael Gebetsroither | 2022-02-19 04:00:13 +0100 |
commit | da31c0f4feecf7fb1e944d7cc59a474cf0efc823 (patch) | |
tree | 3de23583704f89763c3a3d0cd20572be8f02080d | |
parent | 3b3bb8eea4a03d6b6337c9ad877f940d8193f09c (diff) | |
download | aur-da31c0f4feecf7fb1e944d7cc59a474cf0efc823.tar.gz |
building clean go binaries
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 26 |
3 files changed, 16 insertions, 16 deletions
@@ -1,7 +1,7 @@ pkgbase = regclient pkgdesc = Docker and OCI Registry tooling - regctl / regsync / regbot pkgver = 0.3.10 - pkgrel = 1 + pkgrel = 2 url = https://github.com/regclient/regclient arch = x86_64 arch = aarch64 diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..8869f5cfc44d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/pkg/ +/src/ +/*.tar.gz +/*.tar.zst @@ -1,39 +1,35 @@ # Maintainer: Michael Gebetsroither <m.gebetsr@gmail.com> pkgname=regclient pkgver=0.3.10 -pkgrel=1 -pkgdesc='Docker and OCI Registry tooling regctl / regsync /regbot' +pkgrel=2 +pkgdesc='Docker and OCI Registry tooling - regctl / regsync / regbot' arch=('x86_64' 'aarch64') url='https://github.com/regclient/regclient' license=('Apache') makedepends=('go' 'git') source=("https://github.com/regclient/regclient/archive/v$pkgver/$pkgname-$pkgver.tar.gz") sha256sums=('e9ebf9e3c4538020b230eadf801282ae29c1837a599c569f72b9a77bbde64106') -bins=('regbot' 'regctl' 'regsync') +_bins=('regbot' 'regctl' 'regsync') build() { local _commit _commit="$(bsdcat "$pkgname-$pkgver.tar.gz" | git get-tar-commit-id)" cd "$pkgname-$pkgver" - export CGO_ENABLED=1 - export CGO_CFLAGS="$CFLAGS" - export CGO_CPPFLAGS="$CPPFLAGS" - export CGO_CXXFLAGS="$CXXFLAGS" - export CGO_LDFLAGS="$LDFLAGS" - export GOFLAGS='-buildmode=pie -modcacherw -trimpath' + # we want "clean" go binaries + export CGO_ENABLED=0 - go build -o build -ldflags="-linkmode=external \ - -X regclient.github.io/regclient/pkg/cmd/regclient/version.GitCommit=$_commit" ./cmd/... + for i in ${_bins[@]}; do + go build -ldflags "-s -w -extldflags -static -X github.com/regclient/regclient/cmd/$i/version.GitCommit=$_commit" \ + -tags nolegacy -trimpath -o build ./cmd/$i - for i in ${bins[@]}; do - ./build/$i completion bash >$i.bash - ./build/$i completion zsh >$i.zsh + ./build/$i completion bash >$i.bash + ./build/$i completion zsh >$i.zsh done } package() { cd "$pkgname-$pkgver" - for i in ${bins[@]}; do + for i in ${_bins[@]}; do install -Dm755 "build/$i" -t "$pkgdir/usr/bin" install -Dm644 "$i.bash" "$pkgdir/usr/share/bash-completion/completions/$i" install -Dm644 "$i.zsh" "$pkgdir/usr/share/zsh/site-functions/_$i" |