summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7a7a93cb1a5f7202a4d7869357888b779b4807a2 (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.9.1
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=('6f9878c184420299bcbc1426c60d4ea053a4f48fb330965183a23dfcd8f0c8a7')
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"
}