-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·28 lines (21 loc) · 942 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -e
VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
LDFLAGS="-X github.com/UT-CTF/landschaft/cmd.Version=${VERSION} -X github.com/UT-CTF/landschaft/cmd.BuildTime=${BUILD_TIME}"
echo "Building Landschaft ${VERSION} (${BUILD_TIME})"
echo "----------------------------------------"
# Create output directory
mkdir -p build
# Build for Linux (amd64)
echo "Building for Linux (amd64)..."
GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o build/landschaft-linux-amd64
# Build for Windows (amd64)
echo "Building for Windows (amd64)..."
GOOS=windows GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o build/landschaft-windows-amd64.exe
echo "----------------------------------------"
echo "Build complete! Binaries available in the build/ directory:"
ls -lh build/
echo "
Linux: build/landschaft-linux-amd64
Windows: build/landschaft-windows-amd64.exe"