-
Notifications
You must be signed in to change notification settings - Fork 7
/
build-qt.sh
executable file
·144 lines (122 loc) · 4.09 KB
/
build-qt.sh
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
#!/bin/bash
set -e
MINGW=${MINGW:-${ARCH:-x86_64}-w64-mingw32}
PREFIX=${PREFIX:-usr}
WORKSPACE=${WORKSPACE:-$(pwd)}
TARGET=${TARGET:-${WORKSPACE}}
WINREQ=${WINREQ:-${TARGET}/${PREFIX}}
BUILD_NUMBER=${BUILD_NUMBER:-0}
ARCH=${ARCH:-${MINGW%%-*}}
BINDIR=${BINDIR:-${PREFIX}/exe}
LIBDIR=${LIBDIR:-${PREFIX}/exe}
PLUGINDIR=${PLUGINDIR:-${PREFIX}/exe}
WININC=${WININC:-${WINREQ}/include}
WINLIB=${WINLIB:-${WINREQ}/exe}
version=
download=0
zip=0
while test $# -gt 0; do
case "$1" in
(-h|--help)
cat<<EOF
$0 [OPTIONS] [CONFIGURE-ARGUMENTS]
OPTIONS:
-h, --help show this help
-z, --zip create zip package
-v, --version specify version string
-d, --download download sources
otherwise sources must be in $(pwd)
CONFIGURE-ARGUMENTS:
Arguments that are passed to configure.
VARIABLES:
MINGW mingw parameter (default: $MINGW)
PREFIX relative installation prefix (default: $PREFIX)
WORKSPACE workspace path (default: $WORKSPACE)
WINREQ path to required windows libraries (default: $WINREQ)
TARGET installation target (default: $TARGET)
BUILD_NUMBER build number (default: $BUILD_NUMBER)
ARCH architecture (default: $ARCH)
BINDIR install dir for exe files (default: $BINDIR)
LIBDIR install dir for dll files (default: $LIBDIR)
PLUGINDIR install dir for qt plugins (default: $PLUGINDIR)
WININC path to required windows include files (default: $WININC)
WINLIB path to required windows libraries (default: $WINLIB)
DEPENDENCIES:
openssl /build-openssl.sh
icu /build-icu.sh
Builds QT for Windows
EOF
exit
;;
(-d|--download) download=1;;
(-v|--version) shift; version="$1";;
(-z|--zip) zip=1;;
(*) break;;
esac
if ! test $# -gt 0; then
echo "ERROR: missing parameter" 1>&2
exit 1
fi
shift
done
set -x
cd ${WORKSPACE}
if test $download -eq 1; then
git clone https://code.qt.io/qt/qt5.git qt5
cd qt5
if test -z "$version"; then
version=$(git branch -r | sed -n 's,^ *origin/\([0-9.]\+\)$,\1,p' | tail -1)
fi
git checkout "$version"
perl init-repository --module-subset=default,-qtwebkit,-qtwebkit-examples,-qtwebengine
elif test -d qt5; then
cd qt5
fi
if test -z "$version"; then
version=$(git branch | sed -n 's,^\* *,,p')
fi
path=qt-${version}
[[ "$version" =~ ^[0-9.]+$ ]]
echo "Version: $version"
echo "Package: $path"
git submodule foreach --recursive "git clean -dfx"
# bugfixes:
# MinGW has no uiviewsettingsinterop.h
sed -i '/^ *# *define *HAS_UI_VIEW_SETTINGS_INTEROP *$/d' qtbase/src/plugins/platforms/windows/qwin10helpers.cpp
# https://bugreports.qt.io/browse/QTBUG-38223
sed -i '/option(host_build)/d' qtactiveqt/src/tools/idc/idc.pro
# /workdir/qtwinextras/src/winextras
# qwinjumplist.cpp:404:106: error: ‘SHCreateItemFromParsingName’ was not declared in this scope
sed -i '/# *if *defined *( *_WIN32_IE *) *&& *_WIN32_IE *<< *0x0700/{s,<<,<,}' qtwinextras/src/winextras/qwinjumplist.cpp
# in qtexttospeech_sapi.cpp file sphelper.h is missing → "-skip qtspeech"
./configure -v -recheck-all -opensource -confirm-license \
-xplatform win32-g++ -device-option CROSS_COMPILE=${MINGW}- \
-no-compile-examples \
-I"${WININC}" \
-L"${WINLIB}" \
-prefix "${TARGET}/${PREFIX}" \
-bindir "${TARGET}/$BINDIR" \
-libdir "${TARGET}/$LIBDIR" \
-plugindir "${TARGET}/$PLUGINDIR" \
-libexecdir "${TARGET}/$LIBDIR" \
-system-proxies \
-opengl desktop \
-openssl-runtime \
-skip qtspeech \
-skip qtlocation \
-shared \
-release \
$*
make
make install
chmod -R u+rw "${TARGET}"
# bugfixes:
# Qt pkg-config files link to debug version in release build
# https://bugreports.qt.io/browse/QTBUG-60028
for f in "${TARGET}/${LIBDIR}"/pkgconfig/*.pc; do
sed -i 's,\(-lQt5[-_a-zA-Z0-9]*\)d,\1,g' "$f"
done
if test $zip -eq 1; then
cd "${TARGET}"
zip -r "${path}~windows.${BUILD_NUMBER}_${ARCH}.zip" "${PREFIX}"
fi