diff mbox series

[bug#63641,3/8] gnu: gnumach-headers: Cross-build without relying on x86.

Message ID 9ce52afdf9e69355ba0011bbaba3bbeefab3fb11.1684745752.git.dev@jpoiret.xyz
State New
Headers show
Series Add libc specific to Hurd and update components | expand

Commit Message

Josselin Poiret May 22, 2023, 9:04 a.m. UTC
From: Josselin Poiret <dev@jpoiret.xyz>

* gnu/packages/hurd.scm (gnumach-headers): Remove configure flags where we
say the builder is running x86.
* gnu/packages/cross-base.scm (cross-gnumach-headers): Work around limitation
of build system, by manually changing the target host_cpu without relying on
--host, because we don't have a working cross-compiler yet.
---
 gnu/packages/cross-base.scm | 18 ++++++++++++++++++
 gnu/packages/hurd.scm       | 10 ----------
 2 files changed, 18 insertions(+), 10 deletions(-)

Comments

Janneke Nieuwenhuizen May 23, 2023, 9:32 p.m. UTC | #1
Josselin Poiret via Guix-patches via writes:

Hi!

> From: Josselin Poiret <dev@jpoiret.xyz>
>
> * gnu/packages/hurd.scm (gnumach-headers): Remove configure flags where we
> say the builder is running x86.
> * gnu/packages/cross-base.scm (cross-gnumach-headers): Work around limitation
> of build system, by manually changing the target host_cpu without relying on
> --host, because we don't have a working cross-compiler yet.

[..]

Please add your copyright to both files, otherwise LGTM!
diff mbox series

Patch

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 50e86083c3..01c2295853 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -374,6 +374,24 @@  (define* (cross-gnumach-headers target
     (inherit gnumach-headers)
     (name (string-append (package-name gnumach-headers)
                          "-cross-" target))
+    (arguments
+     (substitute-keyword-arguments (package-arguments gnumach-headers)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            ;; Cheat by setting the host_cpu variable manually, since using
+            ;; --host= would require a working cross-compiler, which we don't
+            ;; have yet.
+            (add-after 'unpack 'substitute-host-cpu
+              (lambda _
+                (substitute* "configure.ac"
+                  (("AC_CANONICAL_HOST")
+                   #$(string-append
+                      "host_cpu="
+                      (match target
+                        ((? target-x86-32?)
+                         "i386")
+                        ((? target-x86-64?)
+                         "x86_64")))))))))))
     (native-inputs
      (modify-inputs (package-native-inputs gnumach-headers)
        (prepend xgcc xbinutils)))))
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 34c7c00f2d..a6f0f76009 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -88,16 +88,6 @@  (define-public gnumach-headers
            (lambda _
              (invoke "make" "install-data")))
          (delete 'build))
-
-       ;; GNU Mach supports only IA32 currently, so cheat so that we can at
-       ;; least install its headers.
-       ,@(if (%current-target-system)
-             '()
-             ;; See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00042.html>
-             ;; <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00716.html>
-             '(#:configure-flags '("--build=i586-pc-gnu"
-                                   "--host=i686-linux-gnu")))
-
        #:tests? #f))
     (native-inputs
      (list autoconf automake texinfo-4))