summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 478f0db929631e4459be187664808bc39bf0d8ca (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
# Maintainer: Pellegrino Prevete <pellegrinoprevete@gmail.com>
# Contributor: Jean-Francois Chevrette <jfchevrette@gmail.com>

_pkgname=ytt
_ns="k14s"
pkgname="${_pkgname}-git"
pkgver=r1176.292f57d
pkgrel=1
pkgdesc="YAML templating tool that works on YAML structure instead of text"
url="https://get-ytt.io/"
license=('Apache')
arch=('x86_64')
depends=('glibc')
makedepends=('git' 'go-pie')
source=("git+https://github.com/${_ns}/${_pkgname}/")
sha256sums=('SKIP')
provides=("ytt")
conflicts=("ytt")

pkgver() {
	cd "${srcdir}/src/github.com/${_ns}/${_pkgname}"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	rm -rf "${srcdir}/src/github.com/${_ns}/${_pkgname}"
	mkdir -p "${srcdir}/src/github.com/${_ns}/${_pkgname}"
	mv -T "${srcdir}/${_pkgname}" "${srcdir}/src/github.com/${_ns}/${_pkgname}"
}

build() {
    cd "${srcdir}/src/github.com/${_ns}/${_pkgname}"
    
    export GOPATH="${srcdir}"
    export LDFLAGS="-X github.com/vmware/tanzu/carvel-ytt/pkg/version.Version=$pkgver"
    rm -f website/generated.go
    go fmt $(go list ./... | grep -v yaml.v2)
    go mod vendor
    go mod tidy
    rm -f pkg/website/generated.go
    go build -ldflags="${LDFLAGS}" -trimpath -o "ytt" "./cmd/ytt/..."
    ./ytt version
    go build -ldflags="${LDFLAGS}" -trimpath -o "./tmp/main" "./cmd/ytt-lambda-website/..."
}

package() {
	cd "${srcdir}/src/github.com/${_ns}/${_pkgname}"
	install -Dm755 "${_pkgname}" "${pkgdir}"/usr/bin/${_pkgname}
	install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${_pkgname}/LICENSE
}