guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: bootstrap: Add gash-boot0, gash-core-utils-boot0 WIP


From: guix-commits
Subject: 02/02: bootstrap: Add gash-boot0, gash-core-utils-boot0 WIP
Date: Tue, 3 Dec 2019 17:41:08 -0500 (EST)

janneke pushed a commit to branch wip-bootstrap
in repository guix.

commit 32a4044268ca8541649d30830cf6da66cdfbf378
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Mon Dec 2 19:11:23 2019 +0100

    bootstrap: Add gash-boot0, gash-core-utils-boot0 WIP
    
    * gnu/packages/commencement.scm (gash-boot0, gash-core-utils-boot0): New
    variable.
---
 gnu/packages/commencement.scm | 274 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 274 insertions(+)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index f9c96f5..cc957f2 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -54,6 +54,7 @@
   #: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 memoization)
   #:use-module (guix utils)
@@ -124,6 +125,279 @@
                      (for-each rewire-script (find-files bin))
                      #t))))))
 
+(define %bootstrap-guile+guild
+  (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)
+    (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))))
+
+(define gash-boot0
+  (package
+    (inherit gash)
+    (name "gash-boot")
+    (version "0.1.48-f580")
+    (source (bootstrap-origin
+             (origin
+               (method url-fetch)
+               (uri (string-append 
"https://lilypond.org/janneke/guix/20191123/";
+                                   "/gash-" version ".tar.gz"))
+               (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))
+               (sha256
+                (base32
+                 "0lhaszj5rb7mxfrifbwqg9cq0r8kc9xm9f7rmmdcs35cmckwdlfj")))))
+    (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
+     `(#:implicit-inputs? #f
+       #:guile ,%bootstrap-guile+guild
+       #: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)
+               #t))))))))
+
+(define-public gash-core-utils-boot0
+  (package
+    (inherit gash-core-utils)
+    (name "gash-core-utils-boot")
+    (version "0.0.211-789c3")
+    (source (bootstrap-origin
+             (origin
+               (method url-fetch)
+               (uri (string-append 
"https://lilypond.org/janneke/guix/20191123/";
+                                   "/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
+                 "1ycf0ivyn9q3lc9hwq8vxg6wkwpsykvh48a5lrzsmganh0ma8wrr")))))
+    (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)
+              ("gash" ,gash-boot0)))
+    (arguments
+     `(#:implicit-inputs? #f
+       #:guile ,%bootstrap-guile+guild
+       #:not-compiled-file-regexp "upstream\\.scm$"
+       #: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 "GUILE_LOAD_PATH" (string-append ".:" gash 
"/share/guile/2.0"))
+               (setenv "GUILE_FLAGS" (string-append "-L ."))
+               (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-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"))
+                 (copy-file "grep" "fgrep")
+                 (copy-file "grep" "egrep")
+                 (copy-file "test" "["))
+               #t))))))))
+
 (define %bootstrap-gash %bootstrap-gash-rewired)
 
 (define nyacc-boot



reply via email to

[Prev in Thread] Current Thread [Next in Thread]