@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2017, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2017, 2020, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020, 2021 Mathieu Othacehe <othacehe@gnu.org>
@@ -146,7 +146,7 @@ (define %core-packages
%bootstrap-binaries-tarball
%binutils-bootstrap-tarball
(%glibc-bootstrap-tarball)
- %gcc-bootstrap-tarball
+ (%gcc-bootstrap-tarball)
%guile-bootstrap-tarball
%bootstrap-tarballs))
@@ -558,7 +558,8 @@ (define* (make-raw-bag name
(name name)
(system system)
(build-inputs inputs)
- (build (cond ((target-riscv64?)
+ (build (cond ((or (target-riscv64?)
+ (target-hurd64?))
raw-build-guile3)
(else raw-build)))))
@@ -3643,10 +3643,12 @@ (define-public gcc-toolchain-14
;; 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
@@ -641,9 +641,9 @@ (define* (cross-kernel-headers* target
("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))
@@ -861,10 +861,12 @@ (define-public gcc-14
;; 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 @@ (define-public gcc-2.95
(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")
@@ -1050,8 +1052,8 @@ (define-public (make-libstdc++ 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 @@ (define libstdc++-headers
;; 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 @@ (define libstdc++-headers
(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
@@ -124,8 +124,11 @@ (define (package-with-relocatable-glibc p)
(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.
@@ -145,7 +148,10 @@ (define (package-with-relocatable-glibc p)
target
#:xbinutils (cross-binutils target)
#:libc (cross-bootstrap-libc target))))
- `(("cross-gcc" ,(package
+ `(,@(%final-inputs)
+ ;; As versions for gcc and cross-gcc can differ, make sure to have
+ ;; cross-gcc behind gcc in CPLUS_INCLUDE_PATH.
+ ("cross-gcc" ,(package
(inherit xgcc)
(search-paths
;; Ensure the cross libc headers appears on the
@@ -154,8 +160,7 @@ (define (package-with-relocatable-glibc p)
(variable "CROSS_CPLUS_INCLUDE_PATH")
(files '("include")))
(package-search-paths (current-gcc))))))
- ("cross-binutils" ,(cross-binutils target))
- ,@(%final-inputs)))
+ ("cross-binutils" ,(cross-binutils target))))
`(("libc" ,(glibc-for-bootstrap glibc))
("libc:static" ,(glibc-for-bootstrap glibc) "static")
("gcc" ,(gcc-for-bootstrap glibc))
@@ -395,10 +400,15 @@ (define %binutils-static
((#:configure-flags flags _ ...)
flags)))
#:make-flags
- (match (memq #:make-flags (package-arguments binutils))
- ((#:make-flags flags _ ...)
- flags)
- (_ #~'()))
+ #~(append
+ #$(if (target-hurd64?)
+ #~'("lt_cv_prog_compiler_static_works=yes"
+ "lt_cv_prog_compiler_static_works_CXX=yes")
+ #~'())
+ #$(match (memq #:make-flags (package-arguments binutils))
+ ((#:make-flags flags _ ...)
+ flags)
+ (_ #~'())))
#:strip-flags #~'("--strip-all")
#:phases
#~(modify-phases %standard-phases
@@ -446,7 +456,8 @@ (define (%glibc-stripped)
;; 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 +474,13 @@ (define (%glibc-stripped)
`(("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"
@@ -478,11 +494,12 @@ (define (%glibc-stripped)
;; Only one output.
(outputs '("out")))))
-(define %gcc-static
+(define (%gcc-static)
;; A statically-linked GCC, with stripped-down functionality.
(package-with-relocatable-glibc
(package (inherit (current-gcc))
(name "gcc-static")
+ (source (package-source (current-gcc)))
(outputs '("out")) ; all in one
(arguments
(substitute-keyword-arguments (package-arguments (current-gcc))
@@ -552,7 +569,7 @@ (define %gcc-static
,@(package-native-inputs (current-gcc)))
(package-native-inputs (current-gcc)))))))
-(define %gcc-stripped
+(define (%gcc-stripped)
;; The subset of GCC files needed for bootstrap.
(package
(inherit (current-gcc))
@@ -575,7 +592,7 @@ (define %gcc-stripped
(libdir (string-append out "/lib"))
(includedir (string-append out "/include"))
(libexecdir (string-append out "/libexec"))
- (gcc #$%gcc-static))
+ (gcc #$(%gcc-static)))
(copy-recursively (string-append gcc "/bin") bindir)
(for-each remove-store-references
(find-files bindir ".*"))
@@ -642,6 +659,9 @@ (define* (make-guile-static guile patches)
#$@(if (target-hurd?)
#~("--disable-jit")
+ #~())
+ #$@(if (target-hurd64?)
+ #~("lt_cv_prog_compiler_static_works=yes")
#~())))
((#:phases phases '%standard-phases)
#~(modify-phases #$phases
@@ -813,9 +833,9 @@ (define (%glibc-bootstrap-tarball)
;; A tarball with GNU libc's shared libraries, dynamic linker, and headers.
(tarball-package (%glibc-stripped)))
-(define %gcc-bootstrap-tarball
+(define (%gcc-bootstrap-tarball)
;; A tarball with a dynamic-linked GCC and its headers.
- (tarball-package %gcc-stripped))
+ (tarball-package (%gcc-stripped)))
(define %guile-bootstrap-tarball
;; A tarball with the statically-linked, relocatable Guile.
@@ -856,7 +876,7 @@ (define %bootstrap-tarballs
((or "i686-linux" "x86_64-linux")
(list %linux-libre-headers-bootstrap-tarball))
(_
- (list %gcc-bootstrap-tarball
+ (list (%gcc-bootstrap-tarball)
%binutils-bootstrap-tarball
(%glibc-bootstrap-tarball)
%bootstrap-binaries-tarball)))))
@@ -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 @@ (define-module (guix platforms x86)
x86_64-linux-x32
i686-mingw
x86_64-mingw
- i586-gnu))
+ i586-gnu
+ x86_64-gnu))
(define i686-linux
(platform
@@ -71,3 +73,10 @@ (define i586-gnu
(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")))
@@ -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 @@ (define-module (guix utils)
target-linux?
target-hurd?
system-hurd?
+ target-hurd64?
+ system-hurd64?
target-mingw?
target-x86-32?
target-x86-64?
@@ -716,6 +718,17 @@ (define* (system-hurd?)
"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