summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4e201475652f7eeb08521de80635dec29e017fb0 (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
65
66
67
# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=waypoint
pkgver=0.10.2
pkgrel=1
pkgdesc='A tool to build, deploy, and release any application on any platform'
arch=('x86_64')
url='https://www.waypointproject.io/'
license=('MPL2')
makedepends=('git' 'go' 'go-bindata')
optdepends=('docker: for local development server')
options=('!lto')
_commit='2c9926ef815cea731983b785f8e2e187355d259c'
source=("$pkgname::git+https://github.com/hashicorp/waypoint.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"
  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$pkgname"

  # download dependencies
  go mod download
}

build() {
  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 process extracted from Makefile
  cd "$pkgname"
  go build -v \
    -o ./internal/assets/ceb/ceb \
    ./cmd/waypoint-entrypoint

  pushd internal/assets
  go-bindata \
    -verbose \
    -pkg assets \
    -o prod.go \
    -tags assetsembedded \
    ./ceb

  popd
  go build -v \
    -tags assetsembedded \
    -o ./waypoint \
    ./cmd/waypoint
}

package() {
  cd "$pkgname"

  # binary
  install -vDm755 -t "$pkgdir/usr/bin" "$pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
  cp -vr contrib/serverinstall/kind-k8s "$pkgdir/usr/share/doc/$pkgname"
  rm -vf "$pkgdir/usr/share/doc/$pkgname/.gitignore"
}