summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 43b0cf45cd3aba26dc935b6fa62344d012c3e7ea (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
# Maintainer: Daniel Peukert <dan.peukert@gmail.com>
_pkgname='certspotter'
pkgname="$_pkgname-git"
pkgver='0.9.r17.ge74cb79'
pkgrel='3'
pkgdesc='Certificate Transparency Log Monitor - git version'
arch=('x86_64')
url="https://github.com/SSLMate/$_pkgname"
license=('MPL2')
makedepends=('git' 'go-pie>=1.5' 'golang-github-mreiferson-go-httpclient' 'golang-golang-x-net')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("$pkgname::git+$url")
sha256sums=('SKIP')

_builddir="$pkgname-build"
_buildpath="src/software.sslmate.com/src/$_pkgname"
_bindir="$pkgname-bin"

prepare() {
	cd "$srcdir/"

	mkdir -p "$_builddir/$(echo "$_buildpath" | rev | cut -d '/' -f 2- | rev)/"
	mv "$pkgname/" "$_builddir/$_buildpath/"

	mkdir -p "$_bindir/"
}

pkgver() {
	cd "$srcdir/$_builddir/$_buildpath/"
	git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	export GOPATH="$srcdir/$_builddir:/usr/share/gocode"
	go build -v -trimpath -ldflags "-extldflags $LDFLAGS" -o "$srcdir/$_bindir/" "$(echo "$_buildpath" | cut -d '/' -f 2-)/..."
}

check() {
	export GOPATH="$srcdir/$_builddir:/usr/share/gocode"
	go test -v "$srcdir/$_builddir/$_buildpath/..."
}

package() {
	cd "$srcdir/"
	for binary in "$_pkgname" 'ctparsewatch' 'submitct'; do
		install -Dm755 "$_bindir/$binary" "$pkgdir/usr/bin/$binary"
	done
}