blob: 7e4e2411e00d19baefb2e0e77334069be0aa3660 (
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
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
# Maintainer: Donald Carr <d at chaos-reins dot com>
# warning, you will need to install onetbb-git due to a bug which has yet to be included in a tagged release
# Cross compilation is currently broken due to Qt 6 changes
#set -x
# Documentation
# Set up the pi for Qt compilation.
# For a comprehensive set of deps I just install chromium which pulls in everything
#* I had to removed xcomposite as code path breaks
#* Remove 2 (mesa) pkgconfig files we allow to screw our mkspec
# * rm /usr/lib/pkgconfig/glesv2.pc
# * rm /usr/lib/pkgconfig/egl.pc
# I use NFS to develop against my sysroot personally: sudo mount qpi2.local:/ /mnt/pi
# NB: Mandatory edit: set this variable to point to your raspberry pi's sysroot
# Arch: build dependencies for the target device documented in PKGBUILD.libs
# Fedora: systemd-devel mesa-*-devel wayland*-devel fontconfig-devel libinput-devel freetype-devel qt-qtdeclarative-devel
pkgname="qt-sdk"
# Sanity check
_building=true
# Options
_opengl_variant="desktop"
_target_host=true
_sysroot=""
_piver=""
_use_mesa=true
_float=false
_shadow_build=true
_skip_qtwebengine=true
_skip_qtwidgets=false
_static_build=false
_build_from_local_src_tree=false
_patching=true
_minimal=false
_uber_minimal=false
if [[ -z ${startdir} ]]; then
_building=false
fi
if [[ -f build-from-local-src-tree ]]; then
_build_from_local_src_tree=true
fi
if [[ -f static ]]; then
_static_build=true
_uber_minimal=true
#_float=true
fi
if [[ -f full-build ]]; then
_minimal=false
fi
if [[ -f uber-minimal ]]; then
_uber_minimal=true
fi
# Only present for the sake of sanity testing the qpi.install script
#_piver=$LOCAL_PI_VER
#_sysroot=/mnt/pi${_piver}
# Sanity check options
if $_building && [[ -n $LOCAL_PI_VER ]]; then
if [[ -z $_piver ]]; then _piver=$LOCAL_PI_VER; fi
_sysroot=/mnt/pi${_piver}
if [[ ! -d "${_sysroot}/etc" ]]; then
echo "You have to set a valid sysroot to proceed with the build"
exit 1
fi
_pkgname="${_pkgname}-rpi${_piver}"
_target_host=false
_mkspec="linux-rpi${_piver}-g++"
_opengl_variant="es2"
case ${_piver} in
0)
;&
1)
_toolchain_name=armv6-rpi-linux-gnueabihf
_toolchain="/opt/${_toolchain_name}/bin/${_toolchain_name}-"
_float=true
;;
2)
_toolchain_name=arm-cortexa9_neon-linux-gnueabihf
_toolchain="/opt/x-tools/${_toolchain_name}/bin/${_toolchain_name}-"
_float=true
;;
3)
_toolchain_name=aarch64-rpi3-linux-gnu
_toolchain="/opt/x-tools/${_toolchain_name}/bin/${_toolchain_name}-"
;;
4)
_toolchain="${HOME}/x-tools/aarch64-spudd-linux-gnu/bin/aarch64-spudd-linux-gnu-"
;;
*)
echo "Unsupported pi variant; add support"
exit 1
;;
esac
fi
# vars
_local_qt_repo="${local_qt_repo}"
#_pkgvermajmin="5.15"
_pkgvermajmin="6.6"
_pkgverpatch=".0"
# {alpha/beta/beta2/rc}
_dev_suffix="beta1"
pkgrel=1
pkgver="${_pkgvermajmin}${_pkgverpatch}"
$_build_from_local_src_tree && pkgver=6.6.6
if [[ -n ${_dev_suffix} ]]; then
_pkgver=${pkgver}-${_dev_suffix}
pkgver=${pkgver}${_dev_suffix}
else
_pkgver=${pkgver}
fi
_release_type="development_releases"
_profiled_gpu_fn=qpi-proprietary.sh
__pkgconfigpath=${_sysroot}/usr/lib/pkgconfig
__eglpkgconfigpath="${__pkgconfigpath}/egl.pc"
__glespkgconfigpath="${__pkgconfigpath}/glesv2.pc"
_overwrite_mkspec=true
if [[ -z "${_dev_suffix}" ]]; then _release_type="official_releases"; fi
$_build_from_local_src_tree && _patching=false
# Qt Creator integration at install broken
#install=qpi.install
#rm $install
#touch $install
provides=($pkgname)
if $_static_build; then
pkgname="${pkgname}-static"
fi
if $_building && $_uber_minimal; then
_minimal=true
_skip_qtwidgets=true
fi
_libspkgname="${pkgname}-target-libs"
_libsdebugpkgname="${pkgname}-target-libs-debug"
_packaginguser=$(whoami)
_qt_package_name_prefix="qt-everywhere-src"
_source_package_name=${_qt_package_name_prefix}-${_pkgver}
_installprefix="/opt/qt/${_pkgver}"
pkgdesc="Qt SDK for both hosts and a variety of targets"
arch=("x86_64")
url="http://www.chaos-reins.com/qpi/"
license=("LGPL3" "GPL3")
optdepends=('qtcreator: Integrated IDE development')
makedepends=("git" "pkgconfig" "gcc" "gperf" "python" "clang" "cmake" "ninja" "libc++" "pcre" "harfbuzz" "mold")
#_provider=http://qt.mirror.constant.com/
_provider=https://download.qt.io
source=()
sha256sums=('65d2370489a95787121da96dad2a47250068aeacead13682dd06bd717f990aec')
conflicts=('litehtml')
if ! $_build_from_local_src_tree; then
source+=("${_provider}/${_release_type}/qt/${_pkgvermajmin}/${_pkgver}/single/${_source_package_name}.tar.xz")
#if $_building; then echo ${source[@]}; fi
fi
#echo "Source: ${source[@]}"
options=('!strip')
if ${_use_mesa}; then
_profiled_gpu_fn=qpi-mesa.sh
else
if $_building && ([[ -f ${__eglpkgconfigpath} ]] || [[ -f ${__glespkgconfigpath} ]]); then
echo "Mesa is about to eat our communal poodle; delete egl.pc and glesv2.pc in your sysroot"
exit 1
fi
fi
# callbacks
finish() {
if [[ -n ${startdir} ]]; then
cd ${startdir}
#rm $install
#touch $install
fi
}
build() {
set -o nounset
set -o pipefail
set -o errexit
local _builddir=${srcdir}/build
local _srcdir="${srcdir}/${_source_package_name}"
local _basedir="${_srcdir}/qtbase"
local additional_args=""
rm -Rf ${_builddir}
mkdir -p ${_builddir}
cd ${_builddir}
for i in ${BUILDENV[@]}; do
if [[ $i = "ccache" ]]; then
additional_args="${additional_args} -DQT_USE_CCACHE=ON"
fi
done
# Just because you can enable something doesnt mean you should
# Prepare for breakage in all your Qt derived projects
#-qtnamespace "Pi${_piver}" \
#-DQT_BUILD_SUBMODULES=qtbase;qtdeclarative \
#-D_CMAKE_TOOLCHAIN_PREFIX=llvm \
#-DCMAKE_BUILD_TYPE=RelWithDebInfo \
#-DINPUT_linker=lld \
#-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
# using clang like this results in a broken moc
#export CC=clang
#export CXX=clang++
#-DCMAKE_BUILD_TYPE=RelWithDebInfo \
#-DFEATURE_separate_debug_info=ON \
#-DFEATURE_opengles3=ON \
# pch are massive running out of space on 22GB drive vs 6GB build
local _configure_line_fn=configure_line
local _configure_line="cmake \
-GNinja \
-DINPUT_opengl=es2 \
-DFEATURE_optimize_full=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DFEATURE_separate_debug_info=ON \
-DBUILD_WITH_PCH=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DFEATURE_reduce_exports=ON \
-DFEATURE_reduce_relocations=ON \
-DQT_BUILD_TESTS=OFF \
-DQT_BUILD_EXAMPLES=OFF \
-DCMAKE_INSTALL_PREFIX:PATH=${_installprefix} \
-DBUILD_qtwebengine=OFF \
-DINPUT_linker=mold \
${additional_args}
${_srcdir}
"
echo ${_configure_line} > ${_configure_line_fn}
set &> configure_env
${_configure_line} | tee ${pkgname}-configure.log
time cmake --build . --parallel | tee ${pkgname}-build.log
set +o nounset
set +o pipefail
set +o errexit
}
create_install_script() {
local _prefix=/tmp
if [[ -n "${startdir}" ]]; then
_prefix=${startdir}
else
startdir=$PWD
fi
local _install_script_location="${_prefix}/${install}"
echo _piver="${_piver}" > ${_install_script_location}
echo _qmakepath="${_installprefix}/bin/qmake" >> ${_install_script_location}
echo _sysroot="${_sysroot}" >> ${_install_script_location}
echo _toolchain="${_toolchain}" >> ${_install_script_location}
cat "${startdir}/_${install}" >> "${_prefix}/${install}"
}
#create_install_script
package() {
#create_install_script
# Qt is now installed to $pkgdir/$sysroot/$prefix
# manually generate/decompose host/target
local _basepkgdir=${pkgdir}/${_installprefix}
local _libsdir="${startdir}/${_libspkgname}"
local _libsdebugdir="${startdir}/${_libsdebugpkgname}"
local _libspkgdir="${_libsdir}/topkg"
local _libsdebugpkgdir="${_libsdebugdir}/topkg"
local _libspkgbuild="${_libsdir}/PKGBUILD"
local _libsdebugpkgbuild="${_libsdebugdir}/PKGBUILD"
local _pkgprofiled=${_libspkgdir}/etc/profile.d
local _pkgbindir=${_libspkgdir}/usr/bin
local _profiledfn=qpi.sh
local _qpienvexecfn=qpi-env-exec
local _installed_dir="${pkgdir}/${_sysroot}/${_installprefix}"
local _installed_dir_sans_sysroot_offset="${pkgdir}/${_installprefix}"
local _builddir=${srcdir}/build
rm -Rf ${_libspkgdir} ${_libsdebugpkgdir} ${pkgdir}
mkdir -p ${_libspkgdir} ${_libsdebugpkgdir} ${pkgdir}
cd "${_builddir}"
echo "Installing to ${pkgdir}"
DESTDIR="$pkgdir" cmake --install . | tee ${pkgname}-install.log
#DESTDIR="$pkgdir" cmake --install . --target install_docs
# find ${_installed_dir} -name '*.debug' -exec cp --parents '{}' ${_libsdebugpkgdir} \; -exec rm '{}' \;
# cp ${startdir}/PKGBUILD.libs.debug ${_libsdebugpkgbuild}
#
# sed -i "s/libspkgrel/${pkgrel}/" ${_libsdebugpkgbuild}
# sed -i "s/libspkgver/${pkgver}/" ${_libsdebugpkgbuild}
#if $_target_host || $_static_build; then
# sed -i "s/libspkgname/${pkgname}/" ${_libsdebugpkgbuild}
#else
# sed -i "s/libspkgname/${_libspkgname}/" ${_libsdebugpkgbuild}
#fi
# sed -i "s/libsdebugpkgname/${_libsdebugpkgname}/" ${_libsdebugpkgbuild}
# sed -i "s/libspiver/${_piver}/" ${_libsdebugpkgbuild}
#
# cd ${_libsdebugdir}
# runuser -l ${_packaginguser} -c 'makepkg -d -f' || exit 1
# #mv ${_libsdebugdir}/${_libsdebugpkgname}-${pkgver}-${pkgrel}-any.pkg.tar.* ${startdir}
#
# if $_static_build || $_target_host; then
# if ! $_target_host; then
# mkdir $(dirname ${_installed_dir_sans_sysroot_offset})
# mv ${_installed_dir} `dirname ${_installed_dir_sans_sysroot_offset}`
# fi
# else
# mv `dirname ${_installed_dir}` ${_libspkgdir}
#
# cp ${_bindir}/configure_line ${_bindir}/config.opt ${_libspkgdir}
#
# cp ${startdir}/PKGBUILD.libs ${_libspkgbuild}
#
# # set correct libs version
# sed -i "s/libspkgrel/${pkgrel}/" ${_libspkgbuild}
# sed -i "s/libspkgver/${pkgver}/" ${_libspkgbuild}
# sed -i "s/libspkgname/${_libspkgname}/" ${_libspkgbuild}
# sed -i "s/libspiver/${_piver}/" ${_libspkgbuild}
#
# mkdir -p ${_pkgprofiled}
# mkdir -p ${_pkgbindir}
#
# cp -L ${startdir}/${_profiledfn} ${_pkgprofiled}
# cp -L ${startdir}/${_profiled_gpu_fn} ${_pkgprofiled}
# cp -L ${startdir}/${_qpienvexecfn} ${_pkgbindir}
# sed -i "s,localpiprefix,${_installprefix}," ${_pkgprofiled}/${_profiledfn}
#
# cd ${_libsdir}
# runuser -l ${_packaginguser} -c 'makepkg -d -f' || exit 1
# #mv ${_libsdir}/${_libspkgname}-${pkgver}-${pkgrel}-any.pkg.tar.* ${startdir}
# fi
cp configure_line config.summary ${_basepkgdir}
}
|