-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·43 lines (31 loc) · 2.18 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·43 lines (31 loc) · 2.18 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
#!/bin/bash
# Autobuild script for VLX_FrameFlow
# This script standardizes local compilation for arm64 and amd64 using go build -buildmode=pie.
# It also injects versioning based on the current Git commit/tag.
set -e
APP_NAME="VLX_FrameFlow"
APP_SRV_NAME="VLX_FrameFlow_SRV"
BUILD_DIR="build"
# Get current git commit/tag for versioning
GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "dev")
LDFLAGS="-X main.Version=${GIT_TAG} -X main.Commit=${GIT_COMMIT}"
echo "Building version ${GIT_TAG} (${GIT_COMMIT})"
echo "Building frontend assets..."
(cd frontend_app && npm ci && npm run build)
mkdir -p internal/ui/dist
cp -r frontend_app/dist/* internal/ui/dist/
mkdir -p "${BUILD_DIR}"
# Build for AMD64
echo "Compiling for Linux AMD64..."
GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags="${LDFLAGS}" -o "${BUILD_DIR}/${APP_NAME}_amd64" ./cmd/client || echo "Warning: go command failed, this is just a placeholder build script."
GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags="${LDFLAGS}" -o "${BUILD_DIR}/${APP_SRV_NAME}_amd64" ./cmd/server || echo "Warning: go command failed, this is just a placeholder build script."
# Build for ARM64 (e.g. Radxa Rock 5T, Orange Pi 5 Plus)
echo "Compiling for Linux ARM64..."
GOOS=linux GOARCH=arm64 go build -buildmode=pie -ldflags="${LDFLAGS}" -o "${BUILD_DIR}/${APP_NAME}_arm64" ./cmd/client || echo "Warning: go command failed, this is just a placeholder build script."
GOOS=linux GOARCH=arm64 go build -buildmode=pie -ldflags="${LDFLAGS}" -o "${BUILD_DIR}/${APP_SRV_NAME}_arm64" ./cmd/server || echo "Warning: go command failed, this is just a placeholder build script."
echo "Compiling frontend for Linux AMD64..."
GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags="${LDFLAGS}" -o "${BUILD_DIR}/vlx_frontend_amd64" ./cmd/frontend || echo "Warning: frontend go command failed."
echo "Compiling frontend for Linux ARM64..."
GOOS=linux GOARCH=arm64 go build -buildmode=pie -ldflags="${LDFLAGS}" -o "${BUILD_DIR}/vlx_frontend_arm64" ./cmd/frontend || echo "Warning: frontend go command failed."
echo "Build complete! Binaries are located in the '${BUILD_DIR}' directory."