feat: tinygo build scripts for windows

This commit is contained in:
AJ ONeal 2023-11-04 23:18:29 -06:00
parent 3bf23349a1
commit 6f178a6de4
Signed by: coolaj86
GPG Key ID: F1D692A76F70CF98
2 changed files with 99 additions and 0 deletions

49
tinygo-build-windows.ps1 Normal file
View File

@ -0,0 +1,49 @@
#!/bin/bin/env pwsh
# TODO use the git log describe thing
$my_version = git describe --tags
$Env:GOOS = "windows"
function fn_package() {
IF ($Env:GOARM.Length -gt 0) {
$my_arch = "${Env:GOARCH}v${Env:GOARM}"
} ELSEIF ($Env:GOAMD64.Length -gt 0) {
$my_arch = "${Env:GOARCH}_${Env:GOAMD64}"
} ELSE {
$my_arch = "${Env:GOARCH}"
}
$my_bin = "pathman-${my_version}-${Env:GOOS}-${my_arch}"
tinygo build -no-debug -o "${my_bin}"
#strip "${my_bin}" || true
tar cvzf "$my_bin.tar" "$my_bin"
Compress-Archive "$my_bin" "$my_bin.zip"
Write-Output "$my_bin.zip"
}
$Env:GOAMD64 = "v1"
$Env:GOARCH = "amd64"
fn_package
$Env:GOAMD64 = ""
# $Env:GOARCH = "386"
# fn_package
$Env:GOARCH = "arm64"
fn_package
# $Env:GOARCH = "arm"
# $Env:GOARM = "7"
# fn_package
# $Env:GOARCH = "arm"
# $Env:GOARM = "6"
# fn_package
# unset vars
$Env:GOOS = ""
$Env:GOARCH = ""
$Env:GOARM = ""
$Env:GOAMD64 = ""

50
tinygo-build-windows.sh Normal file
View File

@ -0,0 +1,50 @@
#!/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="windows"
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-${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"
zip "$my_bin.zip" "$my_bin"
echo "$my_bin.zip"
); }
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