summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 88a118c26bb2235b439cb989287e74a3fa0f40dc (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
# Maintainer: Fabien LEFEBVRE <contact@d1ceward.com>

pkgname=herokuish
pkgver=0.10.3
pkgrel=1
pkgdesc='Utility for emulating Heroku build and runtime tasks in containers'
arch=('x86_64')
url='https://github.com/gliderlabs/herokuish'
license=('MIT')
source=("${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('95c3833fc5fd0e44e11dd50e004239b88e32252c95bea05d99ef5ce5c5b1fb43')
makedepends=('go'
             'go-bindata')

build() {
  cd "${pkgname}-${pkgver}"

  # Generate buildpacks info
  export BUILDPACK_ORDER=$(grep "BUILDPACK_ORDER :=" Makefile | sed 's/BUILDPACK_ORDER := //g')
  count=0
  for buildpack in $BUILDPACK_ORDER; do
    buildpack_count=$(printf '%02d' $count)
    buildpack_info=$(cat buildpacks/*-${buildpack}/buildpack* | sed 'N;s/\n/ /')

    echo "${buildpack_count}_buildpack-${buildpack} ${buildpack_info}"

    count=$((count + 1))
  done > include/buildpacks.txt
  go-bindata include

  # Build executable
  export GOPATH="${srcdir}/gopath"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  go build -ldflags "-X main.Version=${pkgver}" -o "${pkgname}-build" .
}

package() {
  cd "${pkgname}-${pkgver}"

  install -Dm755 herokuish-build "${pkgdir}/usr/bin/${pkgname}"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}