roulette/build.sh

57 lines
1.1 KiB
Bash
Raw Normal View History

2022-09-08 15:12:06 +00:00
#!/usr/bin/env bash
package_name="roulette"
mkdir -p builds
platforms=(
"aix/ppc64"
2022-09-08 15:12:06 +00:00
"darwin/amd64"
"darwin/arm64"
"dragonfly/amd64"
"freebsd/386"
"freebsd/amd64"
"freebsd/arm"
"freebsd/arm64"
2023-02-06 15:26:54 +00:00
"freebsd/riscv64"
"js/wasm"
2022-09-08 15:12:06 +00:00
"linux/386"
"linux/amd64"
"linux/arm"
"linux/arm64"
"linux/loong64"
"linux/mips"
"linux/mips64"
"linux/mips64le"
"linux/mipsle"
"linux/ppc64"
"linux/ppc64le"
"linux/riscv64"
"linux/s390x"
"netbsd/386"
"netbsd/amd64"
"netbsd/arm"
"netbsd/arm64"
"openbsd/386"
"openbsd/amd64"
"openbsd/arm"
"openbsd/arm64"
"openbsd/mips64"
"wasip1/wasm"
2022-10-23 21:49:32 +00:00
"windows/386"
"windows/amd64"
"windows/arm"
"windows/arm64"
2022-09-08 15:12:06 +00:00
)
for platform in "${platforms[@]}"; do
IFS=" " read -r -a platform_split <<< "${platform//\// }"
2022-09-08 15:12:06 +00:00
GOOS="${platform_split[0]}"
GOARCH="${platform_split[1]}"
output_name="${package_name}-${GOOS}-${GOARCH}"
ld_flags='-s -w'
2022-10-23 21:49:32 +00:00
if [ "${GOOS}" == "windows" ]; then
output_name+=".exe"
2022-09-08 15:12:06 +00:00
fi
2023-08-31 02:09:10 +00:00
env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" CGO_ENABLED=0 go build -trimpath -ldflags "${ld_flags}" -o "builds/${output_name}"
2022-09-08 15:12:06 +00:00
done