@@ -6,13 +6,10 @@ qt_version="$1"
66qt_modules=" $( echo $2 | tr ' ' ' ,' ) "
77target_arch=" $3 "
88root_path=" $( pwd) "
9- sysroot_path=" ${root_path} /sysroot"
10- sysroot_ubuntu_version=" $( lsb_release -rs) .1"
11- sysroot_ubuntu_codename=" $( lsb_release -cs) "
12- host_prefix=" ${root_path} /qt-host"
13- cross_prefix=" ${root_path} /qt-cross"
9+ # host_prefix="${root_path}/qt-host"
10+ host_prefix=" $QT_HOST_PATH "
11+ cross_prefix=" $QT_CROSS_PATH "
1412target_prefix=" /usr/local/qt"
15- toolchain_config=" ${root_path} /.ci/qt6-toolchain.cmake"
1613
1714case " $target_arch " in
1815 aarch64)
@@ -27,8 +24,6 @@ case "$target_arch" in
2724 ;;
2825esac
2926
30- toolchain_prefix=" ${toolchain_name} -"
31-
3227case " $target_arch " in
3328 aarch64)
3429 target_arch_debian_name=" arm64"
4035
4136echo " Qt version to build: ${qt_version} "
4237echo " Qt modules: ${qt_modules} "
43- echo " Target architecture: ${target_arch} (${target_arch_name} )"
44-
45- # Install dependencies
46- ${root_path} /.ci/qt6_deps.sh || exit 1
47- ${root_path} /.ci/install_cross_compiler.sh " ${target_arch} " || exit 1
48- sudo apt install -y qemu-user-static || exit 1
49- sudo apt install -y symlinks || exit 1
38+ echo " Target architecture: ${target_arch} (${BUILD_ARCH_NAME} )"
5039
5140# Clone Qt
5241git clone https://github.com/qt/qt5 qt || exit 1
@@ -55,40 +44,23 @@ git checkout "v$qt_version" || exit 1
5544./init-repository --module-subset=qtbase,qttools,qtdeclarative,qtsvg,${qt_modules} || exit 1
5645
5746# Build Qt (host)
58- mkdir host-build
59- cd host-build
60- echo " Building host Qt..."
61- ../configure -release -nomake examples -nomake tests -opensource -confirm-license -prefix " $host_prefix " || exit 1
62- cmake --build . --parallel $( nproc --all) || exit 1
63- echo " Installing host Qt..."
64- cmake --install . || exit 1
65- cd ..
66- rm -rf host-build
67-
68- # Prepare sysroot
69- echo " Preparing sysroot..."
70- curl " https://cdimage.ubuntu.com/ubuntu-base/releases/${sysroot_ubuntu_codename} /release/ubuntu-base-${sysroot_ubuntu_version} -base-${target_arch_debian_name} .tar.gz" > ./ubuntu-base.tar.gz || exit 1
71- mkdir -p " $sysroot_path "
72- sudo tar -xvzf ubuntu-base.tar.gz -C " $sysroot_path " || exit 1
73- sudo update-binfmts --enable qemu-arm || exit 1
74- sudo mount -o bind /dev " ${sysroot_path} /dev" || exit 1
75- sudo cp /etc/resolv.conf " ${sysroot_path} /etc" || exit 1
76- sudo chmod 1777 " ${sysroot_path} /tmp" || exit 1
77- sudo cp " ${root_path} /.ci/qt6_deps.sh" " ${sysroot_path} /"
78- sudo chroot " $sysroot_path " /bin/bash -c " /qt6_deps.sh" || exit 1
79- sudo chroot " $sysroot_path " /bin/bash -c " apt install -y symlinks && symlinks -rc /" || exit 1
47+ # mkdir host-build
48+ # cd host-build
49+ # echo "Building host Qt..."
50+ # ../configure -release -nomake examples -nomake tests -opensource -confirm-license -prefix "$host_prefix" || exit 1
51+ # cmake --build . --parallel $(nproc --all) || exit 1
52+ # echo "Installing host Qt..."
53+ # cmake --install . || exit 1
54+ # cd ..
55+ # rm -rf host-build
8056
8157# Build Qt (cross)
8258mkdir cross-build
8359cd cross-build
8460echo " Cross-compiling Qt..."
85- export BUILD_SYSROOT_PATH=${sysroot_path}
86- export BUILD_TOOLCHAIN_NAME=${toolchain_name}
87- export BUILD_TOOLCHAIN_PREFIX=${toolchain_prefix}
88- export BUILD_ARCH_NAME=${target_arch_name}
89- ../configure -release -opengl es2 -nomake examples -nomake tests -qt-host-path " $host_prefix " -xplatform " $target_platform " \
90- -device-option CROSS_COMPILE=" $toolchain_prefix " -sysroot " $sysroot_path " -opensource -confirm-license \
91- -prefix " $target_prefix " -extprefix " $cross_prefix " -- -DCMAKE_TOOLCHAIN_FILE=" $toolchain_config " \
61+ ../configure -release -opengl es2 -nomake examples -nomake tests -qt-host-path " $host_prefix " -xplatform " $BUILD_PLATFORM " \
62+ -device-option CROSS_COMPILE=" $BUILD_TOOLCHAIN_PREFIX " -sysroot " $BUILD_SYSROOT_PATH " -opensource -confirm-license \
63+ -prefix " $target_prefix " -extprefix " $cross_prefix " -- -DCMAKE_TOOLCHAIN_FILE=" $BUILD_TOOLCHAIN_CONFIG " \
9264 -DQT_FEATURE_xcb=ON -DFEATURE_xcb_xlib=ON -DQT_FEATURE_xlib=ON || exit 1
9365cmake --build . --parallel $( nproc --all) || exit 1
9466echo " Installing cross-compiled Qt..."
9769rm -rf cross-build
9870
9971# Cleanup
100- sudo umount " ${sysroot_path } /dev" || exit 1
72+ sudo umount " ${BUILD_SYSROOT_PATH } /dev" || exit 1
10173cd ..
10274rm -rf qt
10375# Required for cache
104- sudo chmod 777 -R ${sysroot_path }
76+ sudo chmod 777 -R ${BUILD_SYSROOT_PATH }
0 commit comments