Skip to content

Commit 60cd66c

Browse files
committed
simple build script
1 parent 692c00b commit 60cd66c

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# speedwagon
22

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

55
## Why?
66

build.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
NAME=speedwagon
6+
7+
PLATFORMS=(
8+
darwin
9+
linux
10+
windows
11+
)
12+
13+
for platform in "${PLATFORMS[@]}"; do
14+
exe_name="${NAME}_${platform}"
15+
16+
# Windows should have an .exe at the end
17+
if [[ "${platform}" = "windows" ]]; then
18+
exe_name="${exe_name}.exe"
19+
fi
20+
21+
# macOS should be a universal binary
22+
if [[ "${platform}" = "darwin" ]]; then
23+
for goarch in arm64 amd64; do
24+
GOARCH="${goarch}" go build -o "${NAME}_${goarch}"
25+
done
26+
lipo -create -output "${exe_name}" "${NAME}_arm64" "${NAME}_amd64"
27+
rm -f "${NAME}_arm64" "${NAME}_amd64"
28+
else
29+
GOOS="${platform}" go build -o "${exe_name}"
30+
fi
31+
done
32+

0 commit comments

Comments
 (0)