-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-linux.sh
More file actions
executable file
·124 lines (103 loc) · 3.6 KB
/
Copy pathbuild-linux.sh
File metadata and controls
executable file
·124 lines (103 loc) · 3.6 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/usr/bin/env bash
# ============================================================
# SyntaxFlow — Linux Build Script
# Requires: Qt6, CMake 3.19+, GCC/Clang, Python3 dev
#
# Usage:
# chmod +x build-linux.sh
# ./build-linux.sh
#
# Optional env vars:
# QT_PATH — path to Qt6 install (default: system Qt)
# BUILD_DIR — output directory (default: ./build-linux)
# ============================================================
set -e # exit on first error
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${BUILD_DIR:-$SCRIPT_DIR/build-linux}"
echo ""
echo "============================================================"
echo " SyntaxFlow Linux Build"
echo "============================================================"
echo " Source : $SCRIPT_DIR"
echo " Output : $BUILD_DIR"
echo ""
# Clean up precompiled header to prevent timestamp mismatch on wasi-sdk rebuilds
rm -f "$SCRIPT_DIR/resources/include/stdcpp.h.pch"
# ---- Detect Qt6 Installation ----
if [ -z "$QT_PATH" ]; then
for candidate in "$HOME/Qt"/*"/gcc_64" "/opt/Qt"/*"/gcc_64"; do
if [ -d "$candidate" ]; then
QT_PATH="$candidate"
fi
done
fi
if [ -n "$QT_PATH" ] && [ -d "$QT_PATH" ]; then
export PATH="$QT_PATH/bin:$PATH"
echo " Qt prefix: $QT_PATH"
fi
# ---- Check prerequisites ----
check_cmd() {
if ! command -v "$1" &>/dev/null; then
echo "[ERROR] '$1' not found. Please install it and try again."
exit 1
fi
}
check_cmd cmake
check_cmd make
# BUILD-02: Use command -v directly for the fallback detection.
QMAKE_CMD=$(command -v qmake6 2>/dev/null || command -v qmake 2>/dev/null)
if [ -z "$QMAKE_CMD" ]; then
echo "[ERROR] Neither 'qmake6' nor 'qmake' found."
echo " Install Qt6: sudo apt install qt6-base-dev"
exit 1
fi
echo " qmake : $QMAKE_CMD"
# ---- Step 1: QScintilla (SKIPPED — Replaced by WebEngine & CodeMirror) ----
echo ""
echo "============================================================"
echo " Step 1: QScintilla (SKIPPED — Removed)"
echo "============================================================"
echo " [SKIP] QScintilla replaced by QWebEngine & CodeMirror."
# ---- Step 2: Skip TinyCC (Removed from CMake) ----
echo ""
echo "============================================================"
echo " Step 2: TinyCC (SKIPPED — Removed from CMake)"
echo "============================================================"
echo " [SKIP] TinyCC is disabled."
# ---- Step 3: CMake Configure ----
echo ""
echo "============================================================"
echo " Step 3: CMake Configure"
echo "============================================================"
# ---- Parse optional arguments ----
CLEAN_BUILD=0
for arg in "$@"; do
case "$arg" in
--clean|-c)
CLEAN_BUILD=1
;;
esac
done
if [ "$CLEAN_BUILD" -eq 1 ] && [ -d "$BUILD_DIR" ]; then
echo " [CLEAN] Removing build directory: $BUILD_DIR"
rm -rf "$BUILD_DIR"
fi
mkdir -p "$BUILD_DIR"
pushd "$BUILD_DIR" > /dev/null
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DPRECACHE_WASM_ENGINES=ON"
if [ -n "$QT_PATH" ]; then
CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_PREFIX_PATH=$QT_PATH"
fi
cmake $CMAKE_ARGS "$SCRIPT_DIR"
# ---- Step 4: Build ----
echo ""
echo "============================================================"
echo " Step 4: Build"
echo "============================================================"
make -j"$(nproc)"
popd > /dev/null
echo ""
echo "============================================================"
echo " BUILD COMPLETE"
echo " Binary: $BUILD_DIR/SyntaxFlow"
echo "============================================================"