From 5c14cca70b0dddbd633dbdf01145ef2b8e1814b0 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Sat, 25 May 2024 14:22:10 -0400 Subject: [PATCH] +shfmt --- projects/mvdan.cc/sh/package.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 projects/mvdan.cc/sh/package.yml diff --git a/projects/mvdan.cc/sh/package.yml b/projects/mvdan.cc/sh/package.yml new file mode 100644 index 00000000..32d83aee --- /dev/null +++ b/projects/mvdan.cc/sh/package.yml @@ -0,0 +1,33 @@ +distributable: + url: https://github.com/mvdan/sh/archive/refs/tags/{{ version.tag }}.tar.gz + strip-components: 1 + +versions: + github: mvdan/sh + +provides: + - bin/shfmt + +build: + dependencies: + go.dev: ^1.21 + script: + - go mod download + - go build -v -trimpath -ldflags="$GO_LDFLAGS" -o '{{prefix}}/bin/shfmt' ./cmd/shfmt + env: + GO_LDFLAGS: + - -s + - -w + - -X main.version=v{{version}} + linux: + # or segmentation fault + # fix found here https://github.com/docker-library/golang/issues/402#issuecomment-982204575 + LDFLAGS: + - -buildmode=pie + +test: + - test "$(shfmt --version)" = "v{{version}}" + - run: test "$(echo 'echo "hello world"; echo 42' | shfmt)" = "$(cat $FIXTURE)" + fixture: | + echo "hello world" + echo 42