summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4bd761a6997fad040b90e8e6aa76ef39e79adffe (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
68
69
70
71
72
73
74
75
# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=waypoint
pkgver=0.10.5
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='ece0f754160d7f394465b677702688d704c2588c'
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() {
  # set Go flags
  local GIT_IMPORT="github.com/hashicorp/waypoint/internal/version"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie \
    -trimpath \
    -ldflags=-linkmode=external \
    -ldflags=-X=${GIT_IMPORT}.GitCommit=$_commit \
    -ldflags=-X=${GIT_IMPORT}.GitDescribe=$pkgver \
    -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"
}