28 lines
669 B
Bash
Executable File
28 lines
669 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
VERSION="${1:-$(git describe --tags --always --dirty 2>/dev/null || echo "dev")}"
|
|
LDFLAGS="-s -w -X main.version=${VERSION}"
|
|
OUTDIR="$(dirname "$0")/../dist"
|
|
mkdir -p "$OUTDIR"
|
|
|
|
echo "Building restxlsx ${VERSION}..."
|
|
echo ""
|
|
|
|
build() {
|
|
local os="$1" arch="$2" suffix="${3:-}"
|
|
local binary="${OUTDIR}/restxlsx-${os}-${arch}${suffix}"
|
|
echo " -> ${binary}"
|
|
GOOS="${os}" GOARCH="${arch}" CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" -o "${binary}" .
|
|
}
|
|
|
|
build linux amd64
|
|
build linux arm64
|
|
build windows amd64 ".exe"
|
|
build darwin amd64
|
|
build darwin arm64
|
|
|
|
echo ""
|
|
echo "Done. Binaries in ${OUTDIR}/"
|
|
ls -lh "${OUTDIR}/"
|