;;; Copyright © 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
(name "gash-boot")
(source (origin
(inherit (package-source gash))
- (modules '())))
+ (snippet #f))) ;discard snippet for Guile 3.0 support
(arguments
`(#:implicit-inputs? #f
#:tests? #f
(package
(inherit gash-utils)
(name "gash-utils-boot")
+ (source (origin
+ (inherit (package-source gash-utils))
+ (patches '())
+ (snippet #f))) ;discard snippet for Guile 3.0 support
(arguments
`(#:implicit-inputs? #f
#:tests? #f
("gcc" ,gcc-mesboot)
,@(fold alist-delete (%boot-mesboot4-inputs) '("gcc" "gcc-wrapper"))))
-(define-public coreutils-mesboot
+(define coreutils-mesboot
(package
(inherit coreutils)
(name "coreutils-mesboot")
`(#:implicit-inputs? #f
#:guile ,%bootstrap-guile))))
-(define linux-libre-headers-boot0
- (mlambda ()
- "Return Linux-Libre header files for the bootstrap environment."
- ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
- ;; between (gnu packages linux) and this module. Additionally, memoize
- ;; the result to play well with further memoization and code that relies
- ;; on pointer identity; see <https://bugs.gnu.org/30155>.
- (package
- (inherit linux-libre-headers)
- (arguments
- `(#:guile ,%bootstrap-guile
- #:implicit-inputs? #f
- ,@(package-arguments linux-libre-headers)))
- (native-inputs
- `(("perl" ,perl-boot0)
+(define-syntax define/system-dependent
+ (lambda (s)
+ "Bind IDENTIFIER to EXP, where the value of EXP is known to depend on
+'%current-system'. The definition ensures that (1) EXP is \"thunked\" so that
+it sees the right value of '%current-system', and (2) that its result is
+memoized as a function of '%current-system'."
+ (syntax-case s ()
+ ((_ identifier exp)
+ (with-syntax ((memoized (datum->syntax #'identifier
+ (symbol-append
+ (syntax->datum #'identifier)
+ '/memoized))))
+ #'(begin
+ (define memoized
+ (mlambda (system) exp))
+ (define-syntax identifier
+ (identifier-syntax (memoized (%current-system))))))))))
+
+(define/system-dependent linux-libre-headers-boot0
+ ;; Note: this is wrapped in a thunk to nicely handle circular dependencies
+ ;; between (gnu packages linux) and this module. Additionally, memoize
+ ;; the result to play well with further memoization and code that relies
+ ;; on pointer identity; see <https://bugs.gnu.org/30155>.
+ (package
+ (inherit linux-libre-headers)
+ (arguments
+ `(#:guile ,%bootstrap-guile
+ #:implicit-inputs? #f
+ ,@(package-arguments linux-libre-headers)))
+ (native-inputs
+ `(("perl" ,perl-boot0)
- ;; Flex and Bison are required since version 4.16.
- ("flex" ,flex-boot0)
- ("bison" ,bison-boot0)
+ ;; Flex and Bison are required since version 4.16.
+ ("flex" ,flex-boot0)
+ ("bison" ,bison-boot0)
- ;; Rsync is required since version 5.3.
- ("rsync" ,rsync-boot0)
- ,@(%boot0-inputs))))))
+ ;; Rsync is required since version 5.3.
+ ("rsync" ,rsync-boot0)
+ ,@(%boot0-inputs)))))
(define with-boot0
(package-with-explicit-inputs %boot0-inputs
%bootstrap-guile))
(define gnumach-headers-boot0
- (with-boot0 (package-with-bootstrap-guile gnumach-headers)))
+ (with-boot0
+ (package-with-bootstrap-guile
+ (package
+ (inherit gnumach-headers)
+ (version "1.8-116-g28b53508")
+ (source (bootstrap-origin
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://lilypond.org/janneke/hurd/"
+ "gnumach-" version ".tar.gz"))
+ (sha256
+ (base32
+ "006i0zgwy81vxarpfm12vip4q6i5mgmi5mmy5ldvxp5hx9h3l0zg")))))
+ (native-inputs '())))))
(define mig-boot0
(let* ((mig (package
(assoc-ref %build-inputs "flex") "/lib/")))))))
(with-boot0 mig)))
+(define hurd-version-boot0 "0.9-229-ga1efcee8")
+(define hurd-source-boot0
+ (let ((version hurd-version-boot0))
+ (bootstrap-origin
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://lilypond.org/janneke/hurd/"
+ "hurd-v" version ".tar.gz"))
+ (sha256
+ (base32
+ "0bq2q2jisxcy0kgcm6rz0z2fddwxxm7azsama7li28a2m08kdpzy"))))))
+
(define hurd-headers-boot0
(let ((hurd-headers (package (inherit hurd-headers)
- (native-inputs `(("mig" ,mig-boot0)))
- (inputs '()))))
+ (version hurd-version-boot0)
+ (source hurd-source-boot0)
+ (native-inputs `(("mig" ,mig-boot0)))
+ (inputs '()))))
(with-boot0 (package-with-bootstrap-guile hurd-headers))))
(define hurd-minimal-boot0
(let ((hurd-minimal (package (inherit hurd-minimal)
- (native-inputs `(("mig" ,mig-boot0)))
- (inputs '()))))
+ (version hurd-version-boot0)
+ (source hurd-source-boot0)
+ (native-inputs `(("mig" ,mig-boot0)))
+ (inputs '()))))
(with-boot0 (package-with-bootstrap-guile hurd-minimal))))
-(define hurd-core-headers-boot0
- (mlambda ()
- "Return the Hurd and Mach headers as well as initial Hurd libraries for
-the bootstrap environment."
- (package (inherit (package-with-bootstrap-guile hurd-core-headers))
- (arguments `(#:guile ,%bootstrap-guile
- ,@(package-arguments hurd-core-headers)))
- (inputs
- `(("gnumach-headers" ,gnumach-headers-boot0)
- ("hurd-headers" ,hurd-headers-boot0)
- ("hurd-minimal" ,hurd-minimal-boot0)
- ,@(%boot0-inputs))))))
+(define/system-dependent hurd-core-headers-boot0
+ ;; Return the Hurd and Mach headers as well as initial Hurd libraries for
+ ;; the bootstrap environment.
+ (package (inherit (package-with-bootstrap-guile hurd-core-headers))
+ (arguments `(#:guile ,%bootstrap-guile
+ ,@(package-arguments hurd-core-headers)))
+ (inputs
+ `(("gnumach-headers" ,gnumach-headers-boot0)
+ ("hurd-headers" ,hurd-headers-boot0)
+ ("hurd-minimal" ,hurd-minimal-boot0)
+ ,@(%boot0-inputs)))))
(define* (kernel-headers-boot0 #:optional (system (%current-system)))
(match system
- ("i586-gnu" (hurd-core-headers-boot0))
- (_ (linux-libre-headers-boot0))))
+ ("i586-gnu" hurd-core-headers-boot0)
+ (_ linux-libre-headers-boot0)))
(define texinfo-boot0
;; Texinfo used to build libc's manual.
;; Python package won't interfere with this one.
((#:make-flags _ ''()) ''())
((#:phases phases)
- `(modify-phases ,phases
+ ;; Remove the 'apply-alignment-patch' phase if present to avoid
+ ;; rebuilding this package. TODO: for the next rebuild cycle,
+ ;; consider inlining all the arguments instead of inheriting to
+ ;; make it easier to patch Python without risking a full rebuild.
+ ;; Or better yet, change to 'python-on-guile'.
+ `(modify-phases ,@(list (match phases
+ (('modify-phases original-phases
+ changes ...
+ ('add-after unpack apply-alignment-patch _))
+ `(modify-phases ,original-phases ,@changes))
+ (_ phases)))
(add-before 'configure 'disable-modules
(lambda _
(substitute* "setup.py"
;; built, since it requires Linux headers.
(("'linux', ") ""))
#t))
- (delete 'set-TZDIR)))
+ (delete 'set-TZDIR)
+ ,@(if (hurd-system?)
+ `((add-before 'build 'fix-regen
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((libc (assoc-ref inputs "libc")))
+ (substitute* "Lib/plat-generic/regen"
+ (("/usr/include/") (string-append libc "/include/")))
+ #t))))
+ '())))
((#:tests? _ #f) #f))))))
-(define ld-wrapper-boot0
- (mlambda ()
- ;; We need this so binaries on Hurd will have libmachuser and libhurduser
- ;; in their RUNPATH, otherwise validate-runpath will fail.
- (make-ld-wrapper "ld-wrapper-boot0"
- #:target boot-triplet
- #:binutils binutils-boot0
- #:guile %bootstrap-guile
- #:bash (car (assoc-ref (%boot0-inputs) "bash"))
- #:guile-for-build %bootstrap-guile)))
+(define/system-dependent ld-wrapper-boot0
+ ;; The first 'ld' wrapper, defined with 'define/system-dependent' because
+ ;; its calls '%boot0-inputs', whose result depends on (%current-system)
+ ;;
+ ;; We need this so binaries on Hurd will have libmachuser and libhurduser
+ ;; in their RUNPATH, otherwise validate-runpath will fail.
+ (make-ld-wrapper "ld-wrapper-boot0"
+ #:target boot-triplet
+ #:binutils binutils-boot0
+ #:guile %bootstrap-guile
+ #:bash (car (assoc-ref (%boot0-inputs) "bash"))
+ #:guile-for-build %bootstrap-guile))
(define (%boot1-inputs)
;; 2nd stage inputs.
`(("gcc" ,gcc-boot0)
- ("ld-wrapper-cross" ,(ld-wrapper-boot0))
+ ("ld-wrapper-cross" ,ld-wrapper-boot0)
("binutils-cross" ,binutils-boot0)
,@(alist-delete "binutils" (%boot0-inputs))))
((#:configure-flags flags)
`(append (list ,(string-append "--host=" (boot-triplet))
,(string-append "--build="
- (nix-system->gnu-triplet)))
+ (nix-system->gnu-triplet))
+ ,(if (hurd-system?) "--disable-werror"
+ ""))
,flags))
((#:phases phases)
`(modify-phases ,phases
(unsetenv "CPATH")
;; Tell 'libpthread' where to find 'libihash' on Hurd systems.
- ,@(if (hurd-triplet? (%current-system))
- `((substitute* "libpthread/Makefile"
- (("LDLIBS-pthread.so =.*")
- (string-append "LDLIBS-pthread.so = "
- (assoc-ref %build-inputs "kernel-headers")
- "/lib/libihash.a\n"))))
- '())
+ ,@(if (hurd-system?)
+ '((substitute* '("sysdeps/mach/Makefile"
+ "sysdeps/mach/hurd/Makefile")
+ (("LDLIBS-pthread.so =.*")
+ (string-append "LDLIBS-pthread.so = "
+ (assoc-ref %build-inputs "kernel-headers")
+ "/lib/libihash.a\n"))))
+ '())
;; 'rpcgen' needs native libc headers to be built.
(substitute* "sunrpc/Makefile"
,@(%boot1-inputs)
;; A native MiG is needed to build Glibc on Hurd.
- ,@(if (hurd-triplet? (%current-system))
+ ,@(if (hurd-system?)
`(("mig" ,mig-boot0))
'())
("bash" ,bash)))
(inputs '())))
-(define gcc-boot0-intermediate-wrapped
- (mlambda ()
- ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
- ;; non-cross names.
- (cross-gcc-wrapper gcc-boot0 binutils-boot0
- glibc-final-with-bootstrap-bash
- (car (assoc-ref (%boot1-inputs) "bash")))))
+(define/system-dependent gcc-boot0-intermediate-wrapped
+ ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
+ ;; non-cross names.
+ (cross-gcc-wrapper gcc-boot0 binutils-boot0
+ glibc-final-with-bootstrap-bash
+ (car (assoc-ref (%boot1-inputs) "bash"))))
(define static-bash-for-glibc
;; A statically-linked Bash to be used by GLIBC-FINAL in system(3) & co.
(package
(inherit static-bash)
(source (bootstrap-origin (package-source static-bash)))
- (inputs `(("gcc" ,(gcc-boot0-intermediate-wrapped))
+ (inputs `(("gcc" ,gcc-boot0-intermediate-wrapped)
("libc" ,glibc-final-with-bootstrap-bash)
("libc:static" ,glibc-final-with-bootstrap-bash "static")
,@(fold alist-delete (%boot1-inputs)
;; if 'allowed-references' were per-output.
(arguments
`(#:allowed-references
- ,(cons* `(,gcc-boot0 "lib") (kernel-headers-boot0)
- static-bash-for-glibc
- (package-outputs glibc-final-with-bootstrap-bash))
-
+ ((,gcc-boot0 "lib")
+ ,(kernel-headers-boot0)
+ ,static-bash-for-glibc
+ ,@(if (hurd-system?)
+ `(,gnumach-headers-boot0
+ ,hurd-headers-boot0)
+ '())
+ ,@(package-outputs glibc-final-with-bootstrap-bash))
,@(package-arguments glibc-final-with-bootstrap-bash)))))
-(define gcc-boot0-wrapped
- (mlambda ()
- ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
- ;; non-cross names.
- (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
- (car (assoc-ref (%boot1-inputs) "bash")))))
+(define/system-dependent gcc-boot0-wrapped
+ ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
+ ;; non-cross names.
+ (cross-gcc-wrapper gcc-boot0 binutils-boot0 glibc-final
+ (car (assoc-ref (%boot1-inputs) "bash"))))
(define (%boot2-inputs)
;; 3rd stage inputs.
`(("libc" ,glibc-final)
("libc:static" ,glibc-final "static")
- ("gcc" ,(gcc-boot0-wrapped))
+ ("gcc" ,gcc-boot0-wrapped)
,@(fold alist-delete (%boot1-inputs) '("libc" "gcc" "linux-libre-headers"))))
(define binutils-final
,@(package-arguments zlib)))
(inputs (%boot2-inputs))))
-(define ld-wrapper-boot3
- (mlambda ()
- ;; A linker wrapper that uses the bootstrap Guile.
- (make-ld-wrapper "ld-wrapper-boot3"
- #:binutils binutils-final
- #:guile %bootstrap-guile
- #:bash (car (assoc-ref (%boot2-inputs) "bash"))
- #:guile-for-build %bootstrap-guile)))
+(define/system-dependent ld-wrapper-boot3
+ ;; A linker wrapper that uses the bootstrap Guile.
+ (make-ld-wrapper "ld-wrapper-boot3"
+ #:binutils binutils-final
+ #:guile %bootstrap-guile
+ #:bash (car (assoc-ref (%boot2-inputs) "bash"))
+ #:guile-for-build %bootstrap-guile))
(define gcc-final
;; The final GCC.
(inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
("mpfr-source" ,(package-source mpfr))
("mpc-source" ,(package-source mpc))
- ("ld-wrapper" ,(ld-wrapper-boot3))
+ ("ld-wrapper" ,ld-wrapper-boot3)
("binutils" ,binutils-final)
("libstdc++" ,libstdc++)
("zlib" ,zlib-final)
(define (%boot3-inputs)
;; 4th stage inputs.
`(("gcc" ,gcc-final)
- ("ld-wrapper" ,(ld-wrapper-boot3))
+ ("ld-wrapper" ,ld-wrapper-boot3)
,@(alist-delete "gcc" (%boot2-inputs))))
(define bash-final
;; This package must be public because other modules refer to it. However,
;; mark it as hidden so that 'fold-packages' ignores it.
(with-boot4 (hidden-package
- (package-with-bootstrap-guile guile-2.2/fixed))))
+ (package-with-bootstrap-guile guile-3.0/fixed))))
(define glibc-utf8-locales-final
;; Now that we have GUILE-FINAL, build the UTF-8 locales. They are needed
'(#:modules ((guix build union))
#:builder (begin
(use-modules (ice-9 match)
+ (srfi srfi-1)
(srfi srfi-26)
(guix build union))
(let ((out (assoc-ref %outputs "out")))
-
- (match %build-inputs
- (((names . directories) ...)
- (union-build out directories)))
+ (union-build out
+ (filter-map (match-lambda
+ (("libc-debug" . _) #f)
+ (("libc-static" . _) #f)
+ ((_ . directory) directory))
+ %build-inputs))
(union-build (assoc-ref %outputs "debug")
(list (assoc-ref %build-inputs
(description
"This package provides a complete GCC tool chain for C/C++ development to
be installed in user profiles. This includes GCC, as well as libc (headers and
-binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
+binaries, plus debugging symbols in the @code{debug} output), and Binutils. GCC
+is the GNU Compiler Collection.")
(home-page "https://gcc.gnu.org/")
(outputs '("out" "debug" "static"))
(define-public gcc-toolchain-9
(make-gcc-toolchain gcc-9))
+(define-public gcc-toolchain-10
+ (make-gcc-toolchain gcc-10))
+
+(define-public gcc-toolchain-aka-gcc
+ ;; It's natural for users to try "guix install gcc". This package
+ ;; automatically "redirects" them to 'gcc-toolchain'.
+ (deprecated-package "gcc" gcc-toolchain-10))
+
+
+(define-public gdc-toolchain-10
+ (package (inherit (make-gcc-toolchain gdc-10))
+ (synopsis "Complete GCC tool chain for D lang development")
+ (description "This package provides a complete GCC tool chain for
+D lang development to be installed in user profiles. This includes
+gdc, as well as libc (headers and binaries, plus debugging symbols
+in the @code{debug} output), and binutils.")))
+
;; Provide the Fortran toolchain package only for the version of gfortran that
;; is used by Guix internally to build Fortran libraries, because combining
;; code compiled with different versions can cause problems.