-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathqt6_compile.sh
More file actions
executable file
·200 lines (177 loc) · 4.26 KB
/
qt6_compile.sh
File metadata and controls
executable file
·200 lines (177 loc) · 4.26 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
199
200
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
. $(dirname $0)/commons.sh
POSITIONAL=()
JOBS=8
BUILDDIR=
helpFunction() {
print G "Usage:"
print N "\t$0 <QT_source_folder> <destination_folder> [options]"
print N ""
print N "Build options:"
print N " -j, --jobs NUM Parallelize build across NUM processes. (default: 8)"
print N " -b, --build DIR Build in DIR. (default: <QT_source_folder>/build)"
print N " -h, --help Display this message and exit."
print N ""
print N "Any other arguments will be passed to the Qt configure script."
exit 0
}
print N "This script compiles Qt6 statically"
print N ""
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-j | --jobs)
JOBS="$2"
shift
shift
;;
-b | --build)
BUILDDIR="$2"
shift
shift
;;
-h | --help)
helpFunction
;;
*)
POSITIONAL+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ $# -lt 2 ]]; then
helpFunction
fi
[ -d "$1" ] || die "Unable to find the QT source folder."
SRCDIR=$(cd $1 && pwd)
shift
PREFIX=$1
shift
if [[ -z "$BUILDDIR" ]]; then
BUILDDIR=$SRCDIR/build
fi
LINUX="
-openssl-runtime \
-egl \
-opengl es2 \
-no-icu \
-no-linuxfb \
-system-freetype \
-fontconfig \
-bundled-xcb-xinput \
-feature-qdbus \
-feature-wayland \
-no-feature-gssapi \
-no-feature-zstd \
-xcb \
--
"
MACOS="
-skip qtwayland \
-no-feature-qdbus \
-qt-freetype \
-appstore-compliant \
-feature-texthtmlparser \
-- \
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64'
"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
print N "Configure for linux"
PLATFORM=$LINUX
# Force Qt to select OpenSSL 3.x if multiple major versions are installed.
if pkg-config --exists libssl3; then
PLATFORM+="-DOPENSSL_ROOT_DIR=\"$(pkg-config --variable=includedir libssl3)/openssl3;$(pkg-config --variable=libdir libssl3)/openssl3\""
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
print N "Configure for darwin"
PLATFORM=$MACOS
else
die "Unsupported platform (yet?)"
fi
# There is a QT-Linguist GUI tool that
# we cannot feature flag off, and itself does not properly
# check during configure if it can be built.
# so nuclear option here.
# rm -rf qttools/src/linguist/linguist
# mkdir qttools/src/linguist/linguist
# echo "return()" > qttools/src/linguist/linguist/CMakeLists.txt
# Create the installation prefix, and convert to an absolute path.
mkdir -p $PREFIX
PREFIX=$(cd $PREFIX && pwd)
print Y "Wait..."
mkdir -p $BUILDDIR
(cd $BUILDDIR && bash $SRCDIR/configure \
$* \
--prefix=$PREFIX \
-opensource \
-confirm-license \
-release \
-static \
-strip \
-silent \
-nomake tests \
-make libs \
-no-feature-sql-odbc \
-no-feature-qtattributionsscanner \
-no-feature-qtdiag \
-no-feature-qtplugininfo \
-no-feature-pixeltool \
-no-feature-distancefieldgenerator \
-no-feature-assistant \
-no-feature-tiff \
-no-feature-webp \
-no-feature-cups \
-no-feature-textmarkdownwriter \
-no-feature-itemmodeltester \
-no-feature-sql-sqlite \
-no-feature-sql \
-skip qt3d \
-skip qtdoc \
-skip qtgrpc \
-skip qtconnectivity \
-skip qtquickeffectmaker \
-skip qtquicktimeline \
-skip qtwebengine \
-skip qtwebview \
-skip qtlocation \
-skip qtmultimedia \
-skip qtserialport \
-skip qtsensors \
-skip qtgamepad \
-skip qtgraphs \
-skip qtandroidextras \
-skip qtquick3dphysics \
-skip qtactiveqt \
-skip qtcharts \
-skip qtcoap \
-skip qtdatavis3d \
-skip qtgrpc \
-skip qtremoteobjects \
-skip qtlottie \
-skip qtmqtt \
-skip qtopcua \
-skip qtpositioning \
-skip qtquick3d \
-skip qtscxml \
-skip qtserialbus \
-skip qtserialport \
-skip qtspeech \
-skip qtvirtualkeyboard \
-skip qtweb \
-feature-imageformat_png \
-feature-optimize_full \
-feature-xml \
-qt-doubleconversion \
-qt-libpng \
-qt-zlib \
-qt-pcre \
$PLATFORM) || die "Configuration error."
print Y "Compiling..."
cmake --build $BUILDDIR --parallel $JOBS || die "Make failed"
print Y "Installing..."
cmake --install $BUILDDIR || die "Make install failed"
print G "All done!"