blob: 32067d06483ea9cfe712eb31a9fc7d7ac4102492 (
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
51
52
53
54
55
56
57
58
59
|
# Contributor: edacval <edacval AT gmail DOT com>
# Contributor: George Rawlinson <george@rawlinson.net.nz>
# Contributor: Stéphane Graber <stgraber AT ubuntu DOT com>
# Contributor: graysky <graysky AT archlinux DOT us>
_pkgname=distrobuilder
_url=github.com/lxc/$_pkgname
pkgname=$_pkgname-git
pkgver=2.1.r34.g2ff2379
pkgrel=1
pkgdesc="System container image builder for LXC and LXD"
arch=(x86_64)
url="https://$_url"
license=(Apache)
depends=(rsync squashfs-tools gnupg debootstrap)
conflicts=(distrobuilder)
makedepends=(go git)
source=($_pkgname::git+https://$_url)
sha256sums=('SKIP')
pkgver() {
cd $_pkgname
git describe --long | sed 's/^distrobuilder-//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
# export & create $GOPATH
export GOPATH="$srcdir/go"
mkdir -p "$GOPATH"
# download dependencies
cd "$_pkgname"
go mod vendor
}
build() {
# export various Go flags
export GOPATH="$srcdir/go"
export CGO_CPPFLAGS="$CPPFLAGS"
export CGO_CFLAGS="$CFLAGS"
export CGO_CXXFLAGS="$CXXFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
# build binary
cd "$_pkgname"
go install -v ./...
}
check() {
export GOPATH="$srcdir/go"
cd "$_pkgname"
go test -v ./...
go vet -v ./...
}
package() {
install -Dm755 "$srcdir/go/bin/$_pkgname" -t "$pkgdir/usr/bin"
}
|