summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9df2d365cd0f90a3a88ee05ebe15d6ce42d7a004 (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
60
61
62
63
64
# Maintainer: envolution
# Contributor: fuero <fuerob@gmail.com>
# shellcheck shell=bash disable=SC2034,SC2154
pkgname=kwok
pkgver=0.6.1
pkgrel=1
pkgdesc='Kubernetes WithOut Kubelet - set up a cluster of thousands of (fake) nodes in seconds'
arch=('x86_64' 'i686')
url="https://github.com/kubernetes-sigs/${pkgname}"
license=('Apache')
makedepends=('go')
depends=('glibc')
source=(
  "${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz"
)
sha256sums=('cb43f7574205448a7c89b53201c40db6055f1ceebf011051248f092c893fa1cb')

build() {
  cd "${pkgname}-${pkgver}"
  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"

  make \
    EXTRA_LDFLAGS="-linkmode=external -w -s -v" \
    EXT_LDFLAGS="${LDFLAGS}" \
    VERSION="${pkgver}" \
    build
}

check() {
  cd "${pkgname}-${pkgver}"
  make unit-test
}

package() {
  declare -A arch_map=(
    [x86_64]=amd64
    [i686]=386
  )
  export GOARCH=${arch_map[$CARCH]:-}

  cd "${pkgname}-${pkgver}"
  for i in kwok kwokctl; do
    install -Dm755 "bin/linux/${GOARCH}/${i}" "$pkgdir/usr/bin/${i}"
  done

  install -dm755 "$pkgdir/usr/share/doc/$pkgname"
  install -dm755 "$pkgdir/usr/share/licenses/$pkgname"

  install -m644 README.md CONTRIBUTING.md RELEASE.md SECURITY.md \
    "$pkgdir/usr/share/doc/$pkgname/"

  install -m644 LICENSE \
    "$pkgdir/usr/share/licenses/$pkgname/"

  if [ -f "code-of-conduct.md" ]; then
    install -m644 code-of-conduct.md "$pkgdir/usr/share/doc/$pkgname/"
  fi
}

# vim:set ts=2 sw=2 et: