blob: 4d0755a60770a64e298e9cdf28b1fb595829a72c (
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
|
# Maintainer: Bao Trinh <qubidt@gmail.com>
# Contributor: Fuad Saud <fuadfsaud@gmail.com>
_pkgname=damon
pkgname=${_pkgname}-git
provides=("${_pkgname}")
conflicts=("${_pkgname}")
pkgver=0.1.0.r75.411021d
pkgrel=1
pkgdesc="A terminal UI (TUI) for HashiCorp Nomad"
arch=('i686' 'x86_64' 'arm' 'aarch64')
license=('MPL2')
url="https://github.com/hashicorp/damon"
depends=('glibc')
makedepends=('git' 'go')
source=("${_pkgname}::git+${url}.git")
md5sums=('SKIP')
pkgver() {
cd "${_pkgname}"
# TODO: possibly remove once package gets a versioned tag
(
set -o pipefail
git describe --long --tags --match '[v0-9]*' 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
) ||
printf "%s.r%s.%s" "$(sed -En '/Version = /{s/.*"([^"]+)"$/\1/;p}' version/version.go)" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}
prepare() {
cd "${_pkgname}"
# create directory for build output
mkdir -p build
# download dependencies
go mod download
}
build() {
cd "${_pkgname}"
export CGO_LDFLAGS="${LDFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export GOPATH="${srcdir}"
git_commit=$(git rev-parse --short HEAD)
go build \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags="-linkmode=external -compressdwarf=false -X github.com/hcjulz/damon/version.GitCommit=${git_commit}" \
-o './build/damon' \
'./cmd/damon'
}
check() {
cd "${_pkgname}"
export GOFLAGS="-ldflags=-linkmode=external"
go test -v ./...
}
package() {
cd "${_pkgname}"
install -Dm755 "build/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 -t "${pkgdir}/usr/share/doc/${pkgname}" README.md
}
|