summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cfab9b235779ac626b38e9670943de5bf36ed062 (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
pkgname=go-ukify
pkgver=0.2.2
pkgrel=5
pkgdesc='Combine kernel and initrd into a signed Unified Kernel Image written in Go'
arch=('x86_64')
license=('MPL-2.0')
url='https://github.com/kairos-io/go-ukify'
source=("git+$url.git#tag=v0.2.2")
makedepends=(git go)
sha1sums=('cc97d2526e4e569c02d6dc2bfe2515633b6fd493')

pkgver() {
	cd go-ukify
	git describe --tags --long | sed 's/^v//; s/-0-[[:alnum:]]*$//; s/-/+/g'
}

build() {
	cd go-ukify

	export GOPATH="$srcdir"

	local gopkg="${url#https://}"
	local BUILDINFO=(
		"-X $gopkg/internal/common.VERSION=$pkgver"
		"-X $gopkg/internal/common.gitCommit=$(git rev-parse --short HEAD)"
	)

	local BUILDFLAGS=(
		-buildmode=pie
		-trimpath
		-mod=readonly
		-modcacherw
		-ldflags="-linkmode=external ${BUILDINFO[*]}"
	)

	go build "${BUILDFLAGS[@]}" -o ../build/
}

package() {
	install -Dm0755 -t "$pkgdir/usr/bin" build/go-ukify
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname" go-ukify/LICENSE
}