-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·207 lines (176 loc) · 5 KB
/
build.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
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
201
202
203
204
205
206
207
#!/bin/bash
# This script builds the QT libraries with eglfs backend plugins, resulting into a Debian package.
set -eu
ARCH="armhf"
UM_ARCH="sun7i" # Empty string, or sun7i for R1, or imx6dl for R2
SRC_DIR="$(pwd)"
BUILD_DIR_TEMPLATE="_build"
BUILD_DIR="${SRC_DIR}/${BUILD_DIR_TEMPLATE}"
# Debian package information
PACKAGE_NAME="${PACKAGE_NAME:-qt-ultimaker}"
QT_VERSION="5.12.3"
RELEASE_VERSION="${RELEASE_VERSION:-${QT_VERSION}}"
DEBIAN_DIR="${BUILD_DIR}/debian"
TARGET_DIR="${DEBIAN_DIR}/opt"
CROSS_COMPILE="arm-linux-gnueabihf-"
TOOLS_DIR="${SRC_DIR}/tools"
SYSROOT="${TOOLS_DIR}/sysroot"
MAKEFLAGS=-j$(($(getconf _NPROCESSORS_ONLN) - 1))
export PKG_CONFIG_PATH=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${SYSROOT}/usr/share/pkgconfig
build()
{
if [ ! -d "${TARGET_DIR}/qt" ]; then
mkdir -p "${TARGET_DIR}/qt"
fi
cd "${BUILD_DIR}"
"${SRC_DIR}/configure" \
-no-glib \
-ccache \
-no-xcb \
-no-xcb-xlib \
-confirm-license \
-opensource \
-no-compile-examples \
-no-use-gold-linker \
-nomake examples \
-nomake tests \
-nomake tools \
-no-cups \
-no-sql-db2 \
-no-sql-ibase \
-no-sql-mysql \
-no-sql-oci \
-no-sql-odbc \
-no-sql-psql \
-no-sql-sqlite \
-no-sql-sqlite2 \
-no-sql-tds \
-skip qtconnectivity \
-skip qtdoc \
-skip qtlocation \
-skip qtscript \
-skip qtsensors \
-skip qtwebchannel \
-skip qtwebengine \
-skip qtwebsockets \
-skip qtandroidextras \
-skip qtactiveqt \
-skip qttools \
-skip qt3d \
-skip qtcanvas3d \
-skip qtserialport \
-skip qtwayland \
-skip qtgamepad \
-skip qtscxml \
-skip qtfeedback \
-skip qtspeech \
-skip qtpim \
-skip qtpurchasing \
-skip qtqa \
-skip qtquickcontrols \
-skip qtremoteobjects \
-skip qtwebview \
-skip qtsystems \
-platform linux-g++-64 \
-device ultimaker-linux-sun7i \
-device-option CROSS_COMPILE="${CROSS_COMPILE}" \
-sysroot "${SYSROOT}" \
-extprefix "${TARGET_DIR}/qt"
make "${MAKEFLAGS}"
make "${MAKEFLAGS}" install
echo "Finished building."
}
build_pyqt()
{
if [ ! -d "${BUILD_DIR}/pyqt" ]; then
mkdir -p "${BUILD_DIR}/pyqt"
fi
cd "${BUILD_DIR}/pyqt"
curl -L -o pyqt5.tar.gz https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.9.2/PyQt5_gpl-5.9.2.tar.gz
tar -xf pyqt5.tar.gz
cd "PyQt5"*
python3 configure.py \
--verbose -c --confirm-license --no-designer-plugin \
--qml-debug --qml-plugindir="${TARGET_DIR}/pyqt" \
--destdir "${TARGET_DIR}/pyqt" \
--configuration "${TOOLS_DIR}/pyqt.cfg" \
--qmake="${BUILD_DIR}/qtbase/bin/qmake"
make
make install
}
create_debian_package()
{
echo "Building Debian package."
mkdir -p "${DEBIAN_DIR}/DEBIAN"
sed -e 's|@ARCH@|'"${ARCH}"'|g' \
-e 's|@PACKAGE_NAME@|'"${PACKAGE_NAME}"'|g' \
-e 's|@RELEASE_VERSION@|'"${RELEASE_VERSION}-${UM_ARCH}"'|g' \
"${SRC_DIR}/debian/control.in" > "${DEBIAN_DIR}/DEBIAN/control"
DEB_PACKAGE="${PACKAGE_NAME}_${RELEASE_VERSION}-${UM_ARCH}_${ARCH}.deb"
# Add the QT runtime environment source script
mkdir -p "${DEBIAN_DIR}/etc/qt5"
cp "${SRC_DIR}/set_qt5_eglfs_env" "${DEBIAN_DIR}/etc/qt5"
cp "${SRC_DIR}/qt_eglfs_kms_cfg.json" "${DEBIAN_DIR}/etc/qt5"
chmod +x "${DEBIAN_DIR}/etc/qt5/set_qt5_eglfs_env"
# Build the Debian package
dpkg-deb --build "${DEBIAN_DIR}" "${BUILD_DIR}/${DEB_PACKAGE}"
echo "Finished building Debian package."
echo "To check the contents of the Debian package run 'dpkg-deb -c *.deb'"
}
usage()
{
echo ""
echo "This is the build script for the QT5 graphical user interface libraries."
echo ""
echo " -c Clean the build output directory '_build'."
echo " -h Print this help text and exit"
echo ""
echo " The package release version can be passed by passing 'RELEASE_VERSION' through the run environment."
}
while getopts ":ch" options; do
case "${options}" in
c)
if [ -d "${BUILD_DIR}" ] && [ -z "${BUILD_DIR##*_build*}" ]; then
rm -rf "${BUILD_DIR}"
fi
exit 0
;;
h)
usage
exit 0
;;
:)
echo "Option -${OPTARG} requires an argument."
exit 1
;;
?)
echo "Invalid option: -${OPTARG}"
exit 1
;;
esac
done
shift "$((OPTIND - 1))"
if [ "${#}" -gt 1 ]; then
echo "Too many arguments."
usage
exit 1
fi
if [ "${#}" -eq 0 ]; then
build
build_pyqt
create_debian_package
exit 0
fi
case "${1-}" in
deb)
build
build_pyqt
create_debian_package
;;
*)
echo "Error, unknown build option given"
usage
exit 1
;;
esac
exit 0