Skip to content

Commit

Permalink
Detect OS in mkdist.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jangler committed Mar 31, 2024
1 parent 96afd77 commit 8569660
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions misc/mkdist.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash

# puts together a release folder for a target GOOS.
# puts together a release folder for the host OS.
# requires dos2unix.
# cross-compilation not currently supported.

set -euo pipefail
IFS=$'\t\n'
Expand All @@ -12,21 +11,19 @@ if [ "$(basename $(pwd))" == misc ]; then
exit 1
fi

case "$GOOS" in
linux)
go build -tags static -ldflags "-s -w" -o ftone ./faunatone/
;;
windows)
CGO_LDFLAGS="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic -mwindows" \
go build -tags static -ldflags "-s -w -H windowsgui" -o ftone.exe ./faunatone/
;;
"")
echo "error: GOOS not set"
case $(uname) in
Darwin)
echo "error: macOS build not implemented"
exit 1
;;
Linux)
GOOS=linux
go build -tags static -ldflags "-s -w" -o ftone ./faunatone/
;;
*)
echo "error: unsupported GOOS: $GOOS"
exit 1
GOOS=windows
CGO_LDFLAGS="-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic -mwindows" \
go build -tags static -ldflags "-s -w -H windowsgui" -o ftone.exe ./faunatone/
;;
esac

Expand Down

0 comments on commit 8569660

Please sign in to comment.