1 # Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>
2 # Maintainer: Maxim Baz <$pkgname at maximbaz dot com>
3 # Contributor: Daniel Martà <mvdan@mvdan.cc>
8 pkgdesc="Format shell programs"
9 url="https://github.com/mvdan/sh"
13 makedepends=('git' 'go' 'scdoc')
15 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/mvdan/sh/archive/v${pkgver}.tar.gz")
16 b2sums=('a4b9e711eb1d8889e317775fcbab95a273c0bef9ff46ce043c1db39b4b21ca944272b595f60d190bf169ce4924f6c37c9aa1945155e62f9f27c7af2ff9008e3f')
19 cd "${srcdir}/sh-${pkgver}/cmd/shfmt/"
21 export CGO_CPPFLAGS="${CPPFLAGS}"
22 export CGO_CFLAGS="${CFLAGS}"
23 export CGO_CXXFLAGS="${CXXFLAGS}"
24 export CGO_LDFLAGS="${LDFLAGS}"
25 export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
26 go build -ldflags "-linkmode=external -extldflags=$LDFLAGS -X main.version=${pkgver}"
28 scdoc < "${pkgname}.1.scd" | gzip > "${pkgname}.1.gz"
32 cd "${srcdir}/sh-${pkgver}/"
37 cd "${srcdir}/sh-${pkgver}/"
38 install -Dm755 -t "${pkgdir}/usr/bin/" "cmd/${pkgname}/${pkgname}"
39 install -Dm644 -t "${pkgdir}/usr/share/man/man1/" "cmd/${pkgname}/${pkgname}.1.gz"
40 install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}/" LICENSE