26 lines
739 B
Bash
Executable File
26 lines
739 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build a static Linux/arm64 binary for LektorenPlan.
|
|
#
|
|
# Usage:
|
|
# ./scripts/build-linux-arm64.sh [output]
|
|
#
|
|
# The build is CGO-free, so the result runs on any Linux arm64 distribution
|
|
# with a reasonably recent kernel (no SQLite or libc runtime needed).
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
output="${1:-dist/lektorenplan-linux-arm64}"
|
|
version="${LP_VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo 1.0.0)}"
|
|
|
|
mkdir -p "$(dirname "$output")"
|
|
|
|
echo "Baue $output (Version $version) …"
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 \
|
|
go build -trimpath -buildvcs=false \
|
|
-ldflags "-s -w -X main.version=$version" \
|
|
-o "$output" .
|
|
|
|
echo "Fertig: $output"
|
|
file "$output" 2>/dev/null || true
|