diff --git a/.github/autobuild/linux_deb.sh b/.github/autobuild/linux_deb.sh index ad6d323ea7..eb825e5030 100755 --- a/.github/autobuild/linux_deb.sh +++ b/.github/autobuild/linux_deb.sh @@ -50,29 +50,35 @@ esac setup() { export DEBIAN_FRONTEND="noninteractive" + export APT_ARCH=$(dpkg --print-architecture) + echo "Building on ${APT_ARCH} for ${TARGET_ARCH}." setup_cross_compilation_apt_sources echo "Installing dependencies..." sudo apt-get -qq update sudo apt-get -qq --no-install-recommends -y install devscripts build-essential debhelper fakeroot libjack-jackd2-dev qtbase5-dev qttools5-dev-tools qtmultimedia5-dev - + setup_cross_compiler } setup_cross_compilation_apt_sources() { - if [[ "${TARGET_ARCH}" == amd64 ]]; then + if [[ "${TARGET_ARCH}" == "${APT_ARCH}" ]]; then return fi + echo "Building on ${APT_ARCH} for ${TARGET_ARCH}. Thus, modifying apt sources" sudo dpkg --add-architecture "${TARGET_ARCH}" - # Duplicate the original Ubuntu sources and modify them to refer to the TARGET_ARCH: - sed -rne "s|^deb.*/ ([^ -]+(-updates)?) main.*|deb [arch=${TARGET_ARCH}] http://ports.ubuntu.com/ubuntu-ports \1 main universe multiverse restricted|p" /etc/apt/sources.list | sudo dd of=/etc/apt/sources.list.d/"${TARGET_ARCH}".list - # Now take the original Ubuntu sources and limit those to the build host (i.e. non-TARGET_ARCH) architectures: - sudo sed -re 's/^deb /deb [arch=amd64,i386] /' -i /etc/apt/sources.list + + if [[ "${APT_ARCH}" == "amd64" ]]; then + # Duplicate the original Ubuntu sources and modify them to refer to the TARGET_ARCH: + sed -rne "s|^deb.*/ ([^ -]+(-updates)?) main.*|deb [arch=${TARGET_ARCH}] http://ports.ubuntu.com/ubuntu-ports \1 main universe multiverse restricted|p" /etc/apt/sources.list | sudo dd of=/etc/apt/sources.list.d/"${TARGET_ARCH}".list + # Now take the original Ubuntu sources and limit those to the build host (i.e. non-TARGET_ARCH) architectures: + sudo sed -re 's/^deb /deb [arch=amd64,i386] /' -i /etc/apt/sources.list + fi } setup_cross_compiler() { - if [[ "${TARGET_ARCH}" == amd64 ]]; then + if [[ "${TARGET_ARCH}" == "${APT_ARCH}" ]]; then return fi local GCC_VERSION=9 # 9 is the default on 20.04, there is no reason not to update once 20.04 is out of support diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 793a79174f..d2aa95cbcd 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -212,14 +212,14 @@ jobs: - config_name: Linux .deb armhf (artifacts) target_os: linux - building_on_os: ubuntu-22.04 + building_on_os: ubuntu-22.04-arm building_container: ubuntu:20.04 base_command: TARGET_ARCH=armhf ./.github/autobuild/linux_deb.sh run_codeql: false - config_name: Linux .deb arm64 (artifacts) target_os: linux - building_on_os: ubuntu-22.04 + building_on_os: ubuntu-22.04-arm building_container: ubuntu:20.04 base_command: TARGET_ARCH=arm64 ./.github/autobuild/linux_deb.sh run_codeql: false