[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
60/63: Add (guix build gnu-bootstrap).
From: |
guix-commits |
Subject: |
60/63: Add (guix build gnu-bootstrap). |
Date: |
Mon, 17 Feb 2020 16:01:08 -0500 (EST) |
janneke pushed a commit to branch wip-bootstrap
in repository guix.
commit 9f20fd161e45fcdaad0efeb322dc7d639b012fa6
Author: Timothy Sample <address@hidden>
AuthorDate: Sat Feb 8 09:57:21 2020 -0500
Add (guix build gnu-bootstrap).
* guix/build/gnu-bootstrap.scm: New file.
* Makefile.am (MODULES): Add it.
---
Makefile.am | 1 +
guix/build/gnu-bootstrap.scm | 114 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index c6a2e6c..0371d92 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -172,6 +172,7 @@ MODULES = \
guix/build/git.scm \
guix/build/hg.scm \
guix/build/glib-or-gtk-build-system.scm \
+ guix/build/gnu-bootstrap.scm \
guix/build/gnu-build-system.scm \
guix/build/gnu-dist.scm \
guix/build/guile-build-system.scm \
diff --git a/guix/build/gnu-bootstrap.scm b/guix/build/gnu-bootstrap.scm
new file mode 100644
index 0000000..1cb9dc5
--- /dev/null
+++ b/guix/build/gnu-bootstrap.scm
@@ -0,0 +1,114 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Timothy Sample <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+;; Commentary:
+;;
+;; These procedures can be used to adapt the GNU Build System to build
+;; pure Scheme packages targeting the bootstrap Guile.
+;;
+;; Code:
+
+(define-module (guix build gnu-bootstrap)
+ #:use-module (guix build utils)
+ #:use-module (system base compile)
+ #:export (bootstrap-configure
+ bootstrap-build
+ bootstrap-install))
+
+(define (bootstrap-configure version modules scripts)
+ "Create a procedure that configures an early bootstrap package. The
+procedure will search the MODULES directory and configure all of the
+'.in' files with VERSION. It will then search the SCRIPTS directory and
+configure all of the '.in' files with the bootstrap Guile and its module
+and object directories."
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (guile-dir (assoc-ref inputs "guile"))
+ (guile (string-append guile-dir "/bin/guile"))
+ (moddir (string-append out "/share/guile/site/"
+ (effective-version)))
+ (godir (string-append out "/lib/guile/"
+ (effective-version)
+ "/site-ccache")))
+ (for-each (lambda (template)
+ (format #t "Configuring ~a~%" template)
+ (let ((target (string-drop-right template 3)))
+ (copy-file template target)
+ (substitute* target
+ (("@VERSION@") version))))
+ (find-files modules
+ (lambda (fn st)
+ (string-suffix? ".in" fn))))
+ (for-each (lambda (template)
+ (format #t "Configuring ~a~%" template)
+ (let ((target (string-drop-right template 3)))
+ (copy-file template target)
+ (substitute* target
+ (("@GUILE@") guile)
+ (("@MODDIR@") moddir)
+ (("@GODIR@") godir))
+ (chmod target #o755)))
+ (find-files scripts
+ (lambda (fn st)
+ (string-suffix? ".in" fn))))
+ #t)))
+
+(define (bootstrap-build modules)
+ "Create a procedure that builds an early bootstrap package. The
+procedure will search the MODULES directory and compile all of the
+'.scm' files."
+ (lambda _
+ (add-to-load-path (getcwd))
+ (for-each (lambda (scm)
+ (let* ((base (string-drop-right scm 4))
+ (go (string-append base ".go"))
+ (dir (dirname scm)))
+ (format #t "Compiling ~a~%" scm)
+ (compile-file scm #:output-file go)))
+ (find-files modules "\\.scm$"))
+ #t))
+
+(define (bootstrap-install modules scripts)
+ "Create a procedure that installs an early bootstrap package. The
+procedure will install all of the '.scm' and '.go' files in the MODULES
+directory, and all the executable files in the SCRIPTS directory."
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (guile-dir (assoc-ref inputs "guile"))
+ (guile (string-append guile-dir "/bin/guile"))
+ (moddir (string-append out "/share/guile/site/"
+ (effective-version)))
+ (godir (string-append out "/lib/guile/"
+ (effective-version)
+ "/site-ccache")))
+ (for-each (lambda (scm)
+ (let* ((base (string-drop-right scm 4))
+ (go (string-append base ".go"))
+ (dir (dirname scm)))
+ (format #t "Installing ~a~%" scm)
+ (install-file scm (string-append moddir "/" dir))
+ (format #t "Installing ~a~%" go)
+ (install-file go (string-append godir "/" dir))))
+ (find-files modules "\\.scm$"))
+ (for-each (lambda (script)
+ (format #t "Installing ~a~%" script)
+ (install-file script (string-append out "/bin")))
+ (find-files scripts
+ (lambda (fn st)
+ (executable-file? fn))))
+ #t)))
- 39/63: gnu: commencement: gcc-mesboot: Use Gash instead of coreutils&co., (continued)
- 39/63: gnu: commencement: gcc-mesboot: Use Gash instead of coreutils&co., guix-commits, 2020/02/17
- 41/63: gnu: commencement: Add coreutils-mesboot., guix-commits, 2020/02/17
- 42/63: gnu: commencement: Remove m4-mesboot., guix-commits, 2020/02/17
- 49/63: gnu: commencement: Add coreutils-boot0., guix-commits, 2020/02/17
- 54/63: gnu: commencement: gnu-make-mesboot: Rename from make-mesboot., guix-commits, 2020/02/17
- 53/63: gnu: commencement: gnu-make-mesboot0: Rename from make-mesboot0., guix-commits, 2020/02/17
- 57/63: gnu: commencement: mes-boot: Update to 0.22., guix-commits, 2020/02/17
- 52/63: gnu: bootstrap: Remove %bootstrap-coreutils&co, %bootstrap-bash., guix-commits, 2020/02/17
- 62/63: gnu: commencement: Remove %bootstrap-guile+guild., guix-commits, 2020/02/17
- 56/63: gnu: commencement: glibc-mesboot: Use gash only, instead of bash/gash mix., guix-commits, 2020/02/17
- 60/63: Add (guix build gnu-bootstrap).,
guix-commits <=
- 51/63: gnu: commencement: %bootstrap-tarballs: Remove %bootstrap-binaries-tarball., guix-commits, 2020/02/17
- 55/63: gnu: commencement: gash-core-utils-boot: Update to 0.0.214-fc1b., guix-commits, 2020/02/17
- 63/63: gnu: commencement: Fix '%boot-mesboot1-inputs'., guix-commits, 2020/02/17
- 40/63: gnu: commencement: gcc-mesboot-wrapper: Use Gash instead of coreutils&co., guix-commits, 2020/02/17
- 44/63: gnu: commencement: Add gawk-boot0., guix-commits, 2020/02/17
- 45/63: gnu: commencement: Add sed-boot0., guix-commits, 2020/02/17
- 46/63: gnu: commencement: Add patch-boot0., guix-commits, 2020/02/17
- 48/63: gnu: commencement: Add tar-boot0., guix-commits, 2020/02/17
- 59/63: gnu: Rename 'gash-core-utils' to 'gash-utils'., guix-commits, 2020/02/17
- 61/63: gnu: commencement: Simplify Gash and Gash-Utils., guix-commits, 2020/02/17