29 lines
742 B
Bash
Executable File
29 lines
742 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Define the list of target platforms
|
|
PLATFORMS=("darwin-amd64" "linux-386" "linux-amd64" "windows-386" "windows-amd64")
|
|
|
|
# Create the dist directory if it doesnt exist
|
|
mkdir -p dist
|
|
|
|
for PLATFORM in "${PLATFORMS[@]}"; do
|
|
# Extract the GOOS and GOARCH values from the platform string
|
|
GOOS=${PLATFORM%%-*}
|
|
GOARCH=${PLATFORM##*-}
|
|
echo "Building for $GOOS/$GOARCH..."
|
|
|
|
# Set the GOOS and GOARCH environment variables
|
|
export GOOS
|
|
export GOARCH
|
|
|
|
# Determine the binary extension based on the target OS
|
|
BIN_EXT=""
|
|
if [[ "$GOOS" == "windows" ]]; then
|
|
BIN_EXT=".exe"
|
|
fi
|
|
|
|
# Build the executable
|
|
go build -o "dist/JSONUIHELPER-$GOOS-$GOARCH$BIN_EXT"
|
|
done
|
|
|
|
echo "Build completed." |