|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
| 3 | +sudo apt install -y lsb-release |
| 4 | + |
3 | 5 | target_arch="$1"
|
| 6 | +root_path="$(pwd)" |
| 7 | +sysroot_path="${root_path}/sysroot" |
| 8 | +sysroot_ubuntu_version="$(lsb_release -rs).1" |
| 9 | +sysroot_ubuntu_codename="$(lsb_release -cs)" |
| 10 | +host_prefix="${root_path}/qt-host" |
| 11 | +cross_prefix="${root_path}/qt-cross" |
| 12 | +target_prefix="/usr/local/qt" |
| 13 | +toolchain_config="${root_path}/.ci/qt6-toolchain.cmake" |
4 | 14 |
|
5 | 15 | case "$target_arch" in
|
6 | 16 | aarch64)
|
7 |
| - toolchain_prefix="aarch64-linux-gnu-" |
8 |
| - echo "APPIMAGE_ARCH=aarch64" >> "${GITHUB_ENV}" |
9 |
| - ;; |
10 |
| - armv7) |
11 |
| - toolchain_prefix="arm-linux-gnueabihf-" |
12 |
| - echo "APPIMAGE_ARCH=armhf" >> "${GITHUB_ENV}" |
| 17 | + target_arch_name="armv8-a" |
| 18 | + target_arch_debian_name="arm64" |
| 19 | + toolchain_name="aarch64-linux-gnu" |
| 20 | + target_platform="linux-aarch64-gnu-g++" |
13 | 21 | ;;
|
14 | 22 | esac
|
15 | 23 |
|
16 |
| -echo "$(pwd)/qt-cross/bin:$(pwd)/qt-host/libexec" >> $GITHUB_PATH |
17 |
| -echo "LD_LIBRARY_PATH=$(pwd)/qt-cross/lib:$(pwd)/qt-host/lib" >> "${GITHUB_ENV}" |
18 |
| -.ci/install-cross-compiler.sh "$target_arch" |
19 |
| -.ci/qt6-dependencies.sh |
20 |
| -if [[ "$target_arch" == "armv7" ]]; then |
21 |
| - echo "QMAKE_CC=arm-linux-gnueabihf-gcc |
22 |
| - QMAKE_CXX=arm-linux-gnueabihf-g++ |
23 |
| - QMAKE_LINK=arm-linux-gnueabihf-g++ |
24 |
| - QMAKE_LINK_SHLIB=arm-linux-gnueabihf-g++ |
25 |
| - QMAKE_AR=arm-linux-gnueabihf-ar cqs |
26 |
| - QMAKE_OBJCOPY=arm-linux-gnueabihf-objcopy |
27 |
| - QMAKE_NM=arm-linux-gnueabihf-nm -P |
28 |
| - QMAKE_STRIP=arm-linux-gnueabihf-strip" >> .qmake.conf |
29 |
| -fi |
| 24 | +toolchain_prefix="${toolchain_name}-" |
| 25 | + |
| 26 | +echo "Target architecture: ${target_arch} (${target_arch_name})" |
| 27 | + |
| 28 | +# Install dependencies |
| 29 | +${root_path}/.ci/install_cross_compiler.sh "${target_arch}" || exit 1 |
| 30 | +sudo apt install -y qemu-user-static || exit 1 |
| 31 | +sudo apt install -y symlinks || exit 1 |
| 32 | + |
| 33 | +# Prepare sysroot |
| 34 | +echo "Preparing sysroot..." |
| 35 | +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 |
| 36 | +mkdir -p "$sysroot_path" |
| 37 | +sudo tar -xvzf ubuntu-base.tar.gz -C "$sysroot_path" || exit 1 |
| 38 | +sudo update-binfmts --enable qemu-arm || exit 1 |
| 39 | +sudo mount -o bind /dev "${sysroot_path}/dev" || exit 1 |
| 40 | +sudo cp /etc/resolv.conf "${sysroot_path}/etc" || exit 1 |
| 41 | +sudo chmod 1777 "${sysroot_path}/tmp" || exit 1 |
| 42 | +sudo cp "${root_path}/.ci/qt6_deps.sh" "${sysroot_path}/" |
| 43 | +sudo chroot "$sysroot_path" /bin/bash -c "/qt6_deps.sh" || exit 1 |
| 44 | +sudo chroot "$sysroot_path" /bin/bash -c "apt update && apt install -y symlinks libssl-dev && symlinks -rc /" || exit 1 |
| 45 | +sudo umount "${sysroot_path}/dev" || exit 1 |
30 | 46 |
|
31 | 47 | # Prepare cross-tools for linuxdeploy
|
32 |
| -sudo cp /usr/bin/${toolchain_prefix}strip strip |
33 |
| -sudo mv /usr/bin/ldd /usr/bin/ldd-amd64 |
34 |
| -sudo cp .ci/bin/xldd /usr/bin/${toolchain_prefix}ldd |
35 |
| -sudo ln -s /usr/bin/${toolchain_prefix}ldd /usr/bin/ldd |
36 |
| -echo "CT_XLDD_ROOT=$(pwd)/sysroot" >> "${GITHUB_ENV}" |
| 48 | +#sudo cp /usr/bin/${toolchain_prefix}strip strip |
| 49 | +#sudo mv /usr/bin/ldd /usr/bin/ldd-amd64 |
| 50 | +#sudo cp .ci/bin/xldd /usr/bin/${toolchain_prefix}ldd |
| 51 | +#sudo ln -s /usr/bin/${toolchain_prefix}ldd /usr/bin/ldd |
| 52 | +#echo "CT_XLDD_ROOT=$(pwd)/sysroot" >> "${GITHUB_ENV}" |
0 commit comments