# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
pkgname=terraform-provider-kubernetes
pkgver=2.5.0
pkgrel=1
pkgdesc="Terraform provider to configure K8s objects"
url="https://github.com/mrparkers/terraform-provider-kubernetes"
arch=(x86_64 powerpc64le powerpc64)
license=("MIT")
makedepends=("go" "git")
source=(
  "$pkgname-$pkgver.tar.gz::https://github.com/hashicorp/terraform-provider-kubernetes/archive/v$pkgver.tar.gz"
)
sha512sums=('c9ea05ff45583aaf8520ab216a3c0a0ffe2050e4cd7173824215d78941aa8093689fde1e20dd896fdfa2cb54c9dad92a03dddef79d0dd337a0e7214caf4a6eb5')

build() {
  export CGO_LDFLAGS="${LDFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  if [ "${CARCH}" != "powerpc64" ]; then
	 BUILDMODE="-buildmode=pie"
  fi
  export GOFLAGS="${BUILDMODE} -trimpath -mod=readonly -modcacherw"

  cd $pkgname-$pkgver
  go build .
}

package() {
  cd $pkgname-$pkgver
  install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
}
