Skip to content

pmbootstrap: support native cross compile for Autoconf packages

postmarketOS Bot requested to merge zhuowei:native-cross into master

Created by: zhuowei

Note: this PR depends on #664, so its commits are duplicated in the changes list. Only the last commit is specific to this PR.

This commit adds support for cross-compiling Autotools-based packages without distcc and qemu. This should be faster and more reliable.

See #659 for more information.

This installs dependencies in the foreign arch chroot, then bind mounts the foreign chroot into the native chroot for a cross compile sysroot. Finally, this sets env variables to trigger a cross compile based on https://dev.alpinelinux.org/~tteras/bootstrap/abuild-crossbuild-aarch64.conf

Currently chocolate-doom is the only Autotools package whitelisted to build using this configuration, and the executable it builds for aarch64 seems to at least start (inside the aarch64 build chroot, not tested on device; don't have a Doom WAD handy to test with)

====

Other changes I need to do:

  • Do I need to install makedepends in the builder root as well as in the target root? Does the target root ever need the makedepends packages?

Note: some packages in upstream aports have both a makedepends_host and makedepends_build variable, which is used by abuild to install the correct packages to each sysroot. However, the kernel sources do not.

  • Make sure kernels still build
  • Whitelist a few more packages and compare builds - can pmbootstrap's compare function work for this?
  • Switch to a heuristic for whitelisting packages (maybe anything containing ./configure --host=$(HOST) or something?) - should probably be controlled by a config var?
  • Think of a way to warn when someone submits an APKBUILD that wouldn't work for cross compile?

Please suggest test cases!

Merge request reports