# Description: A tool that facilitates building OCI images
# URL: https://github.com/containers/buildah
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: crun passt skopeo
# Optional: bash-completion

name=buildah
version=1.44.0
release=1
source=(https://github.com/containers/buildah/archive/v$version/$name-$version.tar.gz)

build() {
  cd $name-$version

  mkdir "$PKGMK_SOURCE_DIR/gopath" || true
  export GOPATH="$PKGMK_SOURCE_DIR/gopath"
  export PATH="${GOPATH}/bin:$PATH"
  export GOCACHE="${PKGMK_SOURCE_DIR}/gocache"
  export GOMODCACHE="${PKGMK_SOURCE_DIR}/gomodcache"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"

  make PREFIX=/usr BUILDTAGS="containers_image_ostree_stub seccomp"

  prt-get isinst bash-completion && make DESTDIR=$PKG PREFIX=usr install.completions
  make DESTDIR=$PKG PREFIX=usr install
}
