Archived
1
0
Fork 0

gnu: commencement: Simplify Gash and Gash-Utils.

This change does three things.  First Gash-Utils is updated to
0.1.0.  Then, the bootstrap Gash and Gash-Utils packages are
arranged to be built without using 'guild'.  Finally, instead of
using a binary 'tar' via 'bootstrap-executable' to extract Gash and
Gash-Utils, a self-extracting Scheme implementation of 'tar' and
'gzip' is used instead.

These three changes need to happen in concert to avoid breaking the
bootstrap process.

* gnu/packages/shells.scm (gash-utils): Update to 0.1.0; remove
'autoconf' and 'automake' from 'native-inputs'; delete 'arguments';
update the home-page, synopsis, and description.
* gnu/packages/commencement.scm (bootar): New variable.
(gash-boot): Replace 'tar', and 'xz' with 'bootar'; remove 'bash'
and 'guile-source'; do not use 'guile-build-system' but rather
'gnu-build-system' with some modified phases; disable tests.
(gash-utils-boot): Likewise.
(%boot-gash-inputs): Add 'bootar'; replace '%bootstrap-guile+guild' with
'%bootstrap-guile'.
(mes-boot): In the configure phase, do not reference 'GUILE_LOAD_PATH'
as it is no longer set.
This commit is contained in:
Timothy Sample 2020-02-03 10:51:07 -05:00 committed by Jan Nieuwenhuizen
parent 9c9407f746
commit 2ca7af43fe
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -7,6 +7,7 @@
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -51,8 +52,8 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system guile)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix memoization) #:use-module (guix memoization)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
@ -140,252 +141,170 @@
(variable "GUILE_LOAD_COMPILED_PATH") (variable "GUILE_LOAD_COMPILED_PATH")
(files '("lib/guile/2.0/site-ccache"))))))) (files '("lib/guile/2.0/site-ccache")))))))
(define bootar
(package
(name "bootar")
(version "1")
(source (origin
(method url-fetch)
(uri "https://files.ngyro.com/bootar/bootar-1.ses")
(sha256
(base32
"011p0nky2qp0vmyhvdx220qywxxp7a0m6pvy0lzzg4qxbpyqpf0r"))))
(build-system gnu-build-system)
(arguments
`(#: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 (define gash-boot
(package (package
(inherit gash) (inherit gash)
(name "gash-boot") (name "gash-boot")
(version "0.2.0") (source (origin
(source (bootstrap-origin (inherit (package-source gash))
(origin (inherit (package-source gash)) (modules '())))
(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)))
(arguments (arguments
`(#:implicit-inputs? #f `(#:implicit-inputs? #f
#:guile ,%bootstrap-guile+guild #:tests? #f
#:guile ,%bootstrap-guile
#:imported-modules ((guix build gnu-bootstrap)
,@%gnu-build-system-modules)
#:phases #:phases
(modify-phases %standard-phases (begin
(add-after 'unpack 'unpack-guile-source (use-modules (guix build gnu-bootstrap))
(lambda _ (modify-phases %standard-phases
(let ((guile-source (assoc-ref %build-inputs "guile-source")) (replace 'configure
(bin (string-append (getcwd) "/zee-bin"))) (bootstrap-configure ,(version) "gash" "scripts"))
(mkdir-p bin) (replace 'build (bootstrap-build "gash"))
(with-directory-excursion bin (replace 'install (bootstrap-install "gash" "scripts"))
(invoke "tar" "--strip-components=2" (add-after 'install 'install-symlinks
(lambda* (#:key outputs #:allow-other-keys)
"-xvf" guile-source (let ((out (assoc-ref outputs "out")))
(string-append "guile-" (symlink (string-append out "/bin/gash")
,(package-version guile-2.0) (string-append out "/bin/sh"))
"/meta/guild.in")) (symlink (string-append out "/bin/gash")
(copy-file "guild.in" "guild") (string-append out "/bin/bash"))
(chmod "guild" #o555)) #t)))))))
#t))) (inputs `(("guile" ,%bootstrap-guile)))
(add-before 'unpack 'set-path (native-inputs `(("bootar" ,bootar)))))
(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-utils-boot (define gash-utils-boot
(package (package
(inherit gash-utils) (inherit gash-utils)
(name "gash-utils-boot") (name "gash-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)))
(arguments (arguments
`(#:implicit-inputs? #f `(#:implicit-inputs? #f
#:guile ,%bootstrap-guile+guild #:tests? #f
#:not-compiled-file-regexp "upstream\\.scm$" #:guile ,%bootstrap-guile
#:imported-modules ((guix build gnu-bootstrap)
,@%gnu-build-system-modules)
#:phases #:phases
(modify-phases %standard-phases (begin
(add-after 'unpack 'unpack-guile-source (use-modules (guix build gnu-bootstrap))
(lambda _ (modify-phases %standard-phases
(let ((guile-source (assoc-ref %build-inputs "guile-source")) (add-after 'unpack 'set-load-path
(bin (string-append (getcwd) "/zee-bin"))) (lambda* (#:key inputs #:allow-other-keys)
(mkdir-p bin) (let ((gash (assoc-ref inputs "gash")))
(with-directory-excursion bin (add-to-load-path (string-append gash "/share/guile/site/"
(invoke "tar" "--strip-components=2" (effective-version))))
#t))
"-xvf" guile-source (add-before 'configure 'pre-configure
(string-append "guile-" (lambda _
,(package-version guile-2.0) (format #t "Creating gash/commands/testb.scm~%")
"/meta/guild.in")) (copy-file "gash/commands/test.scm"
(copy-file "guild.in" "guild") "gash/commands/testb.scm")
(chmod "guild" #o555)) (substitute* "gash/commands/testb.scm"
#t))) (("gash commands test") "gash commands testb")
(add-before 'unpack 'set-path (("apply test [(]cdr") "apply test/bracket (cdr"))
(lambda _ (for-each (lambda (script)
(let ((bash (assoc-ref %build-inputs "bash")) (let ((target (string-append "scripts/"
(tar (assoc-ref %build-inputs "tar")) script ".in")))
(xz (assoc-ref %build-inputs "xz")) (format #t "Creating scripts/~a~%" target)
(bin (string-append (getcwd) "/zee-bin"))) (copy-file "scripts/template.in" target)
(mkdir-p bin) (substitute* target
(setenv "PATH" (string-append bin ":" (getenv "PATH"))) (("@UTILITY@") script))))
(copy-file bash (string-append bin "/bash")) '("awk" "basename" "cat" "chmod" "cmp" "command"
(copy-file bash (string-append bin "/sh")) "compress" "cp" "cut" "diff" "dirname" "expr"
(copy-file tar (string-append bin "/tar")) "false" "find" "grep" "head" "ln" "ls" "mkdir"
(copy-file xz (string-append bin "/xz")) "mv" "printf" "pwd" "reboot" "rm" "rmdir"
#t))) "sed" "sleep" "sort" "tar" "test" "touch" "tr"
(add-before 'build 'set-env "true" "uname" "uniq" "wc" "which"))
(lambda _ (format #t "Creating scripts/[.in~%")
(let ((gash (assoc-ref %build-inputs "gash"))) (copy-file "scripts/template.in" "scripts/[.in")
(setenv "LANG" "C") (substitute* "scripts/[.in"
(setenv "LC_ALL" "C") (("@UTILITY@") "testb"))
(setenv "GUILE_LOAD_PATH" (delete-file "scripts/template.in")
(string-append (getcwd) #t))
":" (getcwd) "/system/base" (replace 'configure
":" gash "/share/guile/2.0")) (bootstrap-configure ,(version) "gash" "scripts"))
(setenv "GUILE_LOAD_COMPILED_PATH" (replace 'build (bootstrap-build "gash"))
(string-append ".:" gash "/lib/guile/2.0/site-ccache/")) (replace 'install (bootstrap-install "gash" "scripts"))
(format (current-error-port) ;; XXX: The scripts should add Gash to their load paths and
"GUILE_LOAD_PATH=~s\n" (getenv "GUILE_LOAD_PATH")) ;; this phase should not exist.
#t))) (add-after 'install 'copy-gash
(add-before 'build 'replace-lalr.upstream (lambda* (#:key inputs outputs #:allow-other-keys)
(lambda _ (let* ((out (assoc-ref outputs "out"))
(let ((lalr.upstream (assoc-ref %build-inputs "lalr.upstream"))) (moddir (string-append out "/share/guile/site/"
(copy-file lalr.upstream "system/base/lalr.upstream.scm") (effective-version)))
#t))) (godir (string-append out "/lib/guile/"
(add-after 'build 'build-scripts (effective-version)
(lambda _ "/site-ccache"))
(let* ((guile (assoc-ref %build-inputs "guile")) (gash (assoc-ref inputs "gash"))
(guile (string-append guile "/bin/guile")) (gash-moddir (string-append gash "/share/guile/site/"
(gash (string-append guile "gash")) (effective-version)))
(out (assoc-ref %outputs "out")) (gash-godir (string-append gash "/lib/guile/"
(effective "2.0") (effective-version)
(guilemoduledir (string-append gash "/share/guile/site/" effective "/")) "/site-ccache")))
(guileobjectdir (string-append gash "/lib/guile/" effective "/site-ccache/")) (copy-file (string-append gash-moddir "/gash/compat.scm")
(gashmoduledir (string-append out "/share/guile/site/" effective "/")) (string-append moddir "/gash/compat.scm"))
(gashobjectdir (string-append out "/lib/guile/" effective "/site-ccache/")) (copy-recursively (string-append gash-moddir "/gash/compat")
(bin (string-append out "/bin"))) (string-append moddir "/gash/compat"))
(define (wrap name) (copy-file (string-append gash-godir "/gash/compat.go")
(copy-file "command.in" name) (string-append godir "/gash/compat.go"))
(chmod name #o555) (copy-recursively (string-append gash-godir "/gash/compat")
(substitute* name (string-append godir "/gash/compat"))
(("@GUILE@") guile) #t)))))))
(("@guilemoduledir@") guilemoduledir) (inputs `(("gash" ,gash-boot)
(("@guileobjectdir") guileobjectdir) ("guile" ,%bootstrap-guile)))
(("@gashmoduledir@") gashmoduledir) (native-inputs `(("bootar" ,bootar)))))
(("@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))))))))
(define (%boot-gash-inputs) (define (%boot-gash-inputs)
`(("bash" , gash-boot) ; gnu-build-system wants "bash" `(("bash" , gash-boot) ; gnu-build-system wants "bash"
("coreutils" , gash-utils-boot) ("coreutils" , gash-utils-boot)
("guile" ,%bootstrap-guile) ("bootar" ,bootar)
("guile+guild" ,%bootstrap-guile+guild))) ("guile" ,%bootstrap-guile)))
(define %bootstrap-mes-rewired (define %bootstrap-mes-rewired
(package (package
@ -538,8 +457,7 @@ $MES -e '(mescc)' module/mescc.scm -- \"$@\"
(setenv "GUILE_LOAD_PATH" (setenv "GUILE_LOAD_PATH"
(string-append (string-append
mes "/share/mes/module" mes "/share/mes/module"
":" dir "/nyacc-0.99.0/module" ":" dir "/nyacc-0.99.0/module"))
":" (getenv "GUILE_LOAD_PATH")))
(invoke "gash" "configure.sh" (invoke "gash" "configure.sh"
(string-append "--prefix=" out) (string-append "--prefix=" out)
(string-append "--host=i686-linux-gnu"))))) (string-append "--host=i686-linux-gnu")))))