feat: add build scripts for tinygo

This commit is contained in:
AJ ONeal 2023-11-04 22:35:41 -06:00
parent ff57c6cc53
commit 3bf23349a1
Signed by: coolaj86
GPG Key ID: F1D692A76F70CF98
2 changed files with 92 additions and 0 deletions

54
tinygo-build-linux.sh Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
set -u
# NOTE
# building for linux on linux seems to yield smaller sizes
# TODO use the git log describe thing
my_version="0.6.0"
export GOOS="linux"
fn_package() { (
if test -n "${GOARM:-}"; then
my_arch="${GOARCH}v${GOARM}"
elif test -n "${GOAMD64:-}"; then
my_arch="${GOARCH}_${GOAMD64}"
else
my_arch="${GOARCH}"
fi
my_bin="pathman-v${my_version}-${GOOS}-${my_arch}"
tinygo build -no-debug -o "${my_bin}"
strip "${my_bin}" || true
tar cvf "$my_bin.tar" "$my_bin"
gzip --keep "$my_bin.tar"
xz --keep "$my_bin.tar"
echo "$my_bin.tar.xz"
); }
export GOAMD64=v1
export GOARCH=amd64
fn_package
export GOAMD64=''
export GOARCH=386
fn_package
export GOARCH=arm64
fn_package
export GOARCH=arm
export GOARM=7
fn_package
export GOARCH=arm
export GOARM=6
fn_package
# no longer supported
# export GOARCH=arm
# export GOARM=5
# fn_package

38
tinygo-build-macos.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/sh
set -e
set -u
# NOTE
# building for macOS on macOS seems to yield smaller sizes
# TODO use the git log describe thing
my_version="0.6.0"
export GOOS="darwin"
fn_package() { (
if test -n "${GOARM:-}"; then
my_arch="${GOARCH}v${GOARM}"
elif test -n "${GOAMD64:-}"; then
my_arch="${GOARCH}_${GOAMD64}"
else
my_arch="${GOARCH}"
fi
my_bin="pathman-v${my_version}-${GOOS}-${my_arch}"
tinygo build -no-debug -o "${my_bin}"
strip "${my_bin}" || true
tar cvf "$my_bin.tar" "$my_bin"
gzip --keep "$my_bin.tar"
xz --keep "$my_bin.tar"
echo "$my_bin.tar.xz"
); }
export GOAMD64=v2
export GOARCH=amd64
fn_package
export GOAMD64=''
export GOARCH=arm64
fn_package