[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
69/75: guix: build-system: cmake: Rework cross compilation.
From: |
guix-commits |
Subject: |
69/75: guix: build-system: cmake: Rework cross compilation. |
Date: |
Sun, 15 Dec 2024 18:06:42 -0500 (EST) |
janneke pushed a commit to branch core-packages-team-old
in repository guix.
commit 0ec160c00531f012b8320f2502422e1511f2e685
Author: Dariqq <dariqq@posteo.net>
AuthorDate: Wed Aug 21 18:34:50 2024 +0000
guix: build-system: cmake: Rework cross compilation.
Move the extra configure flags for cross building out from the build side
code
and instead prepend them to the configure-flags.
Use new procedure cmake-system-name-for-target to add support for the Hurd
and
bare-metal targets.
* guix/build/cmake-build-system.scm (configure): Move cross build flags from
here ...
* guix/build-system/cmake.scm (cmake-cross-build): ... to here.
(cmake-system-name-for-target): New procedure.
Signed-off-by: Janneke Nieuwenhuizen <janneke@gnu.org>
Change-Id: Ic68acc246e543491ed147e53d47cec5de46b82cb
---
guix/build-system/cmake.scm | 20 +++++++++++++++++++-
guix/build/cmake-build-system.scm | 11 -----------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index 0b8a651ee0..8a3a183524 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -39,6 +39,15 @@
;;
;; Code:
+(define* (cmake-system-name-for-target
+ #:optional (target (or (%current-target-system)
+ (%current-system))))
+ (cond ((target-hurd? target) "GNU")
+ ((target-linux? target) "Linux")
+ ((target-mingw? target) "Windows")
+ ;; For avr, or1k-elf, xtensa-ath9k-elf
+ (else "Generic")))
+
(define %cmake-build-system-modules
;; Build-side modules imported by default.
`((guix build cmake-build-system)
@@ -231,7 +240,16 @@ build system."
search-path-specification->sexp
native-search-paths)
#:phases #$phases
- #:configure-flags #$configure-flags
+ #:configure-flags
+ `(#$(string-append "-DCMAKE_C_COMPILER="
+ (cc-for-target target))
+ #$(string-append "-DCMAKE_CXX_COMPILER="
+ (cxx-for-target target))
+ #$(string-append "-DCMAKE_SYSTEM_NAME="
+ (cmake-system-name-for-target
target))
+ ,@#$(if (pair? configure-flags)
+ (sexp->gexp configure-flags)
+ configure-flags))
#:make-flags #$make-flags
#:out-of-source? #$out-of-source?
#:build-type #$build-type
diff --git a/guix/build/cmake-build-system.scm
b/guix/build/cmake-build-system.scm
index d1ff5071be..61033061c6 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -62,17 +62,6 @@
,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
;; enable verbose output from builds
"-DCMAKE_VERBOSE_MAKEFILE=ON"
-
- ;; Cross-build
- ,@(if target
- (list (string-append "-DCMAKE_C_COMPILER="
- target "-gcc")
- (string-append "-DCMAKE_CXX_COMPILER="
- target "-g++")
- (if (string-contains target "mingw")
- "-DCMAKE_SYSTEM_NAME=Windows"
- "-DCMAKE_SYSTEM_NAME=Linux"))
- '())
,@configure-flags)))
(format #t "running 'cmake' with arguments ~s~%" args)
(apply invoke "cmake" args))))
- 39/75: gnu: cyrus-sasl: Fix build mwith gcc-14., (continued)
- 39/75: gnu: cyrus-sasl: Fix build mwith gcc-14., guix-commits, 2024/12/15
- 67/75: bash-minimal: Use gcc-14 hurd/x86-linux build fix for all platforms., guix-commits, 2024/12/15
- 55/75: gnu: ldb: Update to 2.9.2; fixes build with gcc-14., guix-commits, 2024/12/15
- 56/75: gnu: flex: Use -Wno-error= for cross-build., guix-commits, 2024/12/15
- 41/75: gnu: bdb-4.8: Fix build with gcc-14., guix-commits, 2024/12/15
- 60/75: gnu: m4: Use -Wno-error= for Hurd cross-build., guix-commits, 2024/12/15
- 48/75: gnu: Add cryptsetup-minimal., guix-commits, 2024/12/15
- 62/75: gnu: texinfo-4: Use -Wno-error= for Hurd cross-build., guix-commits, 2024/12/15
- 54/75: gnu: tevent: Update to 0.16.1; fixes build with gcc-14., guix-commits, 2024/12/15
- 14/75: gnu: automake: Fix build with gcc-14., guix-commits, 2024/12/15
- 69/75: guix: build-system: cmake: Rework cross compilation.,
guix-commits <=
- 06/75: gnu: bash-minimal: Fix build for x86-linux with gcc-14., guix-commits, 2024/12/15
- 03/75: Revert "Partial revert "gnu: make-bootstrap: Update gcc-static to gcc-14, for the 64bit Hurd."", guix-commits, 2024/12/15
- 08/75: gnu: libffi: Fix build for x86_64-linux with gcc-14., guix-commits, 2024/12/15
- 11/75: gnu: gettext: Fix build with gcc-14., guix-commits, 2024/12/15
- 01/75: Revert "Partial revert "gnu: bootstrap: %bootstrap-gcc: Also wrap g++ for the 64bit Hurd."", guix-commits, 2024/12/15
- 17/75: gnu: automake-1.16.5: Skip tests., guix-commits, 2024/12/15
- 19/75: gnu: elfutils: Update to 0.192; fixes build with gcc-14., guix-commits, 2024/12/15
- 31/75: gnu: libxaw3d: Update to 1.6.6, fixes build with gcc-14., guix-commits, 2024/12/15
- 16/75: gnu: Re-Add automake-1.16.5., guix-commits, 2024/12/15
- 52/75: gnu: talloc: Update to 2.4.2; fixes build with gcc-14., guix-commits, 2024/12/15