Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·78 lines (65 loc) · 2.55 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·78 lines (65 loc) · 2.55 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Cross-platform build script for Vertex
set -e
# Try to get version from git tag
if [ -z "$VERSION" ]; then
GIT_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "")
if [ -n "$GIT_TAG" ]; then
# If we're on a tag, use it (strip 'v' prefix if present)
VERSION=$(echo "$GIT_TAG" | sed 's/^v//')
else
# Otherwise, try to get the latest tag + commit count
GIT_DESCRIBE=$(git describe --tags --always 2>/dev/null || echo "")
if [ -n "$GIT_DESCRIBE" ]; then
VERSION="$GIT_DESCRIBE"
else
VERSION="dev"
fi
fi
fi
COMMIT=${COMMIT:-$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")}
DATE=${DATE:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")}
BUILD_FLAGS="-ldflags=-X main.version=$VERSION -X main.commit=$COMMIT -X main.date=$DATE"
echo "🏗️ Building Vertex Service Manager"
echo " Version: $VERSION"
echo " Commit: $COMMIT"
echo " Date: $DATE"
echo ""
# Build for current platform
echo "📦 Building for current platform..."
go build $BUILD_FLAGS -o vertex .
# Build for all platforms
echo "🌍 Building for all platforms..."
# Windows
echo " 🪟 Building for Windows (amd64)..."
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build $BUILD_FLAGS -o vertex-windows-amd64.exe . 2>/dev/null || {
echo " ⚠️ Cross-compilation for Windows failed (CGO/SQLite dependency)"
echo " ℹ️ To build for Windows, run this on a Windows machine:"
echo " go build $BUILD_FLAGS -o vertex.exe ."
}
# Linux
echo " 🐧 Building for Linux (amd64)..."
GOOS=linux GOARCH=amd64 go build $BUILD_FLAGS -o vertex-linux-amd64 . 2>/dev/null || {
echo " ⚠️ Cross-compilation for Linux failed"
}
# macOS
echo " 🍎 Building for macOS (amd64)..."
GOOS=darwin GOARCH=amd64 go build $BUILD_FLAGS -o vertex-darwin-amd64 . 2>/dev/null || {
echo " ⚠️ Cross-compilation for macOS amd64 failed"
}
echo " 🍎 Building for macOS (arm64)..."
GOOS=darwin GOARCH=arm64 go build $BUILD_FLAGS -o vertex-darwin-arm64 . 2>/dev/null || {
echo " ⚠️ Cross-compilation for macOS arm64 failed"
}
echo ""
echo "✅ Build completed!"
echo ""
echo "📁 Generated files:"
ls -la vertex* 2>/dev/null | grep -E "(vertex-|vertex$)" || echo " • vertex (current platform)"
echo ""
echo "🚀 Installation:"
echo " • Current platform: Use the 'vertex' binary"
echo " • Linux: sudo ./install.sh"
echo " • Windows: powershell -ExecutionPolicy Bypass -File install.ps1"
echo ""
echo "📖 See INSTALLATION.md for detailed instructions"