diff mbox series

[bug#74290,06/31] gnu: cross-libc: Support cross-building for the 64bit Hurd.

Message ID 5d540a65fb1897c844300061df1eb72ec630c4b8.1731232753.git.janneke@gnu.org
State New
Headers show
Series Add support for x86_64-gnu, aka the 64bit Hurd. | expand

Commit Message

Janneke Nieuwenhuizen Nov. 10, 2024, 10:38 a.m. UTC
* gnu/packages/base.scm (glibc)[arguments]: When building for the Hurd, in
phase "create-machine-symlink", do not assume CPU is i386, also cater for
x86_64.
* gnu/packages/cross-base.scm (cross-libc*)[arguments]: Likewise.

Change-Id: Ib009b7bd301b543b8629382330cca9d963b7a812
---
 gnu/packages/base.scm       | 18 ++++++++++++------
 gnu/packages/cross-base.scm | 17 +++++++++++------
 2 files changed, 23 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 4e8121ae2c..02ef71f20d 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1079,7 +1079,7 @@  (define-public glibc
                                (string-append locale "/C.UTF-8")))))
 
                  ,@(if (target-hurd?)
-                       '((add-after 'install 'augment-libc.so
+                       `((add-after 'install 'augment-libc.so
                            (lambda* (#:key outputs #:allow-other-keys)
                              (let ((out (assoc-ref outputs "out")))
                                (substitute* (string-append out "/lib/libc.so")
@@ -1088,11 +1088,17 @@  (define-public glibc
                                                  " libmachuser.so libhurduser.so"))))))
                          (add-after 'install 'create-machine-symlink
                            (lambda* (#:key outputs #:allow-other-keys)
-                             (let ((out (assoc-ref outputs "out"))
-                                   (cpu "i386"))
-                               (symlink cpu
-                                        (string-append out
-                                                       "/include/mach/machine"))))))
+                             (let* ((out (assoc-ref outputs "out"))
+                                    (cpu ,(match (or (%current-target-system)
+                                                     (%current-system))
+                                            ((? target-x86-32?)
+                                             "i386")
+                                            ((? target-x86-64?)
+                                             "x86_64")))
+                                    (machine (string-append
+                                              out "/include/mach/machine")))
+                               (unless (file-exists? machine)
+                                 (symlink cpu machine))))))
                        '()))))
 
    (inputs `(("static-bash" ,static-bash)))
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 7b32a6b64e..3827e87aec 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -738,7 +738,7 @@  (define* (cross-libc* target
                (delete 'install-utf8-c-locale)
 
                ,@(if (target-hurd? target)
-                     '((add-after 'install 'augment-libc.so
+                     `((add-after 'install 'augment-libc.so
                          (lambda* (#:key outputs #:allow-other-keys)
                            (let ((out (assoc-ref outputs "out")))
                              (substitute* (string-append out "/lib/libc.so")
@@ -747,11 +747,16 @@  (define* (cross-libc* target
                                                " libmachuser.so libhurduser.so"))))))
                        (add-after 'install 'create-machine-symlink
                          (lambda* (#:key outputs #:allow-other-keys)
-                           (let ((out (assoc-ref outputs "out"))
-                                 (cpu "i386"))
-                             (symlink cpu
-                                      (string-append out
-                                                     "/include/mach/machine"))))))
+                           (let* ((out (assoc-ref outputs "out"))
+                                  (cpu ,(match target
+                                          ((? target-x86-32?)
+                                           "i386")
+                                          ((? target-x86-64?)
+                                           "x86_64")))
+                                  (machine (string-append
+                                            out "/include/mach/machine")))
+                             (unless (file-exists? machine)
+                               (symlink cpu machine))))))
                      '())))))
 
       ;; Shadow the native "kernel-headers" because glibc's recipe expects the