Skip to content

Commit

Permalink
simple build script
Browse files Browse the repository at this point in the history
  • Loading branch information
timsutton committed Sep 30, 2022
1 parent 692c00b commit 60cd66c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# speedwagon

A very simple CLI tool for downloading Apple's Xcode simulator runtimes without needing a copy of Xcode on a Mac.
A very simple CLI tool for downloading Apple's Xcode simulator runtimes without needing a copy of Xcode, or a Mac.

## Why?

Expand Down
32 changes: 32 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -eux

NAME=speedwagon

PLATFORMS=(
darwin
linux
windows
)

for platform in "${PLATFORMS[@]}"; do
exe_name="${NAME}_${platform}"

# Windows should have an .exe at the end
if [[ "${platform}" = "windows" ]]; then
exe_name="${exe_name}.exe"
fi

# macOS should be a universal binary
if [[ "${platform}" = "darwin" ]]; then
for goarch in arm64 amd64; do
GOARCH="${goarch}" go build -o "${NAME}_${goarch}"
done
lipo -create -output "${exe_name}" "${NAME}_arm64" "${NAME}_amd64"
rm -f "${NAME}_arm64" "${NAME}_amd64"
else
GOOS="${platform}" go build -o "${exe_name}"
fi
done

0 comments on commit 60cd66c

Please sign in to comment.