blob: f60f821ed5e3798bbe9e20b33ccc56a5b9ec7923 (
plain)
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
|
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# shellcheck source=macos-qt-cache-key.sh
. "${script_dir}/macos-qt-cache-key.sh"
usage() {
cat <<'USAGE'
Usage: build-qt-macos.sh --arch ARCH --deployment-target VERSION --prefix PATH
Builds the pinned dynamic Qt 5 source package for the requested macOS tuple.
USAGE
}
arch=""
deployment_target=""
prefix=""
while [ "$#" -gt 0 ]; do
case "$1" in
--arch)
arch="$2"
shift 2
;;
--deployment-target)
deployment_target="$2"
shift 2
;;
--prefix)
prefix="$2"
shift 2
;;
--help|-h)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 2
;;
esac
done
if [ -z "$arch" ] || [ -z "$deployment_target" ] || [ -z "$prefix" ]; then
usage >&2
exit 2
fi
case "$arch" in
arm64|x86_64)
;;
*)
echo "Unsupported macOS Qt architecture: $arch" >&2
exit 2
;;
esac
case "${arch}:${deployment_target}" in
arm64:11.0|x86_64:10.13)
;;
*)
echo "Unsupported macOS Qt deployment tuple: arch=${arch}, deployment_target=${deployment_target}" >&2
exit 2
;;
esac
if [ -e "$prefix" ] && [ -n "$(ls -A "$prefix")" ]; then
echo "Qt install prefix already exists and is not empty: $prefix" >&2
exit 1
fi
build_root="${RUNNER_TEMP:-${PWD}}/qt-${QT_VERSION}-${arch}-build"
archive="${build_root}/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz"
mkdir -p "$build_root" "$prefix"
echo "Downloading Qt ${QT_VERSION} from ${QT_SOURCE_URL}"
curl -L --fail --retry 5 --retry-delay 10 -o "$archive" "$QT_SOURCE_URL"
actual_sha256="$(macos_qt_sha256_file "$archive")"
if [ "$actual_sha256" != "$QT_SOURCE_SHA256" ]; then
echo "Qt source SHA-256 mismatch" >&2
echo "Expected: $QT_SOURCE_SHA256" >&2
echo "Actual: $actual_sha256" >&2
exit 1
fi
tar -xf "$archive" -C "$build_root"
source_dir="${build_root}/qt-everywhere-src-${QT_VERSION}"
if [ ! -d "$source_dir" ]; then
source_dir="${build_root}/qt-everywhere-opensource-src-${QT_VERSION}"
fi
if [ ! -d "$source_dir" ]; then
echo "Could not locate extracted Qt source directory under $build_root" >&2
exit 1
fi
cd "$source_dir"
export MACOSX_DEPLOYMENT_TARGET="$deployment_target"
export QMAKE_MACOSX_DEPLOYMENT_TARGET="$deployment_target"
configure_args=(
-opensource
-confirm-license
-release
-shared
-prefix "$prefix"
-nomake examples
-nomake tests
-qt-zlib
-qt-libpng
-qt-libjpeg
-qt-pcre
-qt-harfbuzz
-qt-sqlite
-securetransport
-skip qt3d
-skip qtactiveqt
-skip qtandroidextras
-skip qtcharts
-skip qtconnectivity
-skip qtdatavis3d
-skip qtdeclarative
-skip qtdoc
-skip qtgamepad
-skip qtgraphicaleffects
-skip qtimageformats
-skip qtlocation
-skip qtlottie
-skip qtmacextras
-skip qtnetworkauth
-skip qtpurchasing
-skip qtquick3d
-skip qtquickcontrols
-skip qtquickcontrols2
-skip qtquicktimeline
-skip qtremoteobjects
-skip qtscript
-skip qtscxml
-skip qtsensors
-skip qtserialbus
-skip qtspeech
-skip qtvirtualkeyboard
-skip qtwayland
-skip qtwebchannel
-skip qtwebengine
-skip qtwebglplugin
-skip qtwebview
-skip qtx11extras
-skip qtxmlpatterns
"QMAKE_MACOSX_DEPLOYMENT_TARGET=${deployment_target}"
"QMAKE_APPLE_DEVICE_ARCHS=${arch}"
)
echo "Configuring Qt ${QT_VERSION} for ${arch}, deployment target ${deployment_target}"
./configure "${configure_args[@]}"
jobs="$(sysctl -n hw.ncpu)"
make -j"$jobs"
make install
"${prefix}/bin/qtpaths" --qt-version | awk -v expected="$QT_VERSION" '
$0 != expected {
printf "Expected Qt version %s, got %s\n", expected, $0 > "/dev/stderr"
exit 1
}'
|