summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a662389396e76ca0365552135001dae3d4724e64 (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
# Maintainer: Anatol Pomozov

pkgname=booster-git
pkgver=0.1.r26.gccac927
pkgrel=1
pkgdesc='Fast and secure initramfs generator'
arch=(x86_64)
url='http://github.com/anatol/booster'
license=(MIT)
depends=(bash)
makedepends=(git go)
#checkdepends=(qemu-headless linux)
optdepends=('busybox: to enable emergency shell at the boot time')
provides=(initramfs)
source=(git+https://github.com/anatol/booster)
sha512sums=('SKIP')

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

build() {
  cd $srcdir/booster/generator
  CGO_CPPFLAGS="${CPPFLAGS}" CGO_CFLAGS="${CFLAGS}" CGO_CXXFLAGS="${CXXFLAGS}" CGO_LDFLAGS="${LDFLAGS}" \
    go build -trimpath \
      -buildmode=pie \
      -mod=readonly \
      -modcacherw \
      -ldflags "-linkmode external -extldflags \"${LDFLAGS}\""

  cd $srcdir/booster/init
  CGO_ENABLED=0 go build -trimpath -mod=readonly -modcacherw
}

check() {
  cd $srcdir/booster/tests
  # go test -v this requires access to KVM that is not available in Arch chroot env
}

package() {
  cd booster
  install -Dp -m755 generator/booster "$pkgdir/usr/bin/booster"
  install -Dp -m644 generator/booster.1 "$pkgdir/usr/share/man/man1/booster.1"
  install -Dp -m755 init/init "$pkgdir/usr/lib/booster/init"
  install -Dp -m644 packaging/arch/90-booster.hook "$pkgdir/usr/share/libalpm/hooks/90-booster.hook"
  install -Dp -m755 packaging/arch/booster-install "$pkgdir/usr/share/libalpm/scripts/booster-install"
}