Skip to content

Commit 3e91d65

Browse files
authored
added script for packaging on mac
1 parent c6e016f commit 3e91d65

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

building/macos/build.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Build FGCS for macOS (arm64 by default). Run from any directory.
5+
# Usage: ./build.sh <version>
6+
7+
if [[ ${1:-} == "" ]]; then
8+
echo "Usage: $0 <version>"
9+
echo "Example: $0 0.2.0-alpha"
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
15+
echo "Assuming location is FGCS/building/macos"
16+
cd ../../
17+
18+
echo "Building backend"
19+
cd radio
20+
source ./venv/bin/activate
21+
python3 -m pip show pyinstaller >/dev/null 2>&1 || python3 -m pip install pyinstaller
22+
23+
# Clean previous dist if present (pyinstaller asks otherwise)
24+
rm -rf dist/fgcs_backend dist/fgcs_backend.app || true
25+
26+
# Build
27+
pyinstaller \
28+
--paths ./venv/lib/python3.11/site-packages/ \
29+
--add-data="./venv/lib/python*/site-packages/pymavlink/message_definitions:message_definitions" \
30+
--add-data="./venv/lib/python*/site-packages/pymavlink:pymavlink" \
31+
--hidden-import pymavlink \
32+
--hidden-import engineio.async_drivers.threading \
33+
--windowed \
34+
--name fgcs_backend \
35+
./app.py
36+
37+
# Move backend app bundle into gcs/extras
38+
BACKEND_APP_PATH="dist/fgcs_backend.app"
39+
EXTRAS_DIR="../gcs/extras"
40+
41+
rm -rf "$EXTRAS_DIR" && mkdir -p "$EXTRAS_DIR"
42+
cp -R "$BACKEND_APP_PATH" "$EXTRAS_DIR/"
43+
44+
echo "Copied backend to ${EXTRAS_DIR}/fgcs_backend.app"
45+
46+
# Generate param definitions, then build frontend + Electron package (DMG)
47+
cd ../gcs/data
48+
python3 generate_param_definitions.py
49+
echo "Generated param definitions"
50+
51+
cd ../
52+
yarn
53+
yarn version --new-version "$VERSION" --no-git-tag-version --no-commit-hooks
54+
yarn build
55+
56+
echo "Build finished, check gcs/release/${VERSION} for output."

0 commit comments

Comments
 (0)