summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 12b34d7f985cbe1172ea1d8cb5984a35014a1369 (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: Tony Lambiris <tony@criticalstack.com>

pkgname=goxel-git
pkgver=r126.0e00703
pkgrel=1
pkgdesc="Download accelerator written in Go (inspired by axel)"
url="https://github.com/m1ck43l/goxel"
arch=('x86_64' 'i686')
license=('Apache')
makedepends=('go')
source=("${pkgname}::git+${url}")
sha256sums=('SKIP')

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

	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

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

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

	cd "${srcdir}/go/src/github.com/m1ck43l/goxel"

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

build() {
	cd "${srcdir}/go/src/github.com/m1ck43l/goxel"

	mkdir -p build

	export GOPATH="${srcdir}/go"
	go build -ldflags "-s -w" \
		-gcflags="all=-trimpath=${GOPATH}/src" \
		-asmflags="all=-trimpath=${GOPATH}/src" \
		-o build/goxel .
}

package() {
	cd "${srcdir}/go/src/github.com/m1ck43l/goxel"

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