blob: bcf7dd16b5c3e45dd042ea30bb9122a1caa00625 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# Maintainer: Starry Wang <starry.wang@suse.com>
pkgname=hangar-git
pkgver=v1.9.2
pkgrel=1
epoch=
pkgdesc="Command line utility for container images"
arch=("x86_64" "aarch64")
url="https://github.com/cnrancher/hangar"
license=("Apache-2.0")
conflicts=(
"hangar"
"hangar-bin"
"hangar-debug"
"hangar-bin-debug"
)
depends=(
"gpgme"
"device-mapper"
"containers-common"
)
makedepends=(
"go"
"git"
"btrfs-progs"
)
provides=()
source=("git+$url")
sha256sums=("SKIP")
prepare() {
cd "${srcdir}/hangar"
go mod tidy
go mod verify
}
build() {
cd "${srcdir}/hangar"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
GO_LDFLAGS="-linkmode external"
GO_LDFLAGS="${GO_LDFLAGS} -X github.com/cnrancher/hangar/pkg/utils.Version=${pkgver}"
GO_LDFLAGS="${GO_LDFLAGS} -X github.com/cnrancher/hangar/pkg/utils.GitCommit=$(git rev-parse HEAD)"
GO_LDFLAGS="${GO_LDFLAGS} -extldflags \"${LDFLAGS}\""
go build \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-tags "containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" \
-ldflags "${GO_LDFLAGS}" \
-o hangar \
.
install -dm755 ./dist/man1
go run ./docs/main.go ./dist/man1
install -dm755 ./dist/completions/{bash,zsh,fish}
./hangar completion bash >| ./dist/completions/bash/hangar
./hangar completion zsh >| ./dist/completions/zsh/_hangar
./hangar completion fish >| ./dist/completions/fish/hangar.fish
}
check() {
cd "${srcdir}/hangar"
go test ./...
rm -r ~/.cache/hangar/
}
package() {
cd "${srcdir}/hangar"
# Binary
install -Dm755 "hangar" "${pkgdir}/usr/bin/hangar"
# Docs
install -dm755 ${pkgdir}/usr/share/man/man1
install -Dm644 dist/man1/*.1 ${pkgdir}/usr/share/man/man1
# Completions
install -Dm644 dist/completions/bash/hangar ${pkgdir}/usr/share/bash-completion/completions/hangar
install -Dm644 dist/completions/zsh/_hangar ${pkgdir}/usr/share/zsh/site-functions/_hangar
install -Dm644 dist/completions/fish/hangar.fish ${pkgdir}/usr/share/fish/vendor_completions.d/hangar.fish
# LICENSE
install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/hangar/LICENSE"
}
|