termux-packages/packages/shfmt/build.sh

23 lines
696 B
Bash

TERMUX_PKG_HOMEPAGE=https://github.com/mvdan/sh
TERMUX_PKG_DESCRIPTION="A shell parser and formatter"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_VERSION=3.1.2
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/mvdan/sh/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=133fcdb4645ee0c2893319b1ce5b83c88b8576c1e3936b1fa14b967df1501ee5
termux_step_make_install() {
cd "$TERMUX_PKG_SRCDIR"
termux_setup_golang
export GOPATH="$TERMUX_PKG_BUILDDIR"
mkdir -p "$GOPATH/src/github.com/mvdan"
ln -sf "$TERMUX_PKG_SRCDIR" "$GOPATH/src/github.com/mvdan/sh"
go build -modcacherw \
-ldflags "-X main.version=$TERMUX_PKG_VERSION" \
-o "$TERMUX_PREFIX/bin/shfmt" \
./cmd/shfmt
}