From 897e7f292c7a655592a29f8dbef85ccb730729cc Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 16 May 2023 10:35:47 +0200 Subject: [PATCH] Switch (again) to new arm cross-compilation toolchain. This introduce a difference between armv6 and armv8. --- kiwixbuild/dependencies/armhf.py | 38 ++++++++++++-------- kiwixbuild/platforms/armhf.py | 61 +++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 31 deletions(-) diff --git a/kiwixbuild/dependencies/armhf.py b/kiwixbuild/dependencies/armhf.py index b1501d9..7f0702f 100644 --- a/kiwixbuild/dependencies/armhf.py +++ b/kiwixbuild/dependencies/armhf.py @@ -1,36 +1,44 @@ from .base import Dependency, ReleaseDownload, NoopBuilder from kiwixbuild.utils import Remotefile +# The arm toolchains +# This is based on toolchains published here : https://github.com/tttapa/docker-arm-cross-toolchain -base_url = 'https://master.dl.sourceforge.net/project/raspberry-pi-cross-compilers/' +base_url = "https://github.com/tttapa/docker-arm-cross-toolchain/releases/download/0.1.0/" -# This is Gcc 10.3.0 and Raspberry Pi 2 and 3 only ! -armhf_base_url = base_url + 'Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Stretch/GCC%2010.3.0/Raspberry%20Pi%202%2C%203/' - -# This is Gcc 10.3.0 and ALL rapsberry Pi arch64 -aarch_base_url = base_url + 'Bonus%20Raspberry%20Pi%20GCC%2064-Bit%20Toolchains/Raspberry%20Pi%20GCC%2064-Bit%20Cross-Compiler%20Toolchains/Stretch/GCC%206.3.0/' - -class armhf_toolchain(Dependency): +class armv6_toolchain(Dependency): dont_skip = True neutral = True - name = 'armhf' + name = 'armv6' class Source(ReleaseDownload): - archive = Remotefile('cross-gcc-10.3.0-pi_2-3.tar.gz', - '6aef31703fb7bfd63065dda7fb525f1f86a0509c4358c57631a51025805278b3', - armhf_base_url + 'cross-gcc-10.3.0-pi_2-3.tar.gz') + archive = Remotefile('x-tools-armv6-rpi-linux-gnueabihf.tar.xz', + '4c371c4c5b55ebd1f3d7dd26b14703632d9ba47423f901bcd9303d83ad444434', + base_url + 'x-tools-armv6-rpi-linux-gnueabihf.tar.xz') Builder = NoopBuilder +class armv8_toolchain(Dependency): + dont_skip = True + neutral = True + name = 'armv8' + + class Source(ReleaseDownload): + archive = Remotefile('x-tools-armv8-rpi-linux-gnueabihf.tar.xz', + 'cc28f5c3f6a3e7d9985f98779c4e72224b4eb5a7e4dc2bcdefd90cb241fb94a5', + base_url + 'x-tools-armv8-rpi3-linux-gnueabihf.tar.xz') + + Builder = NoopBuilder + class aarch64_toolchain(Dependency): dont_skip = True neutral = True name = "aarch64" class Source(ReleaseDownload): - archive = Remotefile('cross-gcc-6.3.0-pi_64.tar.gz', - '1b048bb8886ad63d21797cd9129fc37b9ea0dfaac7e3c36f888aa16fbec1d320', - aarch_base_url + 'cross-gcc-6.3.0-pi_64.tar.gz') + archive = Remotefile('x-tools-aarch64-rpi3-linux-gnu.tar.xz', + '8be81d3fc47b1b280bf003646d2b623477badec4ec931944131bf412317b6332', + base_url + 'x-tools-aarch64-rpi3-linux-gnu.tar.xz') Builder = NoopBuilder diff --git a/kiwixbuild/platforms/armhf.py b/kiwixbuild/platforms/armhf.py index aada2e3..c848f8a 100644 --- a/kiwixbuild/platforms/armhf.py +++ b/kiwixbuild/platforms/armhf.py @@ -4,10 +4,8 @@ from kiwixbuild.utils import pj from kiwixbuild._global import get_target_step -class ArmhfPlatformInfo(PlatformInfo): - build = 'armhf' - arch_full = 'arm-linux-gnueabihf' - toolchain_names = ['armhf'] +# Base platform +class ArmPlatformInfo(PlatformInfo): compatible_hosts = ['fedora', 'debian'] def get_cross_config(self): @@ -20,20 +18,24 @@ class ArmhfPlatformInfo(PlatformInfo): 'host_machine': { 'system': 'linux', 'lsystem': 'linux', - 'cpu_family': 'arm', - 'cpu': 'armhf', + 'cpu_family': self.cpu_family, + 'cpu': self.cpu, 'endian': 'little', 'abi': '' } } + @property + def libdir(self): + return "lib/{}".format(self.arch_full) + @property def tlc_source(self): return get_target_step(self.build, 'source') @property def root_path(self): - return self.tlc_source.source_path + return pj(self.tlc_source.source_path, self.arch_full) @property def binaries(self): @@ -99,25 +101,52 @@ class ArmhfPlatformInfo(PlatformInfo): self.buildEnv.cmake_crossfile = self._gen_crossfile('cmake_cross_file.txt') self.buildEnv.meson_crossfile = self._gen_crossfile('meson_cross_file.txt') +class Armv6(ArmPlatformInfo): + build = "armv6" + arch_full = "armv6-rpi-linux-gnueabihf" + toolchain_names = ['armv6'] + cpu_family = 'arm' + cpu = 'armv6' -class ArmhfDyn(ArmhfPlatformInfo): - name = 'armhf_dyn' +class Armv6Dyn(Armv6): + name = 'armv6_dyn' static = False -class ArmhfStatic(ArmhfPlatformInfo): - name = 'armhf_static' +class Armv6Static(Armv6): + name = 'armv6_static' static = True -class ArmhfMixed(MixedMixin('armhf_static'), ArmhfPlatformInfo): - name = 'armhf_mixed' +class Armv6Mixed(MixedMixin('armv6_static'), Armv6): + name = 'armv6_mixed' static = False -class Aarch64(ArmhfPlatformInfo): +class Armv8(ArmPlatformInfo): + build = "armv8" + arch_full = "armv8-rpi3-linux-gnueabihf" + toolchain_names = ['armv8'] + cpu_family = 'arm' + cpu = 'armv8' + +class Armv8Dyn(Armv8): + name = 'armv8_dyn' + static = False + +class Armv8Static(Armv8): + name = 'armv8_static' + static = True + +class Armv8Mixed(MixedMixin('armv8_static'), Armv8): + name = 'armv8_mixed' + static = False + + +class Aarch64(ArmPlatformInfo): build = 'aarch64' - arch_full = 'aarch64-linux-gnu' + arch_full = 'aarch64-rpi3-linux-gnu' toolchain_names = ['aarch64'] - libdir = "lib/aarch64-linux-gnu" + cpu_family = 'aarch64' + cpu = 'aarch64' class Aarch64Dyn(Aarch64): name = 'aarch64_dyn'