Choose "native" cross compilation method explicitly, not implicitly with pattern matching
The "native" cross compilation method means, installing a cross compiler like gcc-armv7 in the native chroot, and using it to compile a package for a foreign architecture. This is faster than the other method, crossdirect, which uses a mix of foreign-arch chroot (+qemu) and native chroot for cross compiling. Crossdirect only works on packages which do not have dependencies compiled for the target architecture, such as the linux kernel and some firmware packages.
This issue is about changing how we detect the cross compilation method. Currently we have in pmb/config/__init__.py
:
# fnmatch for supported pkgnames, that can be directly compiled inside
# the native chroot and a cross-compiler, without using distcc
build_cross_native = ["linux-*", "arch-bin-masquerade"]
The pattern matching was somewhat fine back when we had pmaports and pmbootstrap in the same git repository, because then we could simply adjust the pattern as necessary when creating a new pmaport, without syncing both up. But now we have independent repositories, and this should be improved.
I suggest to add a pmbootstrap-specific option to APKBUILDs called pmb:cross-native
. We already have pmbootstrap specific options !pmb:kconfigcheck
and pmb:strict
(wiki), so this would be consistent. We would add that new option to all the linux-* packages, and also arch-bin-masquerade in pmaports. We should add a CI check for pmaports to have the flags set in the linux-* packages, just in case somebody is resurrecting an old port from a stale branch.
pmbootstrap would support both the explicit option and the implicit pattern matching for a transition phase, and then only the explicit option.
This topic came up, because we have a new crust firmware package (pmaports!1163 (merged)), where it is necessary to use the "native" compilation method.
A nice benefit is, that it would also allow to build some packages that match a certain pattern with this method, and others not, for example if we had two u-boot versions and only one of them would support this method for whatever reason. (I think we had something like that already and switched the pattern back and forth.)
TODO:
-
pmbootstrap: support pmb:cross-native (!1920 (merged)) -
pmaports: adjust arch-bin-masquerade and all linux-* packages (pmaports!1169 (merged)) -
pmaports: add CI test for linux-* packages (here) (pmaports!1247) -
document new pmb:cross-native option in wiki (here)