This commit is contained in:
2026-04-21 13:19:17 +03:00
commit 1d52096e38
21 changed files with 8991 additions and 0 deletions

46
build.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
set -e
DIST_DIR="dist"
rm -rf "$DIST_DIR"
mkdir -p "$DIST_DIR"
PLATFORMS=(
# "darwin/amd64"
"darwin/arm64"
# "linux/amd64"
# "linux/arm64"
# "linux/arm/7"
# "windows/amd64"
# "windows/arm64"
# "freebsd/amd64"
# "freebsd/arm64"
)
for platform in "${PLATFORMS[@]}"; do
goos=$(echo "$platform" | cut -d'/' -f1)
goarch=$(echo "$platform" | cut -d'/' -f2)
goarm=""
if [[ "$goarch" == "arm" ]]; then
goarm=$(echo "$platform" | cut -d'/' -f3)
fi
output_name="gocoder-${goos}-${goarch}"
if [[ -n "$goarm" ]]; then
output_name="${output_name}v${goarm}"
fi
if [[ "$goos" == "windows" ]]; then
output_name="${output_name}.exe"
fi
echo "Building for ${goos}/${goarch} -> ${output_name}"
if [[ -n "$goarm" ]]; then
env GOOS="$goos" GOARCH="$goarch" GOARM="$goarm" go build -o "$DIST_DIR/$output_name" .
else
env GOOS="$goos" GOARCH="$goarch" go build -o "$DIST_DIR/$output_name" .
fi
done
echo ""
echo "Build complete. Files in $DIST_DIR:"
ls -lh "$DIST_DIR"