aboutsummaryrefslogtreecommitdiffstats
path: root/community/shfmt/APKBUILD
blob: 5000a0f58baa7d75efa874dca48294b495651cd1 (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
# Contributor: Olliver Schinagl <oliver@schinagl.nl>
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=shfmt
pkgver=3.5.0
pkgrel=4
pkgdesc="A shell parser, formatter, and interpreter (sh/bash/mksh)"
url="https://mvdan.cc/sh"
arch="all"
license="BSD-3-Clause"
makedepends="go scdoc"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mvdan/sh/archive/v$pkgver.tar.gz"
builddir="$srcdir/sh-$pkgver"

prepare() {
	default_prepare

	# Fix compatibility with released go 1.18
	go mod edit -replace github.com/rogpeppe/go-internal=github.com/rogpeppe/go-internal@v1.8.1
	go mod tidy
}

build() {
	go build \
		-ldflags "-w -X main.version=$pkgver-$pkgrel" \
		-v \
		./cmd/shfmt
	scdoc < cmd/shfmt/shfmt.1.scd > shfmt.1
}

check() {
	go test ./...
}

package() {
	install -Dm755 shfmt "$pkgdir"/usr/bin/shfmt
	install -Dm644 shfmt.1 "$pkgdir"/usr/share/man/man1/shfmt.1
}

sha512sums="
9071a015369088dbba8eb7221305893095ebeaa72124e1ca964b7b1e6f34dedc9d11f2daa2f679d24637b04925cbf58427a24cc4885d8e918cb81844e71d3c6b  shfmt-3.5.0.tar.gz
"