Skip to content

Commit

Permalink
Add script for building majokko binaries for multiple platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronsor committed Jan 3, 2023
1 parent d1580c8 commit 652f125
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
dist/
majokko
test.png
test.zng
test.jpg
test.ppm
test.bmp
test.tif
test.tga
18 changes: 18 additions & 0 deletions build_cross.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
GO="${GO:-go}"
LDFLAGS="${LDFLAGS:--w -s}"

echo "Using:"
echo "GO='$GO'"
echo "LDFLAGS='$LDFLAGS'"
echo ""

mkdir -p dist/
for cpu in amd64 386 arm arm64; do
for os in windows linux darwin; do
DISTFILE="dist/majokko-${os}-${cpu}"
CMD="GOOS='${os}' GOARCH='${cpu}' ${GO} build -o '$DISTFILE' -ldflags '$LDFLAGS' -trimpath ."
echo "= $CMD"
eval "$CMD" && echo "+ $(du -hs "$DISTFILE")" || echo "- Error: ${os} on ${cpu}"
done
done

0 comments on commit 652f125

Please sign in to comment.