-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_gamesa_v2.sh
More file actions
67 lines (58 loc) · 2.02 KB
/
build_gamesa_v2.sh
File metadata and controls
67 lines (58 loc) · 2.02 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
#!/bin/bash
set -e
APP_NAME="gamesa-cortex-v2"
VERSION="2.0.0"
ARCH="amd64"
DEB_NAME="${APP_NAME}_${VERSION}_${ARCH}"
BUILD_DIR="build/${DEB_NAME}"
echo "Building ${DEB_NAME}..."
# 1. Clean and Create Build Directory
rm -rf build
mkdir -p "${BUILD_DIR}/usr/local/bin"
mkdir -p "${BUILD_DIR}/usr/lib/${APP_NAME}"
mkdir -p "${BUILD_DIR}/etc/${APP_NAME}"
mkdir -p "${BUILD_DIR}/DEBIAN"
# 2. Copy Source Code
echo "Copying Source..."
cp -r gamesa_cortex_v2/src "${BUILD_DIR}/usr/lib/${APP_NAME}/"
cp -r gamesa_cortex_v2/scripts "${BUILD_DIR}/usr/lib/${APP_NAME}/"
cp gamesa_cortex_v2/README.md "${BUILD_DIR}/usr/lib/${APP_NAME}/"
# 3. Copy Docker Assets
echo "Copying Docker Configs..."
cp Dockerfile "${BUILD_DIR}/usr/lib/${APP_NAME}/"
cp docker-compose.yml "${BUILD_DIR}/usr/lib/${APP_NAME}/"
# 4. Compile Rust (If available)
if command -v cargo &> /dev/null; then
echo "Compiling Rust Planner..."
cd gamesa_cortex_v2/rust_planner
cargo build --release
cp target/release/librust_planner.so "../../${BUILD_DIR}/usr/lib/${APP_NAME}/src/core/" || echo "Warning: Rust lib copy failed."
cd ../..
else
echo "Check: Cargo not found. Skipping Rust compilation (Source only)."
cp -r gamesa_cortex_v2/rust_planner "${BUILD_DIR}/usr/lib/${APP_NAME}/"
fi
# 5. Create executable wrapper
cat <<EOF > "${BUILD_DIR}/usr/local/bin/${APP_NAME}"
#!/bin/bash
export PYTHONPATH=/usr/lib/${APP_NAME}
python3 -m src.core.npu_coordinator "\$@"
EOF
chmod +x "${BUILD_DIR}/usr/local/bin/${APP_NAME}"
# 6. Create DEBIAN/control
cat <<EOF > "${BUILD_DIR}/DEBIAN/control"
Package: ${APP_NAME}
Version: ${VERSION}
Section: science
Priority: optional
Architecture: ${ARCH}
Maintainer: Dusan <dusan@example.com>
Depends: python3 (>= 3.10), python3-numpy, vulkan-tools
Description: Gamesa Cortex V2 - AI NPU & 3D Grid Stack
Advanced Heterogeneous Computing Stack with Docker support,
Rust Planning, and Vulkan/OpenCL acceleration for 3D grids.
EOF
# 7. Build Deb
dpkg-deb --build "${BUILD_DIR}"
mv "build/${DEB_NAME}.deb" .
echo "Build Complete: ${DEB_NAME}.deb"