summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 03f2f1ee97bd9d2f44dcfd72e0d1b97593878458 (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
# Maintainer: Dasith Gunawardhana <dasith.gunawardhana@gmail.com>

_pkgname=packer
pkgname=${_pkgname}-git
pkgver=v1.3.3_999_g5504709e1
pkgrel=1
pkgdesc="Packer is a tool for creating identical machine images for multiple platforms from a single source configuration."
arch=('x86_64')
url="https://www.packer.io/"
license=('MPL2')
depends=('glibc')
makedepends=('go' 'git')
conflicts=("${_pkgname}")
provides=("${_pkgname}")
source=("git+https://github.com/hashicorp/packer.git")
sha256sums=('SKIP')

pkgver() {
  cd ${_pkgname}
  git describe | sed 's/[- ]/_/g'
}

prepare() {
  mkdir -p gopath
}

build() {
  export GOPATH="${srcdir}/gopath"
  export GOFLAGS="-gcflags=all=-trimpath=${PWD} -asmflags=all=-trimpath=${PWD} -ldflags=-extldflags=-zrelro -ldflags=-extldflags=-znow"

  cd ${_pkgname}
  make dev
}

check() {
  export GOPATH="${srcdir}/gopath"
  unset GOFLAGS

  cd ${_pkgname}
  make test
}

package() {
  cd ${_pkgname}
  install -Dm755 bin/packer "$pkgdir"/usr/bin/packer
  install -m644 -D LICENSE "$pkgdir/usr/share/licenses/${_pkgname}/LICENSE"
}