-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·54 lines (41 loc) · 1.41 KB
/
build.sh
File metadata and controls
executable file
·54 lines (41 loc) · 1.41 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
#!/bin/bash
set -e
echo "Building devrag..."
# Output directory
mkdir -p bin
# Build flags
LDFLAGS="-s -w"
TAGS=""
# Version info
VERSION=${VERSION:-"1.0.0"}
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
LDFLAGS="$LDFLAGS -X main.Version=$VERSION -X main.BuildTime=$BUILD_TIME -X main.GitCommit=$GIT_COMMIT"
echo "Version: $VERSION"
echo "Build Time: $BUILD_TIME"
echo "Git Commit: $GIT_COMMIT"
echo ""
# Note: CGO is required for sqlite-vec, so cross-compilation is limited
# Build for current platform first
echo "Building for current platform..."
CGO_ENABLED=1 go build -ldflags="$LDFLAGS" -o bin/devrag cmd/main.go
# macOS (Apple Silicon) - only on macOS arm64
if [[ "$OSTYPE" == "darwin"* ]] && [[ "$(uname -m)" == "arm64" ]]; then
echo "Building for macOS (arm64)..."
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags="$LDFLAGS" \
-o bin/devrag-darwin-arm64 cmd/main.go
echo "Building for macOS (amd64)..."
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" \
-o bin/devrag-darwin-amd64 cmd/main.go
fi
# Note: For Windows and Linux builds from macOS, you would need:
# - Windows: Install mingw-w64 cross-compiler
# - Linux: Install appropriate cross-compilation tools
# For now, we'll skip cross-platform CGO builds
echo ""
echo "Build complete!"
echo "Binaries:"
ls -lh bin/
echo ""
echo "Total size:"
du -sh bin/