-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
130 lines (112 loc) · 2.75 KB
/
build.py
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
import os
import subprocess
import argparse
qt_version = "5.15.10"
current_dir = os.path.dirname(os.path.realpath(__file__))
parser = argparse.ArgumentParser(
description="Build Qt 5 universal binaries for Mac OS X."
)
parser.add_argument(
"--prefix",
type=str,
default=os.path.join(current_dir, "qt-install-" + qt_version),
help="The prefix path to install Qt to.",
)
parser.add_argument(
"--modules",
type=str,
default="qtbase qtsvg",
help="The modules to build.",
)
parser.add_argument(
"--parallel",
type=int,
default=2,
help="The number of threads.",
)
args = parser.parse_args()
prefix_path = args.prefix
modules = args.modules.split(" ")
if not os.path.exists(prefix_path):
os.makedirs(prefix_path)
print("\n")
print("Installation path configured to: " + prefix_path)
print("List of modules to build: " + str(modules))
print("Number of threads: " + str(args.parallel))
print("\n")
def exec_cmd(cmd):
print(cmd + "\n")
subprocess.check_call(cmd, shell=True)
# Download and extract the tarball.
download_link = "https://download.qt.io/official_releases/qt/{}/{}/single/qt-everywhere-opensource-src-{}.tar.xz".format(
qt_version[:4],
qt_version,
qt_version
)
exec_cmd(
"curl -L -o qt-everywhere-opensource-src-{}.tar.xz ".format(qt_version)
+ download_link
)
exec_cmd("tar -xf qt-everywhere-opensource-src-{}.tar.xz".format(qt_version))
os.chdir("qt-everywhere-src-{}".format(qt_version))
configure_args = [
"-prefix " + prefix_path,
"-opensource",
"-confirm-license",
"-release",
"-nomake examples",
"-nomake tests",
'-device-option QMAKE_APPLE_DEVICE_ARCHS="x86_64 arm64"',
]
all_modules = [
"qt3d",
"qtactiveqt",
"qtandroidextras",
"qtbase",
"qtcharts",
"qtconnectivity",
"qtdatavis3d",
"qtdeclarative",
"qtdoc",
"qtgamepad",
"qtgraphicaleffects",
"qtimageformats",
"qtlocation",
"qtlottie",
"qtmacextras",
"qtmultimedia",
"qtnetworkauth",
"qtpurchasing",
"qtquick3d",
"qtquickcontrols",
"qtquickcontrols2",
"qtquicktimeline",
"qtremoteobjects",
"qtscript",
"qtscxml",
"qtsensors",
"qtserialbus",
"qtserialport",
"qtspeech",
"qtsvg",
"qttools",
"qttranslations",
"qtvirtualkeyboard",
"qtwayland",
"qtwebchannel",
"qtwebengine",
"qtwebglplugin",
"qtwebsockets",
"qtwebview",
"qtwinextras",
"qtx11extras",
"qtxmlpatterns",
]
# Only add the modules that are requested
for m in all_modules:
if m not in modules:
configure_args.append("-skip " + m)
exec_cmd("./configure " + " ".join(configure_args))
# Build and install the libraries
exec_cmd("make -j" + str(args.parallel))
exec_cmd("make install")