summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 02bc143b8ca62214483920f36fcf6017d1a30d26 (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: Tony Lambiris <tony@libpcap.net>

pkgname=dive-git
pkgver=0.10.0.r2.gc7d121b
pkgrel=1
pkgdesc="A tool for exploring each layer in a docker image"
url="https://github.com/wagoodman/dive"
arch=('x86_64' 'i686')
license=('MIT')
conflicts=(dive dive-bin)
provides=(dive dive-bin)
makedepends=('go')
source=("${pkgname}::git+${url}")
sha256sums=('SKIP')

pkgver() {
	cd "${srcdir}/${pkgname}"

	git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//g'
}

prepare() {
	cd "${srcdir}/${pkgname}"

	install -m755 -d "${srcdir}/go/src/github.com/wagoodman/"
	ln -sf "${srcdir}/${pkgname}" "${srcdir}/go/src/github.com/wagoodman/dive"

	cd "${srcdir}/go/src/github.com/wagoodman/dive"

    export GOPATH="${srcdir}/go" GOFLAGS="-modcacherw"
    go get -v -t ./...
}

build() {
	cd "${srcdir}/go/src/github.com/wagoodman/dive"

	mkdir -p build

    export GOPATH="${srcdir}/go" GOFLAGS="-modcacherw"
	go build \
		-trimpath -ldflags "-s -w" \
		-o ./build/dive .
}

package() {
	cd "${srcdir}/go/src/github.com/wagoodman/dive"

	install -Dm755 "build/dive" "${pkgdir}/usr/bin/dive"
	install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}