26 lines
647 B
Bash
Executable File
26 lines
647 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
package_name="roulette"
|
|
mkdir -p builds
|
|
|
|
platforms=(
|
|
"darwin/amd64"
|
|
"darwin/arm64"
|
|
"linux/386"
|
|
"linux/amd64"
|
|
"linux/arm"
|
|
"linux/arm64"
|
|
)
|
|
|
|
for platform in "${platforms[@]}"; do
|
|
IFS=" " read -r -a platform_split <<< "${platform//\// }"
|
|
GOOS="${platform_split[0]}"
|
|
GOARCH="${platform_split[1]}"
|
|
output_name="${package_name}-${GOOS}-${GOARCH}"
|
|
ld_flags='-s -w'
|
|
if [ "${GOOS}" == "linux" ] && [ "${GOARCH}" == "amd64" ]; then
|
|
ld_flags+=' -linkmode external -extldflags "-static"'
|
|
fi
|
|
env GOOS="${GOOS}" GOARCH="${GOARCH}" CC="musl-gcc" go build -ldflags "${ld_flags}" -o "builds/${output_name}"
|
|
done
|