-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
36 lines (29 loc) · 714 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Create the build folder if it doesn't exist
if [ ! -d "./build" ]; then
mkdir -p "./build"
fi
# Specify target platforms
platforms=(
"windows/386"
"windows/amd64"
"linux/386"
"linux/amd64"
"linux/arm"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
)
# Loop through platforms and build
for platform in "${platforms[@]}"; do
echo "Building for platform: $platform"
IFS='/' read -r os arch <<< "$platform"
outputName="build/sleepsage_${os}_${arch}"
if [ "$os" == "windows" ]; then
outputName+=".exe"
fi
GOOS=$os GOARCH=$arch go build -o "$outputName" sleepsage.go
done
# Clear environment variables
export GOOS=""
export GOARCH=""