Subject: [bug#72751] [PATCH 0/2] Rework cmake cross compiling.

From: Dariqq <[email-masked]>
Date: Wed, 21 Aug 2024 18:05:44 +0000

Hi,

This is an attempt to move the cross compile logic out of the build side.

This should fix https://issues.guix.gnu.org/72697 and technically supersedes https://issues.guix.gnu.org/68366 .
Also cleans up after https://issues.guix.gnu.org/69476 by removing the need for CMAKE_SYSTEM_NAME override.

Main benefit is that this decouples the cmake native compilation and cmake cross compilation, i.e. if a new target needs a new CMAKE_SYSTEM_NAME we don't need to touch build code to enable it and thus don't need to rebuild everything natively for something only affecting cross building.

Also use the target-*? functions and c*-for-target instead of reimplementing them in build code.

The new cmake-system-name-for-target (a bit long, idk) now also supports hurd and bare-metal targets.

I have tested this with the package i had troubles in #72697, and also verified that the ath9k firmware hashes are unchanged.

Output of guix hash:

/gnu/store/0r075s8g9pr9i6yd3pvwfjl2g4mkm7s8-ath9k-htc-ar9271-firmware-1.4.0/lib/firmware/htc_9271.fw 
0bi0m4y1g8i47mal4m11pry88kjqqyk2209hw5yj2awngp31qj55

/gnu/store/msjnrh864a2c8k44hvwqs6fra7c7bb6v-ath9k-htc-ar7010-firmware-1.4.0/lib/firmware/htc_7010.fw 
01hl01gv66k8g5avw85fbfyzblsy1ccmv64wq7g3zbgdwcb4ry7f

Unfortunely this will cause a lot of rebuilds (but this will be hopefully easier in the future).

Dariqq (2):
  guix: build-system: cmake: Rework cross compilation.
  gnu: ath9k-firmware: Remove CMAKE_SYSTEM_NAME override.

 gnu/packages/firmware.scm         |  6 ++----
 guix/build-system/cmake.scm       | 19 ++++++++++++++++++-
 guix/build/cmake-build-system.scm | 11 -----------
 3 files changed, 20 insertions(+), 16 deletions(-)

base-commit: 7a149c6003d25e8b2794b113d34062be134d7710
-- 
2.45.2