diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..52afa350 --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -ex + +export CGO_ENABLED=1 +export GOARCH=arm64 +export GOOS=linux +export CC=aarch64-linux-musl-gcc +export CXX=aarch64-linux-musl-g++ + +# /usr/local/bin/knot +go build \ + --ldflags '-linkmode external -extldflags "-static"' \ + -o .bin/knot ./cmd/knot + +# install script helper +cat << EOF > .bin/install.sh +#!/bin/sh + +set -ex + +install -g root -o root knot /usr/local/bin/knot +EOF +chmod +x .bin/install.sh