-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.sh
More file actions
198 lines (154 loc) · 5.72 KB
/
Copy pathbuild.sh
File metadata and controls
198 lines (154 loc) · 5.72 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
# SPDX-License-Identifier: BSD-3-Clause
set -e
if [ -z "$QTBIN" ]; then
echo ""
echo "ERROR: QTBIN is not set."
echo " QTBIN must point to the Qt bin directory, e.g.:"
echo " export QTBIN=/path/to/Qt/<version>/gcc_64/bin"
echo " Then re-run this script."
exit 1
fi
if [ ! -d "$QTBIN" ]; then
echo ""
echo "ERROR: QTBIN directory does not exist: $QTBIN"
echo " Install Qt 6.9+ via the Qt Online Installer (https://www.qt.io/download-qt-installer-oss)"
echo " and include the GCC 64-bit component, then update QTBIN."
exit 1
fi
if ! echo "$QTBIN" | grep -q "gcc_64"; then
echo ""
echo "ERROR: QTBIN does not point to a GCC 64-bit Qt installation."
echo " QTBIN is currently: $QTBIN"
echo " A Linux build requires the Qt GCC 64-bit component. QTBIN must contain 'gcc_64', e.g.:"
echo " export QTBIN=/path/to/Qt/<version>/gcc_64/bin"
exit 1
fi
if ! command -v ninja &>/dev/null; then
echo ""
echo "ERROR: ninja not found in PATH."
echo " Install ninja via your package manager, e.g.:"
echo " sudo apt install ninja-build"
echo " Or via the Qt installer (Tools > Ninja)."
exit 1
fi
export PATH="$QTBIN:$PATH"
###############################################################################
# Clean start
###############################################################################
rm -rf build __Builds
###############################################################################
# Debug Build
###############################################################################
cmake -S . -B build/Debug \
-DCMAKE_PREFIX_PATH="$(dirname "$QTBIN")" \
-DCMAKE_COLOR_DIAGNOSTICS=ON \
-DCMAKE_GENERATOR=Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS_INIT=-DQT_QML_DEBUG
cmake --build build/Debug
###############################################################################
# Release Build
###############################################################################
cmake -S . -B build/Release \
-DCMAKE_PREFIX_PATH="$(dirname "$QTBIN")" \
-DCMAKE_COLOR_DIAGNOSTICS=ON \
-DCMAKE_GENERATOR=Ninja \
-DCMAKE_BUILD_TYPE=Release
cmake --build build/Release
###############################################################################
# Qt Runtime Deployment
###############################################################################
echo ""
echo "=========================================================="
echo "Deploying Qt Runtime"
echo "=========================================================="
QT_ROOT="$(dirname "$QTBIN")"
DEPLOY_BIN_DIR="__Builds/Linux/Release/bin"
DEPLOY_LIB_DIR="__Builds/Linux/Release/lib"
DEPLOY_PLUGIN_DIR="__Builds/Linux/Release/plugins"
mkdir -p "$DEPLOY_LIB_DIR"
mkdir -p "$DEPLOY_PLUGIN_DIR"
###############################################################################
# Copy Qt Runtime Libraries
###############################################################################
echo ""
echo "Copying Qt runtime libraries..."
find "$QT_ROOT/lib" \
-maxdepth 1 \
-name "libQt6*.so*" \
-exec cp -a {} "$DEPLOY_LIB_DIR/" \;
echo "Qt runtime libraries copied."
###############################################################################
# Copy ICU Libraries
###############################################################################
echo ""
echo "Copying ICU libraries..."
for icu_lib in libicui18n.so libicuuc.so libicudata.so; do
find "$QT_ROOT/lib" -name "${icu_lib}*" -exec cp -a {} "$DEPLOY_LIB_DIR/" \; 2>/dev/null || true
done
###############################################################################
# Deploy Qt Plugins
###############################################################################
echo ""
echo "Deploying Qt plugins..."
for plugin_dir in \
iconengines \
imageformats \
platforminputcontexts \
platforms \
platformthemes \
xcbglintegrations
do
if [ -d "$QT_ROOT/plugins/$plugin_dir" ]; then
mkdir -p "$DEPLOY_PLUGIN_DIR/$plugin_dir"
echo " $plugin_dir"
cp -a "$QT_ROOT/plugins/$plugin_dir/." "$DEPLOY_PLUGIN_DIR/$plugin_dir/"
fi
done
###############################################################################
# Fix RUNPATH for deployed binaries
###############################################################################
echo ""
echo "Fixing RUNPATH..."
find "$DEPLOY_BIN_DIR" -type f -executable | while read -r exe; do
patchelf --set-rpath '$ORIGIN/../lib' "$exe" 2>/dev/null || true
done
###############################################################################
# Validate deployment
###############################################################################
echo ""
echo "Checking for broken library symlinks..."
BROKEN_SYMLINKS=$(find "$DEPLOY_LIB_DIR" -xtype l 2>/dev/null || true)
if [ -n "$BROKEN_SYMLINKS" ]; then
echo ""
echo "ERROR: Broken library symlinks detected:"
echo "$BROKEN_SYMLINKS"
exit 1
fi
echo "No broken library symlinks detected."
###############################################################################
# Summary
###############################################################################
echo ""
echo "=========================================================="
echo "Qt Deployment Complete"
echo "=========================================================="
echo ""
echo "Release Output:"
echo " __Builds/Linux/Release"
echo ""
echo "Libraries:"
echo " $DEPLOY_LIB_DIR"
echo ""
echo "Plugins:"
echo " $DEPLOY_PLUGIN_DIR"
echo ""
echo "Library Count:"
find "$DEPLOY_LIB_DIR" -type f | wc -l
echo ""
echo "Plugin Count:"
find "$DEPLOY_PLUGIN_DIR" -type f | wc -l
echo ""
echo "Check __Builds directory"