summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 23abdbe76e50b64701ce0f2c5e81d1746896d73d (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
# Maintainer: Luis Martinez <luis dot martinez at disroot dot org>
# Contributor: duapple <2832893880@qq.com>

pkgname=genmake
pkgver=0.4.0
pkgrel=3
_commit=c16e594
pkgdesc="Makefile template generator"
arch=('x86_64')
url="https://gitee.com/duapple/genmake"
license=('AGPL3')
depends=('glibc')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::$url/repository/archive/$_commit?format=tar.gz")
sha256sums=('53f998c73d9662bc364f8d22541e7720f5058524ac57ef66f3b466dace0fd563')

prepare() {
	cd "$pkgname-$_commit"
	mkdir -p build
	go mod tidy
}

build() {
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"

	cd "$pkgname-$_commit"
	go build -o build/genmake -ldflags "-linkmode=external -extldflags=${LDFLAGS}"
}

check() {
	cd "$pkgname-$_commit"
	go test ./...
}

package() {
	cd "$pkgname-$_commit"
	install -D build/genmake -t "$pkgdir/usr/bin/"
	install -Dm644 config/genmake_conf.json -t "$pkgdir/usr/share/$pkgname/config/"
}