;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; 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.
;;;
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
- #:use-module (guix build-system guile)
#:use-module (guix build-system trivial)
+ #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix memoization)
#:use-module (guix utils)
#:use-module (srfi srfi-1)
;;;
;;; Code:
-(define %bootstrap-guile+guild
- ;; This package combines %bootstrap-guile with guild, which is not included
- ;; in %bootstrap-guile. Guild is needed to build gash-boot and
- ;; gash-core-utils-boot because it is dependency of the Guile build system.
+(define bootar
(package
- (name "guile-bootstrap+guild")
- (version "2.0")
- (source (bootstrap-origin (package-source guile-2.0)))
- (native-inputs `(("bash" ,(bootstrap-executable "bash" (%current-system)))
- ("tar" ,(bootstrap-executable "tar" (%current-system)))
- ("xz" ,(bootstrap-executable "xz" (%current-system)))
- ("guile" ,%bootstrap-guile)))
- (build-system trivial-build-system)
+ (name "bootar")
+ (version "1a")
+ (source (origin
+ (method url-fetch)
+ (uri (list (string-append
+ "mirror://gnu/guix/mirror/bootar-" version ".ses")
+ (string-append
+ "https://files.ngyro.com/bootar/bootar-"
+ version ".ses")))
+ (sha256
+ (base32
+ "0mvp6vgx0q316fvy3z2lddlc5xgq5np3bm1fypgvj6dnayibg9np"))))
+ (build-system gnu-build-system)
(arguments
- `(#:guile ,%bootstrap-guile
- #:modules ((guix build utils))
- #:builder (begin
- (use-modules (guix build utils))
- (let ((guile-source (assoc-ref %build-inputs "source"))
- (bin (string-append (getcwd) "/bin"))
- (tar (assoc-ref %build-inputs "tar"))
- (xz (assoc-ref %build-inputs "xz")))
- (mkdir-p bin)
- (setenv "PATH" bin)
- (with-directory-excursion bin
- (copy-file tar "tar")
- (copy-file xz "xz")
- (setenv "PATH" bin))
- (let* ((out (assoc-ref %outputs "out"))
- (out-bin (string-append out "/bin"))
- (guile (assoc-ref %build-inputs "guile"))
- (bash (assoc-ref %build-inputs "bash")))
- (mkdir-p out-bin)
- (with-directory-excursion out-bin
- (symlink (string-append guile "/bin/guile")
- "guile")
- (invoke "tar" "--strip-components=2"
- "-xvf" guile-source
- (string-append "guile-"
- ,(package-version guile-2.0)
- "/meta/guild.in"))
- (copy-file "guild.in" "guild")
- (substitute* "guild"
- (("#!/bin/sh") (string-append "#! " bash))
- (("@installed_guile@") (string-append out-bin "/guile")))
- (chmod "guild" #o555)))))))
- (synopsis "Bootstrap Guile plus Guild")
- (description "Bootstrap Guile with added Guild")
- (home-page #f)
- (license (package-license guile-2.0))
- (native-search-paths
- (list (search-path-specification
- (variable "GUILE_LOAD_PATH")
- (files '("share/guile/site/2.0")))
- (search-path-specification
- (variable "GUILE_LOAD_COMPILED_PATH")
- (files '("lib/guile/2.0/site-ccache")))))))
+ `(#:implicit-inputs? #f
+ #:tests? #f
+ #:guile ,%bootstrap-guile
+ #:imported-modules ((guix build gnu-bootstrap)
+ ,@%gnu-build-system-modules)
+ #:phases
+ (begin
+ (use-modules (guix build gnu-bootstrap))
+ (modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((source (assoc-ref inputs "source"))
+ (guile-dir (assoc-ref inputs "guile"))
+ (guile (string-append guile-dir "/bin/guile")))
+ (invoke guile "--no-auto-compile" source)
+ (chdir "bootar")
+ #t)))
+ (replace 'configure (bootstrap-configure ,version "." "scripts"))
+ (replace 'build (bootstrap-build "."))
+ (replace 'install (bootstrap-install "." "scripts"))))))
+ (inputs `(("guile" ,%bootstrap-guile)))
+ (home-page "https://git.ngyro.com/bootar")
+ (synopsis "Tar decompression and extraction in Guile Scheme")
+ (description "Bootar is a simple Tar extractor written in Guile
+Scheme. It supports running 'tar xvf' on uncompressed tarballs or
+tarballs that are compressed with BZip2, GZip, or XZ. It also provides
+standalone scripts for 'bzip2', 'gzip', and 'xz' that each support
+decompression to standard output.
+
+What makes this special is that Bootar is distributed as a
+self-extracting Scheme (SES) program. That is, a little script that
+outputs the source code of Bootar. This makes it possible to go from
+pure Scheme to Tar and decompression in one easy step.")
+ (license license:gpl3+)))
(define gash-boot
(package
(inherit gash)
(name "gash-boot")
- (version "0.2.0")
- (source (bootstrap-origin
- (origin (inherit (package-source gash))
- (modules '((guix build utils)
- (srfi srfi-26)))
- (snippet
- '(begin
- ;; Remove Guix'y files that we cannot compile.
- (delete-file "guix.scm")
- (delete-file-recursively "tests")
- #t)))))
- (build-system guile-build-system)
- (native-inputs `(("bash" ,(bootstrap-executable "bash" (%current-system)))
- ("tar" ,(bootstrap-executable "tar" (%current-system)))
- ("xz" ,(bootstrap-executable "xz" (%current-system)))
- ("guile-source" ,(bootstrap-origin
- (package-source guile-2.0)))))
- (inputs `(("guile" ,%bootstrap-guile+guild)))
+ (source (origin
+ (inherit (package-source gash))
+ (snippet #f))) ;discard snippet for Guile 3.0 support
(arguments
`(#:implicit-inputs? #f
- #:guile ,%bootstrap-guile+guild
+ #:tests? #f
+ #:guile ,%bootstrap-guile
+ #:imported-modules ((guix build gnu-bootstrap)
+ ,@%gnu-build-system-modules)
#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'unpack-guile-source
- (lambda _
- (let ((guile-source (assoc-ref %build-inputs "guile-source"))
- (bin (string-append (getcwd) "/zee-bin")))
- (mkdir-p bin)
- (with-directory-excursion bin
- (invoke "tar" "--strip-components=2"
-
- "-xvf" guile-source
- (string-append "guile-"
- ,(package-version guile-2.0)
- "/meta/guild.in"))
- (copy-file "guild.in" "guild")
- (chmod "guild" #o555))
- #t)))
- (add-before 'unpack 'set-path
- (lambda _
- (let ((bash (assoc-ref %build-inputs "bash"))
- (tar (assoc-ref %build-inputs "tar"))
- (xz (assoc-ref %build-inputs "xz"))
- (bin (string-append (getcwd) "/zee-bin")))
- (mkdir-p bin)
- (setenv "PATH" (string-append bin ":" (getenv "PATH")))
- (copy-file bash (string-append bin "/bash"))
- (copy-file bash (string-append bin "/sh"))
- (copy-file tar (string-append bin "/tar"))
- (copy-file xz (string-append bin "/xz"))
- #t)))
- (add-after 'build 'build-scripts
- (lambda _
- (let* ((guile (assoc-ref %build-inputs "guile"))
- (guile (string-append guile "/bin/guile"))
- (out (assoc-ref %outputs "out"))
- (effective "2.0")
- (moddir (string-append out "/share/guile/site/" effective "/"))
- (godir (string-append out "/lib/guile/" effective "/site-ccache/")))
- (copy-file "scripts/gash.in" "scripts/gash")
- (chmod "scripts/gash" #o555)
- (substitute* "scripts/gash"
- (("@GUILE@") guile)
- (("@MODDIR@") moddir)
- (("@GODIR") godir))
- #t)))
- (add-after 'install 'install-scripts
- (lambda _
- (let* ((out (assoc-ref %outputs "out"))
- (bin (string-append out "/bin")))
- (install-file "scripts/gash" bin)
- (copy-file "scripts/gash" "scripts/sh")
- (install-file "scripts/sh" bin)
- (copy-file "scripts/gash" "scripts/bash")
- (install-file "scripts/bash" bin)
- #t))))))))
-
-(define gash-core-utils-boot
- (package
- (inherit gash-core-utils)
- (name "gash-core-utils-boot")
- (version "0.0.214-fc1b")
- (source (bootstrap-origin
- (origin
- (method url-fetch)
- (uri (string-append "http://lilypond.org/janneke/"
- "/gash-core-utils-" version ".tar.gz"))
- (modules '((guix build utils)))
- (snippet
- '(begin
- ;; The Guile build system compiles *.scm; avoid
- ;; compiling included lalr.
- (delete-file "guix.scm")
- (delete-file-recursively "tests")
- (substitute* "system/base/lalr.scm"
- (("system/base/lalr.upstream.scm") "lalr.upstream.scm"))
- #t))
- (sha256
- (base32
- "090d8m0b165jf9381nhqpljc5zk22jd6bw03xnyf0na5snk9xp6v")))))
- (build-system guile-build-system)
- (native-inputs `(("bash" ,(bootstrap-executable "bash" (%current-system)))
- ("tar" ,(bootstrap-executable "tar" (%current-system)))
- ("xz" ,(bootstrap-executable "xz" (%current-system)))
- ("guile-source" ,(bootstrap-origin
- (package-source guile-2.0)))
- ;; We need the 2.0.9 lalr for %bootstrap-guile
- ("lalr.upstream"
- ,(origin
- (method url-fetch)
- (uri (string-append "http://git.savannah.gnu.org/cgit/guile.git/plain/module/system/base/lalr.upstream.scm?h=v2.0.9"))
- (file-name "lalr.upstream.scm")
- (sha256
- (base32
- "0h7gyjj8nr2qrgzwma146s7l22scp8bbcqzdy9wqf12bgyhbw7d5"))))))
- (inputs `(("guile" ,%bootstrap-guile+guild)
- ("gash" ,gash-boot)))
+ (begin
+ (use-modules (guix build gnu-bootstrap))
+ (modify-phases %standard-phases
+ (replace 'configure
+ (bootstrap-configure ,(package-version gash) "gash" "scripts"))
+ (replace 'build (bootstrap-build "gash"))
+ (replace 'install (bootstrap-install "gash" "scripts"))
+ (add-after 'install 'install-symlinks
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (symlink (string-append out "/bin/gash")
+ (string-append out "/bin/sh"))
+ (symlink (string-append out "/bin/gash")
+ (string-append out "/bin/bash"))
+ #t)))))))
+ (inputs `(("guile" ,%bootstrap-guile)))
+ (native-inputs `(("bootar" ,bootar)))))
+
+(define gash-utils-boot
+ (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
- #:guile ,%bootstrap-guile+guild
- #:not-compiled-file-regexp "upstream\\.scm$"
+ #:tests? #f
+ #:guile ,%bootstrap-guile
+ #:imported-modules ((guix build gnu-bootstrap)
+ ,@%gnu-build-system-modules)
#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'unpack-guile-source
- (lambda _
- (let ((guile-source (assoc-ref %build-inputs "guile-source"))
- (bin (string-append (getcwd) "/zee-bin")))
- (mkdir-p bin)
- (with-directory-excursion bin
- (invoke "tar" "--strip-components=2"
-
- "-xvf" guile-source
- (string-append "guile-"
- ,(package-version guile-2.0)
- "/meta/guild.in"))
- (copy-file "guild.in" "guild")
- (chmod "guild" #o555))
- #t)))
- (add-before 'unpack 'set-path
- (lambda _
- (let ((bash (assoc-ref %build-inputs "bash"))
- (tar (assoc-ref %build-inputs "tar"))
- (xz (assoc-ref %build-inputs "xz"))
- (bin (string-append (getcwd) "/zee-bin")))
- (mkdir-p bin)
- (setenv "PATH" (string-append bin ":" (getenv "PATH")))
- (copy-file bash (string-append bin "/bash"))
- (copy-file bash (string-append bin "/sh"))
- (copy-file tar (string-append bin "/tar"))
- (copy-file xz (string-append bin "/xz"))
- #t)))
- (add-before 'build 'set-env
- (lambda _
- (let ((gash (assoc-ref %build-inputs "gash")))
- (setenv "LANG" "C")
- (setenv "LC_ALL" "C")
- (setenv "GUILE_LOAD_PATH"
- (string-append (getcwd)
- ":" (getcwd) "/system/base"
- ":" gash "/share/guile/2.0"))
- (setenv "GUILE_LOAD_COMPILED_PATH"
- (string-append ".:" gash "/lib/guile/2.0/site-ccache/"))
- (format (current-error-port)
- "GUILE_LOAD_PATH=~s\n" (getenv "GUILE_LOAD_PATH"))
- #t)))
- (add-before 'build 'replace-lalr.upstream
- (lambda _
- (let ((lalr.upstream (assoc-ref %build-inputs "lalr.upstream")))
- (copy-file lalr.upstream "system/base/lalr.upstream.scm")
- #t)))
- (add-after 'build 'build-scripts
- (lambda _
- (let* ((guile (assoc-ref %build-inputs "guile"))
- (guile (string-append guile "/bin/guile"))
- (gash (string-append guile "gash"))
- (out (assoc-ref %outputs "out"))
- (effective "2.0")
- (guilemoduledir (string-append gash "/share/guile/site/" effective "/"))
- (guileobjectdir (string-append gash "/lib/guile/" effective "/site-ccache/"))
- (gashmoduledir (string-append out "/share/guile/site/" effective "/"))
- (gashobjectdir (string-append out "/lib/guile/" effective "/site-ccache/"))
- (bin (string-append out "/bin")))
- (define (wrap name)
- (copy-file "command.in" name)
- (chmod name #o555)
- (substitute* name
- (("@GUILE@") guile)
- (("@guilemoduledir@") guilemoduledir)
- (("@guileobjectdir") guileobjectdir)
- (("@gashmoduledir@") gashmoduledir)
- (("@gashobjectdir") gashobjectdir)
- (("@command@") name))
- (install-file name bin))
- (mkdir-p bin)
- (with-directory-excursion "bin"
- (for-each wrap '("awk"
- "basename"
- "cat"
- "chmod"
- "cmp"
- "compress"
- "cp"
- "cut"
- "diff"
- "dirname"
- "expr"
- "false"
- "find"
- "grep"
- "gzip"
- "head"
- "ln"
- "ls"
- "mkdir"
- "mv"
- "pwd"
- "reboot"
- "rm"
- "rmdir"
- "sed"
- "sleep"
- "sort"
- "tar"
- "test"
- "touch"
- "tr"
- "true"
- "uname"
- "uniq"
- "wc"
- "which")))
- (with-directory-excursion bin
- (copy-file "grep" "fgrep")
- (copy-file "grep" "egrep")
- (copy-file "test" "["))
- #t))))))))
+ (begin
+ (use-modules (guix build gnu-bootstrap))
+ (modify-phases %standard-phases
+ (add-after 'unpack 'set-load-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((gash (assoc-ref inputs "gash")))
+ (add-to-load-path (string-append gash "/share/guile/site/"
+ (effective-version))))
+ #t))
+ (add-before 'configure 'pre-configure
+ (lambda _
+ (format #t "Creating gash/commands/testb.scm~%")
+ (copy-file "gash/commands/test.scm"
+ "gash/commands/testb.scm")
+ (substitute* "gash/commands/testb.scm"
+ (("gash commands test") "gash commands testb")
+ (("apply test [(]cdr") "apply test/bracket (cdr"))
+ (for-each (lambda (script)
+ (let ((target (string-append "scripts/"
+ script ".in")))
+ (format #t "Creating scripts/~a~%" target)
+ (copy-file "scripts/template.in" target)
+ (substitute* target
+ (("@UTILITY@") script))))
+ '("awk" "basename" "cat" "chmod" "cmp" "command"
+ "compress" "cp" "cut" "diff" "dirname" "expr"
+ "false" "find" "grep" "head" "ln" "ls" "mkdir"
+ "mv" "printf" "pwd" "reboot" "rm" "rmdir"
+ "sed" "sleep" "sort" "tar" "test" "touch" "tr"
+ "true" "uname" "uniq" "wc" "which"))
+ (format #t "Creating scripts/[.in~%")
+ (copy-file "scripts/template.in" "scripts/[.in")
+ (substitute* "scripts/[.in"
+ (("@UTILITY@") "testb"))
+ (delete-file "scripts/template.in")
+ #t))
+ (replace 'configure
+ (bootstrap-configure ,(package-version gash-utils)
+ "gash" "scripts"))
+ (replace 'build (bootstrap-build "gash"))
+ (replace 'install (bootstrap-install "gash" "scripts"))
+ ;; XXX: The scripts should add Gash to their load paths and
+ ;; this phase should not exist.
+ (add-after 'install 'copy-gash
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (moddir (string-append out "/share/guile/site/"
+ (effective-version)))
+ (godir (string-append out "/lib/guile/"
+ (effective-version)
+ "/site-ccache"))
+ (gash (assoc-ref inputs "gash"))
+ (gash-moddir (string-append gash "/share/guile/site/"
+ (effective-version)))
+ (gash-godir (string-append gash "/lib/guile/"
+ (effective-version)
+ "/site-ccache")))
+ (copy-file (string-append gash-moddir "/gash/compat.scm")
+ (string-append moddir "/gash/compat.scm"))
+ (copy-recursively (string-append gash-moddir "/gash/compat")
+ (string-append moddir "/gash/compat"))
+ (copy-file (string-append gash-godir "/gash/compat.go")
+ (string-append godir "/gash/compat.go"))
+ (copy-recursively (string-append gash-godir "/gash/compat")
+ (string-append godir "/gash/compat"))
+ #t)))))))
+ (inputs `(("gash" ,gash-boot)
+ ("guile" ,%bootstrap-guile)))
+ (native-inputs `(("bootar" ,bootar)))))
(define (%boot-gash-inputs)
`(("bash" , gash-boot) ; gnu-build-system wants "bash"
- ("coreutils" , gash-core-utils-boot)
- ("guile" ,%bootstrap-guile)
- ("guile+guild" ,%bootstrap-guile+guild)))
+ ("coreutils" , gash-utils-boot)
+ ("bootar" ,bootar)
+ ("guile" ,%bootstrap-guile)))
(define %bootstrap-mes-rewired
(package
(name "bootstrap-mes-rewired")
(version "0.19")
(source #f)
- (native-inputs `(("mes" ,(@ (gnu packages bootstrap) %bootstrap-mes))
+ (native-inputs `(("mes" ,%bootstrap-mes)
("gash" ,gash-boot)))
(inputs '())
(propagated-inputs '())
(build-system trivial-build-system)
(arguments
`(#:guile ,%bootstrap-guile
- #:modules ((guix build utils)
- (srfi srfi-26))
+ #:modules ((guix build utils))
+
#:builder (begin
(use-modules (guix build utils)
(srfi srfi-26))
+
(let* ((mes (assoc-ref %build-inputs "mes"))
(gash (assoc-ref %build-inputs "gash"))
(mes-bin (string-append mes "/bin"))
(package
(inherit mes)
(name "mes-boot")
- (version "0.21-33-g6d493b90d")
+ (version "0.22")
(source (origin
(method url-fetch)
- (uri (string-append "http://lilypond.org/janneke/mes/"
+ (uri (string-append "mirror://gnu/mes/"
"mes-" version ".tar.gz"))
(sha256
(base32
- "0nr74zyam5n82svjwfbcz2mycj88vvsqab12x0mxv1lm6yqxqmmj"))))
+ "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
(inputs '())
(propagated-inputs '())
(native-inputs
(setenv "GUILE_LOAD_PATH"
(string-append
mes "/share/mes/module"
- ":" dir "/nyacc-0.99.0/module"
- ":" (getenv "GUILE_LOAD_PATH")))
+ ":" dir "/nyacc-0.99.0/module"))
(invoke "gash" "configure.sh"
(string-append "--prefix=" out)
(string-append "--host=i686-linux-gnu")))))
(native-inputs `(("boot-patch" ,(search-patch "glibc-boot-2.2.5.patch"))
("system-patch" ,(search-patch "glibc-bootstrap-system-2.2.5.patch"))
("headers" ,mesboot-headers)
- ,@(%boot-mesboot-core-inputs)
- ("gash" ,gash-boot)))
+ ,@(%boot-mesboot-core-inputs)))
(outputs '("out"))
(arguments
`(#:implicit-inputs? #f
(format (current-error-port)
"running ./configure ~a\n" (string-join configure-flags))
(apply invoke "./configure" configure-flags)))
- (add-after 'configure 'fixup-configure
- (lambda _
- (let* ((out (assoc-ref %outputs "out"))
- (bash (assoc-ref %build-inputs "bash"))
- (shell (string-append bash "/bin/bash"))
- (gash (assoc-ref %build-inputs "gash"))
- (gash (string-append gash "/bin/gash")))
- (substitute* "config.make"
- (("INSTALL = scripts/") "INSTALL = $(..)./scripts/"))
- (substitute* "config.make"
- (("INSTALL = scripts/") "INSTALL = $(..)./scripts/")
- (("BASH = ") (string-append
- "SHELL = " shell "
-BASH = ")))
- ;; XXX: make-syscalls.sh does not run correctly with
- ;; bash-mesboot0, producing a wrong sysd-syscalls.
-
- ;; This leads to posix/uname.c getting compiled where it
- ;; shouldn't:
-
- ;; ../sysdeps/generic/uname.c:25: config-name.h: error 02
- (substitute* "sysdeps/unix/make-syscalls.sh"
- (("#!/gnu/store.*/bin/bash") (string-append "#! " gash)))
-
- (substitute* "sysdeps/unix/Makefile"
- ((" [{] [$][(]SHELL[)]") (string-append " { " gash))))
- #t)))))))
+ (add-after 'configure 'fixup-configure
+ (lambda _
+ (let* ((out (assoc-ref %outputs "out"))
+ (bash (assoc-ref %build-inputs "bash"))
+ (shell (string-append bash "/bin/bash")))
+ (substitute* "config.make"
+ (("INSTALL = scripts/") "INSTALL = $(..)./scripts/"))
+ (substitute* "config.make"
+ (("INSTALL = scripts/") "INSTALL = $(..)./scripts/")
+ (("BASH = ") (string-append
+ "SHELL = " shell "
+ BASH = ")))
+ #t))))))))
(define gcc-mesboot0
(package
("sed" ,sed-mesboot)
("tar" ,tar-mesboot)
,@(fold alist-delete (%boot-mesboot0-inputs)
- '("bash" "bash" "binutils" "coreutils" "gash" "gawk" "grep " "guile"
- "make" "sed" "tar"))))
+ '("bash" "binutils" "bootar" "coreutils" "gash"
+ "gawk" "grep" "guile" "make" "sed" "tar"))))
(define gmp-boot
(package
("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")
(name "bzip2-boot0")
(native-inputs `())
(inputs
- `(("make" ,gnu-make-boot0)
+ `(("diffutils" ,diffutils-boot0)
+ ("make" ,gnu-make-boot0)
,@(%bootstrap-inputs+toolchain)))
(arguments
`(#:guile ,%bootstrap-guile
`(#:tests? #f ; the test suite needs diffutils
#:guile ,%bootstrap-guile
#:implicit-inputs? #f
- ,@(package-arguments diffutils)))))
+ ,@(match (%current-system)
+ ((or "arm-linux" "aarch64-linux")
+ (substitute-keyword-arguments (package-arguments diffutils)
+ ((#:configure-flags flags ''())
+ ;; The generated config.status has some problems due to the
+ ;; bootstrap environment. Disable dependency tracking to work
+ ;; around it.
+ `(cons "--disable-dependency-tracking" ,flags))))
+ (_ '()))))))
(define findutils-boot0
(package
;; The build system assumes we have done a mistake when time_t is 32-bit
;; on a 64-bit system. Ignore that for our bootstrap toolchain.
- ,@(if (target-64bit?)
- (substitute-keyword-arguments (package-arguments findutils)
- ((#:configure-flags flags ''())
- `(cons "TIME_T_32_BIT_OK=yes"
- ,flags)))
- (package-arguments findutils))))))
+ ,@(substitute-keyword-arguments (package-arguments findutils)
+ ((#:configure-flags flags ''())
+ `(append
+ ,(if (target-64bit?)
+ ''("TIME_T_32_BIT_OK=yes")
+ ''())
+ ,(match (%current-system)
+ ((or "arm-linux" "aarch64-linux")
+ ''("--disable-dependency-tracking"))
+ (_ ''()))
+ ,flags)))))))
(define file
(package
(inherit (@ (gnu packages file) file))
(arguments
- `(#:configure-flags '("--disable-bzlib")))))
+ `(#:configure-flags
+ `("--disable-bzlib"
+ ,,@(match (%current-system)
+ ((or "arm-linux" "aarch64-linux")
+ '("--disable-dependency-tracking"))
+ (_ '())))))))
(define file-boot0
(package
,@(package-arguments tar)))))
(define (%boot0-inputs)
- `(("bzip2" ,bzip2-boot0)
- ("coreutils" ,coreutils-boot0)
+ `(,@(match (%current-system)
+ ((or "i686-linux" "x86_64-linux")
+ `(("bzip2" ,bzip2-boot0)
+ ("coreutils" ,coreutils-boot0)
+ ("gawk" ,gawk-boot0)
+ ("patch" ,patch-boot0)
+ ("sed" ,sed-boot0)
+ ("tar" ,tar-boot0)))
+ (_ '()))
+ ("make" ,gnu-make-boot0)
("diffutils" ,diffutils-boot0)
("findutils" ,findutils-boot0)
("file" ,file-boot0)
- ("gawk" ,gawk-boot0)
- ("make" ,gnu-make-boot0)
- ("patch" ,patch-boot0)
- ("sed" ,sed-boot0)
- ("tar" ,tar-boot0)
,@(%bootstrap-inputs+toolchain)))
(define* (boot-triplet #:optional (system (%current-system)))
`(#: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.