[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/06: gnu: Add basic support for x86_64-pc-gnu target, aka 64bit Hurd.
From: |
guix-commits |
Subject: |
04/06: gnu: Add basic support for x86_64-pc-gnu target, aka 64bit Hurd. |
Date: |
Sun, 3 Nov 2024 14:57:25 -0500 (EST) |
janneke pushed a commit to branch hurd-team
in repository guix.
commit af740d4f3bb8400a54e870063201288252d67727
Author: Janneke Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Sat Nov 2 18:27:51 2024 +0100
gnu: Add basic support for x86_64-pc-gnu target, aka 64bit Hurd.
* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Update comment on where
to find shared linker name.
* guix/platforms/x86.scm (x86_64-gnu): New exported variable.
* guix/utils.scm (target-hurd64? system-hurd64?): New procedures.
* gnu/packages/gcc.scm: (current-gcc): Use target-hurd64? in new procedure
to
select gcc-14 on 64bit Hurd.
libstdc++: Change to...
(current-libstdc++): ...this new procedure.
(libstdc++-headers): Update accordingly.
* gnu/packages/commencement.scm (current-gcc-toolchain): Likewise, to select
gcc-toolchain-14 on 64bit Hurd.
* gnu/packages/cross-base.scm (%xgcc): Use current-gcc.
(cross-kernel-headers*): Use target-hurd? instead of custom "i586..."
matching to also use xhurd-core-headers for target-hurd64.
* gnu/packages/make-bootstrap.scm (package-with-relocatable-glibc):
Capture (current-gcc) before resetting %current-target-system.
(%glibc-stripped): Likewise.
Change-Id: Id4f8a8fe3ecff2ab5ad2cdcd0f702cfa3c3f7b65
---
gnu/packages/commencement.scm | 6 ++++--
gnu/packages/cross-base.scm | 6 +++---
gnu/packages/gcc.scm | 38 ++++++++++++++++++++------------------
gnu/packages/make-bootstrap.scm | 19 ++++++++++++++-----
guix/platforms/x86.scm | 11 ++++++++++-
guix/utils.scm | 15 ++++++++++++++-
6 files changed, 65 insertions(+), 30 deletions(-)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 2b43759dac..682deb89cf 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3642,10 +3642,12 @@ is the GNU Compiler Collection.")
;; The default GCC
(define (current-gcc-toolchain)
"The current default gcc-toolchain version."
- gcc-toolchain-11)
+ (if (target-hurd64?)
+ gcc-toolchain-14
+ gcc-toolchain-11))
(define-public gcc-toolchain
- (deprecated-package "gcc-toolchain" gcc-toolchain-11))
+ (deprecated-package "gcc-toolchain" (current-gcc-toolchain)))
(define-public gcc-toolchain-aka-gcc
;; It's natural for users to try "guix install gcc". This package
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 9c701efae8..7b32a6b64e 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -641,9 +641,9 @@ the base compiler. Use XBINUTILS as the associated
cross-Binutils."
("hurd-headers" ,xhurd-headers)
("hurd-minimal" ,xhurd-minimal)))))
- (match target
- ((or "i586-pc-gnu" "i586-gnu") xhurd-core-headers)
- (_ xlinux-headers)))
+ (if (target-hurd? target)
+ xhurd-core-headers
+ xlinux-headers))
(define* (cross-libc . args)
(if (or (= (length args) 1) (contains-keyword? args))
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 3b5d05b9a9..7719ccfead 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -861,10 +861,12 @@ It also includes runtime support libraries for these
languages.")
;; the gcc-toolchain-* definitions.
(define (current-gcc)
"The current default gcc version."
- gcc-11)
+ (if (target-hurd64?)
+ gcc-14
+ gcc-11))
(define-public gcc
- (deprecated-package "gcc" gcc-11))
+ (deprecated-package "gcc" (current-gcc)))
;;;
@@ -903,15 +905,15 @@ It also includes runtime support libraries for these
languages.")
(outputs '("out"))
(arguments
(let ((matching-system
- (match (%current-system)
- ;; This package predates our 64-bit architectures.
- ;; Force a 32-bit build targeting a similar architecture.
- ("aarch64-linux"
- "armhf-linux")
- ("x86_64-linux"
- "i686-linux")
- (_
- (%current-system)))))
+ (match (%current-system)
+ ;; This package predates our 64-bit architectures.
+ ;; Force a 32-bit build targeting a similar architecture.
+ ("aarch64-linux"
+ "armhf-linux")
+ ("x86_64-linux"
+ "i686-linux")
+ (_
+ (%current-system)))))
(list #:system matching-system
#:configure-flags #~'("--disable-werror")
@@ -926,11 +928,11 @@ It also includes runtime support libraries for these
languages.")
"gcc/config/rs6000/linux.h")
(("/lib/ld\\.so\\.1")
(search-input-file
- inputs #$(glibc-dynamic-linker matching-system))))
+ inputs #$(glibc-dynamic-linker matching-system))))
(substitute* "gcc/config/i386/gnu.h"
(("/lib/ld\\.so")
(search-input-file
- inputs #$(glibc-dynamic-linker matching-system))))
+ inputs #$(glibc-dynamic-linker matching-system))))
(substitute* '("gcc/config/alpha/linux-elf.h"
"gcc/config/arm/linux-elf.h"
"gcc/config/i386/linux.h"
@@ -939,7 +941,7 @@ It also includes runtime support libraries for these
languages.")
"gcc/config/sparc/linux64.h")
(("/lib(64)?/ld-linux\\.so\\.[12]")
(search-input-file
- inputs #$(glibc-dynamic-linker matching-system))))))
+ inputs #$(glibc-dynamic-linker matching-system))))))
(replace 'configure
(lambda* (#:key outputs build configure-flags
#:allow-other-keys)
@@ -1050,8 +1052,8 @@ using compilers other than GCC."
(propagated-inputs '())
(synopsis "GNU C++ standard library")))
-(define libstdc++
- ;; Libstdc++ matching the default GCC.
+(define (current-libstdc++)
+ ;; Libstdc++ matching the CURRENT-GCC.
(make-libstdc++ (current-gcc)))
(define libstdc++-headers
@@ -1061,7 +1063,7 @@ using compilers other than GCC."
;; is right under include/c++ and not under
;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR).
(package
- (inherit libstdc++)
+ (inherit (current-libstdc++))
(name "libstdc++-headers")
(outputs '("out"))
(build-system trivial-build-system)
@@ -1072,7 +1074,7 @@ using compilers other than GCC."
(mkdir (string-append out "/include"))
(symlink (string-append libstdc++ "/include")
(string-append out "/include/c++")))))
- (inputs `(("libstdc++" ,libstdc++)))
+ (inputs `(("libstdc++" ,(current-libstdc++))))
(synopsis "Headers of GNU libstdc++")))
(define-public libstdc++-4.9
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index c6293b9a38..1afb871c2a 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -124,8 +124,11 @@ for `sh' in $PATH, and without nscd, and with static NSS
modules."
(glibc-for-bootstrap
;; `cross-libc' already returns a cross libc, so clear
;; %CURRENT-TARGET-SYSTEM.
- (parameterize ((%current-target-system #f))
- (cross-libc target))))
+ (let ((xgcc (cross-gcc target #:xgcc (current-gcc))))
+ (parameterize ((%current-target-system #f))
+ (cross-libc target #:xgcc xgcc
+ #:xheaders (cross-kernel-headers
+ target #:xgcc xgcc))))))
;; Standard inputs with the above libc and corresponding GCC.
@@ -446,7 +449,8 @@ for `sh' in $PATH, and without nscd, and with static NSS
modules."
;; GNU libc's essential shared libraries, dynamic linker, and headers,
;; with all references to store directories stripped. As a result,
;; libc.so is unusable and need to be patched for proper relocation.
- (let ((glibc (glibc-for-bootstrap glibc)))
+ (let ((glibc (glibc-for-bootstrap glibc))
+ (gcc (current-gcc)))
(package (inherit glibc)
(name "glibc-stripped")
(build-system trivial-build-system)
@@ -463,8 +467,13 @@ for `sh' in $PATH, and without nscd, and with static NSS
modules."
`(("libc" ,(let ((target (%current-target-system)))
(if target
(glibc-for-bootstrap
- (parameterize ((%current-target-system #f))
- (cross-libc target)))
+ (let* ((xgcc (cross-gcc target #:xgcc gcc))
+ (xheaders (cross-kernel-headers target
+ #:xgcc xgcc)))
+ (parameterize ((%current-target-system #f))
+ (cross-libc target
+ #:xgcc xgcc
+ #:xheaders xheaders))))
glibc)))))
(inputs
`(("kernel-headers"
diff --git a/guix/platforms/x86.scm b/guix/platforms/x86.scm
index 0c8fc7296c..5617e6dd68 100644
--- a/guix/platforms/x86.scm
+++ b/guix/platforms/x86.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;; Copyright © 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,7 +26,8 @@
x86_64-linux-x32
i686-mingw
x86_64-mingw
- i586-gnu))
+ i586-gnu
+ x86_64-gnu))
(define i686-linux
(platform
@@ -71,3 +73,10 @@
(system "i586-gnu")
(rust-target "i686-unknown-hurd-gnu")
(glibc-dynamic-linker "/lib/ld.so.1")))
+
+(define x86_64-gnu
+ (platform
+ (target "x86_64-pc-gnu")
+ (system "x86_64-gnu")
+ (rust-target "x86_64-unknown-hurd-gnu")
+ (glibc-dynamic-linker "/lib/ld-x86-64.so.1")))
diff --git a/guix/utils.scm b/guix/utils.scm
index f161cb4ef3..e100c03365 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -17,7 +17,7 @@
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
;;; Copyright © 2023 Philip McGrath <philip@philipmcgrath.com>
-;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2023, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2023 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
@@ -94,6 +94,8 @@
target-linux?
target-hurd?
system-hurd?
+ target-hurd64?
+ system-hurd64?
target-mingw?
target-x86-32?
target-x86-64?
@@ -716,6 +718,17 @@ a character other than '@'."
"Is the current system the GNU(/Hurd) system?"
(and=> (%current-system) target-hurd?))
+(define* (target-hurd64? #:optional (target (or (%current-target-system)
+ (%current-system))))
+ "Does TARGET represent the 64bit GNU(/Hurd) system?"
+ (and (target-hurd?)
+ (target-64bit? target)))
+
+(define* (system-hurd64?)
+ "Is the current system the 64bit GNU(/Hurd) system?"
+ (and (system-hurd?)
+ (target-64bit? (%current-system))))
+
(define* (target-mingw? #:optional (target (%current-target-system)))
"Is the operating system of TARGET Windows?"
(and target
- branch hurd-team updated (98a0ec82fd -> 477fcb0219), guix-commits, 2024/11/03
- 01/06: DRAFT gnu: gnumach: Update to v1.8+git20240406., guix-commits, 2024/11/03
- 04/06: gnu: Add basic support for x86_64-pc-gnu target, aka 64bit Hurd.,
guix-commits <=
- 05/06: gnu: bash-minimal: Fix build for 6bit Hurd., guix-commits, 2024/11/03
- 06/06: gnu: elfutils: Fix build for 64bit Hurd., guix-commits, 2024/11/03
- 03/06: gnu: gcc: Add indirections current-gcc, current-gcc-toolchain., guix-commits, 2024/11/03
- 02/06: DRAFT gnu: hurd: Update to v0.9.git20240714., guix-commits, 2024/11/03