distro: Move bootstrap packages to (distro packages bootstrap).
* distro/packages/base.scm (glibc-dynamic-linker, %bootstrap-guile, bootstrap-origin, package-from-tarball, %bootstrap-base-url, %bootstrap-coreutils&co, %bootstrap-binutils, %bootstrap-glibc, %bootstrap-gcc, %bootstrap-inputs, package-with-bootstrap-guile): Move to ... * distro/packages/bootstrap.scm: ... here. New file. * Makefile.am (MODULES): Add it. * tests/builders.scm: Use (distro packages bootstrap). (%bootstrap-guile): Remove. * tests/packages.scm: Likewise. * tests/union.scm: Likewise, and remove @@ to access %bootstrap-inputs. * tests/derivations.scm: Use (distro packages bootstrap) and remove @@ to access %bootstrap-coreutils&co. * HACKING (When the platform is supported by Nixpkgs): Update accordingly.master
parent
9d9e645081
commit
18633d4f35
2
HACKING
2
HACKING
|
@ -80,7 +80,7 @@ In that case, the easiest thing is to bootstrap the distro using
|
||||||
binaries from Nixpkgs.
|
binaries from Nixpkgs.
|
||||||
|
|
||||||
To do that, you need to comment out the definitions of
|
To do that, you need to comment out the definitions of
|
||||||
‘%bootstrap-guile’ and ‘%bootstrap-inputs’ in distro/packages/base.scm
|
‘%bootstrap-guile’ and ‘%bootstrap-inputs’ in distro/packages/bootstrap.scm
|
||||||
to force the use of Nixpkgs derivations. For instance, when porting to
|
to force the use of Nixpkgs derivations. For instance, when porting to
|
||||||
‘i686-linux’, you should redefine these variables along these lines:
|
‘i686-linux’, you should redefine these variables along these lines:
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ MODULES = \
|
||||||
guix.scm \
|
guix.scm \
|
||||||
distro.scm \
|
distro.scm \
|
||||||
distro/packages/base.scm \
|
distro/packages/base.scm \
|
||||||
|
distro/packages/bootstrap.scm \
|
||||||
distro/packages/guile.scm \
|
distro/packages/guile.scm \
|
||||||
distro/packages/ld-wrapper.scm \
|
distro/packages/ld-wrapper.scm \
|
||||||
distro/packages/lout.scm \
|
distro/packages/lout.scm \
|
||||||
|
|
|
@ -19,14 +19,12 @@
|
||||||
|
|
||||||
(define-module (distro packages base)
|
(define-module (distro packages base)
|
||||||
#:use-module (distro)
|
#:use-module (distro)
|
||||||
|
#:use-module (distro packages bootstrap)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix ftp)
|
#:use-module (guix ftp)
|
||||||
#:use-module (guix http)
|
#:use-module (guix http)
|
||||||
#:use-module (guix build-system)
|
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
#:use-module (guix build-system trivial)
|
#:use-module (guix build-system trivial)
|
||||||
#:use-module ((guix store) #:select (add-to-store add-text-to-store))
|
|
||||||
#:use-module ((guix derivations) #:select (derivation))
|
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
|
@ -692,12 +690,6 @@ BFD (Binary File Descriptor) library, `gprof', `nm', `strip', etc.")
|
||||||
(license "GPLv3+")
|
(license "GPLv3+")
|
||||||
(home-page "http://www.gnu.org/software/binutils/")))
|
(home-page "http://www.gnu.org/software/binutils/")))
|
||||||
|
|
||||||
(define (glibc-dynamic-linker system)
|
|
||||||
"Return the name of Glibc's dynamic linker for SYSTEM."
|
|
||||||
(cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
|
|
||||||
((string=? system "i686-linux") "/lib/ld-linux.so.2")
|
|
||||||
(else (error "dynamic linker name not known for this system" system))))
|
|
||||||
|
|
||||||
(define-public gcc-4.7
|
(define-public gcc-4.7
|
||||||
(let ((stripped? #t)) ; TODO: make this a parameter
|
(let ((stripped? #t)) ; TODO: make this a parameter
|
||||||
(package
|
(package
|
||||||
|
@ -1377,311 +1369,6 @@ with the Linux kernel.")
|
||||||
;;; Bootstrap packages.
|
;;; Bootstrap packages.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
(define %bootstrap-guile
|
|
||||||
;; The Guile used to run the build scripts of the initial derivations.
|
|
||||||
;; It is just unpacked from a tarball containing a pre-built binary.
|
|
||||||
;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
|
|
||||||
;;
|
|
||||||
;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
|
|
||||||
;; support (for /etc/services).
|
|
||||||
(let ((raw (build-system
|
|
||||||
(name "raw")
|
|
||||||
(description "Raw build system with direct store access")
|
|
||||||
(build (lambda* (store name source inputs #:key outputs system)
|
|
||||||
(define (->store file)
|
|
||||||
(add-to-store store file #t #t "sha256"
|
|
||||||
(or (search-bootstrap-binary file
|
|
||||||
system)
|
|
||||||
(error "bootstrap binary not found"
|
|
||||||
file system))))
|
|
||||||
|
|
||||||
(let* ((tar (->store "tar"))
|
|
||||||
(xz (->store "xz"))
|
|
||||||
(mkdir (->store "mkdir"))
|
|
||||||
(bash (->store "bash"))
|
|
||||||
(guile (->store "guile-bootstrap-2.0.6.tar.xz"))
|
|
||||||
(builder
|
|
||||||
(add-text-to-store store
|
|
||||||
"build-bootstrap-guile.sh"
|
|
||||||
(format #f "
|
|
||||||
echo \"unpacking bootstrap Guile to '$out'...\"
|
|
||||||
~a $out
|
|
||||||
cd $out
|
|
||||||
~a -dc < ~a | ~a xv
|
|
||||||
|
|
||||||
# Sanity check.
|
|
||||||
$out/bin/guile --version~%"
|
|
||||||
mkdir xz guile tar)
|
|
||||||
(list mkdir xz guile tar))))
|
|
||||||
(derivation store name system
|
|
||||||
bash `(,builder) '()
|
|
||||||
`((,bash) (,builder)))))))))
|
|
||||||
(package
|
|
||||||
(name "guile-bootstrap")
|
|
||||||
(version "2.0")
|
|
||||||
(source #f)
|
|
||||||
(build-system raw)
|
|
||||||
(synopsis "Bootstrap Guile")
|
|
||||||
(description "Pre-built Guile for bootstrapping purposes.")
|
|
||||||
(home-page #f)
|
|
||||||
(license "LGPLv3+"))))
|
|
||||||
|
|
||||||
(define (bootstrap-origin source)
|
|
||||||
"Return a variant of SOURCE, an <origin> instance, whose method uses
|
|
||||||
%BOOTSTRAP-GUILE to do its job."
|
|
||||||
(define (boot fetch)
|
|
||||||
(lambda* (store url hash-algo hash
|
|
||||||
#:optional name #:key system)
|
|
||||||
(fetch store url hash-algo hash
|
|
||||||
#:guile %bootstrap-guile
|
|
||||||
#:system system)))
|
|
||||||
|
|
||||||
(let ((orig-method (origin-method source)))
|
|
||||||
(origin (inherit source)
|
|
||||||
(method (cond ((eq? orig-method http-fetch)
|
|
||||||
(boot http-fetch))
|
|
||||||
((eq? orig-method ftp-fetch)
|
|
||||||
(boot ftp-fetch))
|
|
||||||
(else orig-method))))))
|
|
||||||
|
|
||||||
(define (package-from-tarball name* source* program-to-test description*)
|
|
||||||
"Return a package that correspond to the extraction of SOURCE*.
|
|
||||||
PROGRAM-TO-TEST is a program to run after extraction of SOURCE*, to
|
|
||||||
check whether everything is alright."
|
|
||||||
(package
|
|
||||||
(name name*)
|
|
||||||
(version "0")
|
|
||||||
(source #f)
|
|
||||||
(build-system trivial-build-system)
|
|
||||||
(arguments
|
|
||||||
`(#:guile ,%bootstrap-guile
|
|
||||||
#:modules ((guix build utils))
|
|
||||||
#:builder
|
|
||||||
(let ((out (assoc-ref %outputs "out"))
|
|
||||||
(tar (assoc-ref %build-inputs "tar"))
|
|
||||||
(xz (assoc-ref %build-inputs "xz"))
|
|
||||||
(tarball (assoc-ref %build-inputs "tarball")))
|
|
||||||
(use-modules (guix build utils))
|
|
||||||
|
|
||||||
(mkdir out)
|
|
||||||
(copy-file tarball "binaries.tar.xz")
|
|
||||||
(system* xz "-d" "binaries.tar.xz")
|
|
||||||
(let ((builddir (getcwd)))
|
|
||||||
(with-directory-excursion out
|
|
||||||
(and (zero? (system* tar "xvf"
|
|
||||||
(string-append builddir "/binaries.tar")))
|
|
||||||
(zero? (system* (string-append "bin/" ,program-to-test)
|
|
||||||
"--version"))))))))
|
|
||||||
(inputs
|
|
||||||
`(("tar" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "tar" system)))
|
|
||||||
("xz" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "xz" system)))
|
|
||||||
("tarball" ,(lambda (system)
|
|
||||||
(bootstrap-origin (source* system))))))
|
|
||||||
(synopsis description*)
|
|
||||||
(description #f)
|
|
||||||
(home-page #f)))
|
|
||||||
|
|
||||||
(define %bootstrap-base-url
|
|
||||||
;; This is where the initial binaries come from.
|
|
||||||
"http://www.fdn.fr/~lcourtes/software/guix/packages")
|
|
||||||
|
|
||||||
(define %bootstrap-coreutils&co
|
|
||||||
(package-from-tarball "bootstrap-binaries"
|
|
||||||
(lambda (system)
|
|
||||||
(origin
|
|
||||||
(method http-fetch)
|
|
||||||
(uri (string-append
|
|
||||||
%bootstrap-base-url "/"
|
|
||||||
system "/static-binaries.tar.xz"))
|
|
||||||
(sha256
|
|
||||||
(match system
|
|
||||||
("x86_64-linux"
|
|
||||||
(base32
|
|
||||||
"0azisn8l2b3cvgni9k0ahzsxs5cxrj0hmf38zgpq3k6pggk3zbfm"))
|
|
||||||
("i686-linux"
|
|
||||||
(base32
|
|
||||||
"16v60frbh0naccanwxcxz0z3444dd8salbg8p7cp7vwz8245nhfk"))))))
|
|
||||||
"true" ; the program to test
|
|
||||||
"Bootstrap binaries of Coreutils, Awk, etc."))
|
|
||||||
|
|
||||||
(define %bootstrap-binutils
|
|
||||||
(package-from-tarball "binutils-bootstrap"
|
|
||||||
(lambda (system)
|
|
||||||
(origin
|
|
||||||
(method http-fetch)
|
|
||||||
(uri (string-append
|
|
||||||
%bootstrap-base-url "/"
|
|
||||||
system "/binutils-2.22.tar.xz"))
|
|
||||||
(sha256
|
|
||||||
(match system
|
|
||||||
("x86_64-linux"
|
|
||||||
(base32
|
|
||||||
"1cz1rwqhswgrr14kzbkaj3k32kzgv2b6mmzvc6ssbbz8k2m8jmqa"))
|
|
||||||
("i686-linux"
|
|
||||||
(base32
|
|
||||||
"1crg5xsf4cxk249sg90h6fjhfkwj1s5dxvhwbym79g79ygbww1br"))))))
|
|
||||||
"ld" ; the program to test
|
|
||||||
"Bootstrap binaries of the GNU Binutils"))
|
|
||||||
|
|
||||||
(define %bootstrap-glibc
|
|
||||||
;; The initial libc.
|
|
||||||
(package
|
|
||||||
(name "glibc-bootstrap")
|
|
||||||
(version "0")
|
|
||||||
(source #f)
|
|
||||||
(build-system trivial-build-system)
|
|
||||||
(arguments
|
|
||||||
`(#:guile ,%bootstrap-guile
|
|
||||||
#:modules ((guix build utils))
|
|
||||||
#:builder
|
|
||||||
(let ((out (assoc-ref %outputs "out"))
|
|
||||||
(tar (assoc-ref %build-inputs "tar"))
|
|
||||||
(xz (assoc-ref %build-inputs "xz"))
|
|
||||||
(tarball (assoc-ref %build-inputs "tarball")))
|
|
||||||
(use-modules (guix build utils))
|
|
||||||
|
|
||||||
(mkdir out)
|
|
||||||
(copy-file tarball "binaries.tar.xz")
|
|
||||||
(system* xz "-d" "binaries.tar.xz")
|
|
||||||
(let ((builddir (getcwd)))
|
|
||||||
(with-directory-excursion out
|
|
||||||
(system* tar "xvf"
|
|
||||||
(string-append builddir
|
|
||||||
"/binaries.tar"))
|
|
||||||
(chmod "lib" #o755)
|
|
||||||
|
|
||||||
;; Patch libc.so so it refers to the right path.
|
|
||||||
(substitute* "lib/libc.so"
|
|
||||||
(("/[^ ]+/lib/(libc|ld)" _ prefix)
|
|
||||||
(string-append out "/lib/" prefix))))))))
|
|
||||||
(inputs
|
|
||||||
`(("tar" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "tar" system)))
|
|
||||||
("xz" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "xz" system)))
|
|
||||||
("tarball" ,(lambda (system)
|
|
||||||
(bootstrap-origin
|
|
||||||
(origin
|
|
||||||
(method http-fetch)
|
|
||||||
(uri (string-append %bootstrap-base-url "/"
|
|
||||||
system "/glibc-2.16.0.tar.xz"))
|
|
||||||
(sha256
|
|
||||||
(match system
|
|
||||||
("x86_64-linux"
|
|
||||||
(base32
|
|
||||||
"1cz587p3scrrx0zgqnmp4nnfj0vvf01zdqdgkz445dnbfh64nl0v"))
|
|
||||||
("i686-linux"
|
|
||||||
(base32
|
|
||||||
"0vzybz1577vflm0p0zg1slqj32carj5102b45k7iskkj46viy14z"))))))))))
|
|
||||||
(synopsis "Bootstrap binaries and headers of the GNU C Library")
|
|
||||||
(description #f)
|
|
||||||
(home-page #f)))
|
|
||||||
|
|
||||||
(define %bootstrap-gcc
|
|
||||||
;; The initial GCC. Uses binaries from a tarball typically built by
|
|
||||||
;; %GCC-BOOTSTRAP-TARBALL.
|
|
||||||
(package
|
|
||||||
(name "gcc-bootstrap")
|
|
||||||
(version "0")
|
|
||||||
(source #f)
|
|
||||||
(build-system trivial-build-system)
|
|
||||||
(arguments
|
|
||||||
(lambda (system)
|
|
||||||
`(#:guile ,%bootstrap-guile
|
|
||||||
#:modules ((guix build utils))
|
|
||||||
#:builder
|
|
||||||
(let ((out (assoc-ref %outputs "out"))
|
|
||||||
(tar (assoc-ref %build-inputs "tar"))
|
|
||||||
(xz (assoc-ref %build-inputs "xz"))
|
|
||||||
(bash (assoc-ref %build-inputs "bash"))
|
|
||||||
(libc (assoc-ref %build-inputs "libc"))
|
|
||||||
(tarball (assoc-ref %build-inputs "tarball")))
|
|
||||||
(use-modules (guix build utils)
|
|
||||||
(ice-9 popen))
|
|
||||||
|
|
||||||
(mkdir out)
|
|
||||||
(copy-file tarball "binaries.tar.xz")
|
|
||||||
(system* xz "-d" "binaries.tar.xz")
|
|
||||||
(let ((builddir (getcwd))
|
|
||||||
(bindir (string-append out "/bin")))
|
|
||||||
(with-directory-excursion out
|
|
||||||
(system* tar "xvf"
|
|
||||||
(string-append builddir "/binaries.tar")))
|
|
||||||
|
|
||||||
(with-directory-excursion bindir
|
|
||||||
(chmod "." #o755)
|
|
||||||
(rename-file "gcc" ".gcc-wrapped")
|
|
||||||
(call-with-output-file "gcc"
|
|
||||||
(lambda (p)
|
|
||||||
(format p "#!~a
|
|
||||||
exec ~a/bin/.gcc-wrapped -B~a/lib \
|
|
||||||
-Wl,-rpath -Wl,~a/lib \
|
|
||||||
-Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
|
|
||||||
bash
|
|
||||||
out libc libc libc
|
|
||||||
,(glibc-dynamic-linker system))))
|
|
||||||
|
|
||||||
(chmod "gcc" #o555)))))))
|
|
||||||
(inputs
|
|
||||||
`(("tar" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "tar" system)))
|
|
||||||
("xz" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "xz" system)))
|
|
||||||
("bash" ,(lambda (system)
|
|
||||||
(search-bootstrap-binary "bash" system)))
|
|
||||||
("libc" ,%bootstrap-glibc)
|
|
||||||
("tarball" ,(lambda (system)
|
|
||||||
(bootstrap-origin
|
|
||||||
(origin
|
|
||||||
(method http-fetch)
|
|
||||||
(uri (string-append %bootstrap-base-url "/"
|
|
||||||
system "/gcc-4.7.2.tar.xz"))
|
|
||||||
(sha256
|
|
||||||
(match system
|
|
||||||
("x86_64-linux"
|
|
||||||
(base32
|
|
||||||
"07piqzcdaksjbcj037y5gdbh9dfqwzjivg6fkhgg8kif82ibwxxr"))
|
|
||||||
("i686-linux"
|
|
||||||
(base32
|
|
||||||
"0caiihphp23rrqn382cabykz9ps3ixd5p63dgdnkhz1f01jiarl2"))))))))))
|
|
||||||
(synopsis "Bootstrap binaries of the GNU Compiler Collection")
|
|
||||||
(description #f)
|
|
||||||
(home-page #f)))
|
|
||||||
|
|
||||||
(define %bootstrap-inputs
|
|
||||||
;; The initial, pre-built inputs. From now on, we can start building our
|
|
||||||
;; own packages.
|
|
||||||
`(("libc" ,%bootstrap-glibc)
|
|
||||||
("gcc" ,%bootstrap-gcc)
|
|
||||||
("binutils" ,%bootstrap-binutils)
|
|
||||||
("coreutils&co" ,%bootstrap-coreutils&co)))
|
|
||||||
|
|
||||||
(define package-with-bootstrap-guile
|
|
||||||
(memoize
|
|
||||||
(lambda (p)
|
|
||||||
"Return a variant of P such that all its origins are fetched with
|
|
||||||
%BOOTSTRAP-GUILE."
|
|
||||||
(define rewritten-input
|
|
||||||
(match-lambda
|
|
||||||
((name (? origin? o))
|
|
||||||
`(,name ,(bootstrap-origin o)))
|
|
||||||
((name (? package? p) sub-drvs ...)
|
|
||||||
`(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
|
|
||||||
(x x)))
|
|
||||||
|
|
||||||
(package (inherit p)
|
|
||||||
(source (match (package-source p)
|
|
||||||
((? origin? o) (bootstrap-origin o))
|
|
||||||
(s s)))
|
|
||||||
(inputs (map rewritten-input
|
|
||||||
(package-inputs p)))
|
|
||||||
(native-inputs (map rewritten-input
|
|
||||||
(package-native-inputs p)))
|
|
||||||
(propagated-inputs (map rewritten-input
|
|
||||||
(package-propagated-inputs p)))))))
|
|
||||||
|
|
||||||
(define (default-keyword-arguments args defaults)
|
(define (default-keyword-arguments args defaults)
|
||||||
"Return ARGS augmented with any keyword/value from DEFAULTS for
|
"Return ARGS augmented with any keyword/value from DEFAULTS for
|
||||||
keywords not already present in ARGS."
|
keywords not already present in ARGS."
|
||||||
|
|
|
@ -0,0 +1,374 @@
|
||||||
|
;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
|
||||||
|
;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
;;;
|
||||||
|
;;; This file is part of Guix.
|
||||||
|
;;;
|
||||||
|
;;; 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.
|
||||||
|
;;;
|
||||||
|
;;; 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 Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
(define-module (distro packages bootstrap)
|
||||||
|
#:use-module (distro)
|
||||||
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix ftp)
|
||||||
|
#:use-module (guix http)
|
||||||
|
#:use-module (guix build-system)
|
||||||
|
#:use-module (guix build-system gnu)
|
||||||
|
#:use-module (guix build-system trivial)
|
||||||
|
#:use-module ((guix store) #:select (add-to-store add-text-to-store))
|
||||||
|
#:use-module ((guix derivations) #:select (derivation))
|
||||||
|
#:use-module (guix utils)
|
||||||
|
#:use-module (srfi srfi-1)
|
||||||
|
#:use-module (srfi srfi-26)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
|
#:export (bootstrap-origin
|
||||||
|
package-with-bootstrap-guile
|
||||||
|
glibc-dynamic-linker
|
||||||
|
|
||||||
|
%bootstrap-guile
|
||||||
|
%bootstrap-coreutils&co
|
||||||
|
%bootstrap-binutils
|
||||||
|
%bootstrap-gcc
|
||||||
|
%bootstrap-glibc
|
||||||
|
%bootstrap-inputs))
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
;;;
|
||||||
|
;;; Pre-built packages that are used to bootstrap the
|
||||||
|
;;; distribution--i.e., to build all the core packages from scratch.
|
||||||
|
;;;
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;;
|
||||||
|
;;; Helper procedures.
|
||||||
|
;;;
|
||||||
|
|
||||||
|
(define (bootstrap-origin source)
|
||||||
|
"Return a variant of SOURCE, an <origin> instance, whose method uses
|
||||||
|
%BOOTSTRAP-GUILE to do its job."
|
||||||
|
(define (boot fetch)
|
||||||
|
(lambda* (store url hash-algo hash
|
||||||
|
#:optional name #:key system)
|
||||||
|
(fetch store url hash-algo hash
|
||||||
|
#:guile %bootstrap-guile
|
||||||
|
#:system system)))
|
||||||
|
|
||||||
|
(let ((orig-method (origin-method source)))
|
||||||
|
(origin (inherit source)
|
||||||
|
(method (cond ((eq? orig-method http-fetch)
|
||||||
|
(boot http-fetch))
|
||||||
|
((eq? orig-method ftp-fetch)
|
||||||
|
(boot ftp-fetch))
|
||||||
|
(else orig-method))))))
|
||||||
|
|
||||||
|
(define (package-from-tarball name* source* program-to-test description*)
|
||||||
|
"Return a package that correspond to the extraction of SOURCE*.
|
||||||
|
PROGRAM-TO-TEST is a program to run after extraction of SOURCE*, to
|
||||||
|
check whether everything is alright."
|
||||||
|
(package
|
||||||
|
(name name*)
|
||||||
|
(version "0")
|
||||||
|
(source #f)
|
||||||
|
(build-system trivial-build-system)
|
||||||
|
(arguments
|
||||||
|
`(#:guile ,%bootstrap-guile
|
||||||
|
#:modules ((guix build utils))
|
||||||
|
#:builder
|
||||||
|
(let ((out (assoc-ref %outputs "out"))
|
||||||
|
(tar (assoc-ref %build-inputs "tar"))
|
||||||
|
(xz (assoc-ref %build-inputs "xz"))
|
||||||
|
(tarball (assoc-ref %build-inputs "tarball")))
|
||||||
|
(use-modules (guix build utils))
|
||||||
|
|
||||||
|
(mkdir out)
|
||||||
|
(copy-file tarball "binaries.tar.xz")
|
||||||
|
(system* xz "-d" "binaries.tar.xz")
|
||||||
|
(let ((builddir (getcwd)))
|
||||||
|
(with-directory-excursion out
|
||||||
|
(and (zero? (system* tar "xvf"
|
||||||
|
(string-append builddir "/binaries.tar")))
|
||||||
|
(zero? (system* (string-append "bin/" ,program-to-test)
|
||||||
|
"--version"))))))))
|
||||||
|
(inputs
|
||||||
|
`(("tar" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "tar" system)))
|
||||||
|
("xz" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "xz" system)))
|
||||||
|
("tarball" ,(lambda (system)
|
||||||
|
(bootstrap-origin (source* system))))))
|
||||||
|
(synopsis description*)
|
||||||
|
(description #f)
|
||||||
|
(home-page #f)))
|
||||||
|
|
||||||
|
(define package-with-bootstrap-guile
|
||||||
|
(memoize
|
||||||
|
(lambda (p)
|
||||||
|
"Return a variant of P such that all its origins are fetched with
|
||||||
|
%BOOTSTRAP-GUILE."
|
||||||
|
(define rewritten-input
|
||||||
|
(match-lambda
|
||||||
|
((name (? origin? o))
|
||||||
|
`(,name ,(bootstrap-origin o)))
|
||||||
|
((name (? package? p) sub-drvs ...)
|
||||||
|
`(,name ,(package-with-bootstrap-guile p) ,@sub-drvs))
|
||||||
|
(x x)))
|
||||||
|
|
||||||
|
(package (inherit p)
|
||||||
|
(source (match (package-source p)
|
||||||
|
((? origin? o) (bootstrap-origin o))
|
||||||
|
(s s)))
|
||||||
|
(inputs (map rewritten-input
|
||||||
|
(package-inputs p)))
|
||||||
|
(native-inputs (map rewritten-input
|
||||||
|
(package-native-inputs p)))
|
||||||
|
(propagated-inputs (map rewritten-input
|
||||||
|
(package-propagated-inputs p)))))))
|
||||||
|
|
||||||
|
(define (glibc-dynamic-linker system)
|
||||||
|
"Return the name of Glibc's dynamic linker for SYSTEM."
|
||||||
|
(cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
|
||||||
|
((string=? system "i686-linux") "/lib/ld-linux.so.2")
|
||||||
|
(else (error "dynamic linker name not known for this system"
|
||||||
|
system))))
|
||||||
|
|
||||||
|
|
||||||
|
;;;
|
||||||
|
;;; Bootstrap packages.
|
||||||
|
;;;
|
||||||
|
|
||||||
|
(define %bootstrap-guile
|
||||||
|
;; The Guile used to run the build scripts of the initial derivations.
|
||||||
|
;; It is just unpacked from a tarball containing a pre-built binary.
|
||||||
|
;; This is typically built using %GUILE-BOOTSTRAP-TARBALL below.
|
||||||
|
;;
|
||||||
|
;; XXX: Would need libc's `libnss_files2.so' for proper `getaddrinfo'
|
||||||
|
;; support (for /etc/services).
|
||||||
|
(let ((raw (build-system
|
||||||
|
(name "raw")
|
||||||
|
(description "Raw build system with direct store access")
|
||||||
|
(build (lambda* (store name source inputs #:key outputs system)
|
||||||
|
(define (->store file)
|
||||||
|
(add-to-store store file #t #t "sha256"
|
||||||
|
(or (search-bootstrap-binary file
|
||||||
|
system)
|
||||||
|
(error "bootstrap binary not found"
|
||||||
|
file system))))
|
||||||
|
|
||||||
|
(let* ((tar (->store "tar"))
|
||||||
|
(xz (->store "xz"))
|
||||||
|
(mkdir (->store "mkdir"))
|
||||||
|
(bash (->store "bash"))
|
||||||
|
(guile (->store "guile-bootstrap-2.0.6.tar.xz"))
|
||||||
|
(builder
|
||||||
|
(add-text-to-store store
|
||||||
|
"build-bootstrap-guile.sh"
|
||||||
|
(format #f "
|
||||||
|
echo \"unpacking bootstrap Guile to '$out'...\"
|
||||||
|
~a $out
|
||||||
|
cd $out
|
||||||
|
~a -dc < ~a | ~a xv
|
||||||
|
|
||||||
|
# Sanity check.
|
||||||
|
$out/bin/guile --version~%"
|
||||||
|
mkdir xz guile tar)
|
||||||
|
(list mkdir xz guile tar))))
|
||||||
|
(derivation store name system
|
||||||
|
bash `(,builder) '()
|
||||||
|
`((,bash) (,builder)))))))))
|
||||||
|
(package
|
||||||
|
(name "guile-bootstrap")
|
||||||
|
(version "2.0")
|
||||||
|
(source #f)
|
||||||
|
(build-system raw)
|
||||||
|
(synopsis "Bootstrap Guile")
|
||||||
|
(description "Pre-built Guile for bootstrapping purposes.")
|
||||||
|
(home-page #f)
|
||||||
|
(license "LGPLv3+"))))
|
||||||
|
|
||||||
|
(define %bootstrap-base-url
|
||||||
|
;; This is where the initial binaries come from.
|
||||||
|
"http://www.fdn.fr/~lcourtes/software/guix/packages")
|
||||||
|
|
||||||
|
(define %bootstrap-coreutils&co
|
||||||
|
(package-from-tarball "bootstrap-binaries"
|
||||||
|
(lambda (system)
|
||||||
|
(origin
|
||||||
|
(method http-fetch)
|
||||||
|
(uri (string-append
|
||||||
|
%bootstrap-base-url "/"
|
||||||
|
system "/static-binaries.tar.xz"))
|
||||||
|
(sha256
|
||||||
|
(match system
|
||||||
|
("x86_64-linux"
|
||||||
|
(base32
|
||||||
|
"0azisn8l2b3cvgni9k0ahzsxs5cxrj0hmf38zgpq3k6pggk3zbfm"))
|
||||||
|
("i686-linux"
|
||||||
|
(base32
|
||||||
|
"16v60frbh0naccanwxcxz0z3444dd8salbg8p7cp7vwz8245nhfk"))))))
|
||||||
|
"true" ; the program to test
|
||||||
|
"Bootstrap binaries of Coreutils, Awk, etc."))
|
||||||
|
|
||||||
|
(define %bootstrap-binutils
|
||||||
|
(package-from-tarball "binutils-bootstrap"
|
||||||
|
(lambda (system)
|
||||||
|
(origin
|
||||||
|
(method http-fetch)
|
||||||
|
(uri (string-append
|
||||||
|
%bootstrap-base-url "/"
|
||||||
|
system "/binutils-2.22.tar.xz"))
|
||||||
|
(sha256
|
||||||
|
(match system
|
||||||
|
("x86_64-linux"
|
||||||
|
(base32
|
||||||
|
"1cz1rwqhswgrr14kzbkaj3k32kzgv2b6mmzvc6ssbbz8k2m8jmqa"))
|
||||||
|
("i686-linux"
|
||||||
|
(base32
|
||||||
|
"1crg5xsf4cxk249sg90h6fjhfkwj1s5dxvhwbym79g79ygbww1br"))))))
|
||||||
|
"ld" ; the program to test
|
||||||
|
"Bootstrap binaries of the GNU Binutils"))
|
||||||
|
|
||||||
|
(define %bootstrap-glibc
|
||||||
|
;; The initial libc.
|
||||||
|
(package
|
||||||
|
(name "glibc-bootstrap")
|
||||||
|
(version "0")
|
||||||
|
(source #f)
|
||||||
|
(build-system trivial-build-system)
|
||||||
|
(arguments
|
||||||
|
`(#:guile ,%bootstrap-guile
|
||||||
|
#:modules ((guix build utils))
|
||||||
|
#:builder
|
||||||
|
(let ((out (assoc-ref %outputs "out"))
|
||||||
|
(tar (assoc-ref %build-inputs "tar"))
|
||||||
|
(xz (assoc-ref %build-inputs "xz"))
|
||||||
|
(tarball (assoc-ref %build-inputs "tarball")))
|
||||||
|
(use-modules (guix build utils))
|
||||||
|
|
||||||
|
(mkdir out)
|
||||||
|
(copy-file tarball "binaries.tar.xz")
|
||||||
|
(system* xz "-d" "binaries.tar.xz")
|
||||||
|
(let ((builddir (getcwd)))
|
||||||
|
(with-directory-excursion out
|
||||||
|
(system* tar "xvf"
|
||||||
|
(string-append builddir
|
||||||
|
"/binaries.tar"))
|
||||||
|
(chmod "lib" #o755)
|
||||||
|
|
||||||
|
;; Patch libc.so so it refers to the right path.
|
||||||
|
(substitute* "lib/libc.so"
|
||||||
|
(("/[^ ]+/lib/(libc|ld)" _ prefix)
|
||||||
|
(string-append out "/lib/" prefix))))))))
|
||||||
|
(inputs
|
||||||
|
`(("tar" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "tar" system)))
|
||||||
|
("xz" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "xz" system)))
|
||||||
|
("tarball" ,(lambda (system)
|
||||||
|
(bootstrap-origin
|
||||||
|
(origin
|
||||||
|
(method http-fetch)
|
||||||
|
(uri (string-append %bootstrap-base-url "/"
|
||||||
|
system "/glibc-2.16.0.tar.xz"))
|
||||||
|
(sha256
|
||||||
|
(match system
|
||||||
|
("x86_64-linux"
|
||||||
|
(base32
|
||||||
|
"1cz587p3scrrx0zgqnmp4nnfj0vvf01zdqdgkz445dnbfh64nl0v"))
|
||||||
|
("i686-linux"
|
||||||
|
(base32
|
||||||
|
"0vzybz1577vflm0p0zg1slqj32carj5102b45k7iskkj46viy14z"))))))))))
|
||||||
|
(synopsis "Bootstrap binaries and headers of the GNU C Library")
|
||||||
|
(description #f)
|
||||||
|
(home-page #f)))
|
||||||
|
|
||||||
|
(define %bootstrap-gcc
|
||||||
|
;; The initial GCC. Uses binaries from a tarball typically built by
|
||||||
|
;; %GCC-BOOTSTRAP-TARBALL.
|
||||||
|
(package
|
||||||
|
(name "gcc-bootstrap")
|
||||||
|
(version "0")
|
||||||
|
(source #f)
|
||||||
|
(build-system trivial-build-system)
|
||||||
|
(arguments
|
||||||
|
(lambda (system)
|
||||||
|
`(#:guile ,%bootstrap-guile
|
||||||
|
#:modules ((guix build utils))
|
||||||
|
#:builder
|
||||||
|
(let ((out (assoc-ref %outputs "out"))
|
||||||
|
(tar (assoc-ref %build-inputs "tar"))
|
||||||
|
(xz (assoc-ref %build-inputs "xz"))
|
||||||
|
(bash (assoc-ref %build-inputs "bash"))
|
||||||
|
(libc (assoc-ref %build-inputs "libc"))
|
||||||
|
(tarball (assoc-ref %build-inputs "tarball")))
|
||||||
|
(use-modules (guix build utils)
|
||||||
|
(ice-9 popen))
|
||||||
|
|
||||||
|
(mkdir out)
|
||||||
|
(copy-file tarball "binaries.tar.xz")
|
||||||
|
(system* xz "-d" "binaries.tar.xz")
|
||||||
|
(let ((builddir (getcwd))
|
||||||
|
(bindir (string-append out "/bin")))
|
||||||
|
(with-directory-excursion out
|
||||||
|
(system* tar "xvf"
|
||||||
|
(string-append builddir "/binaries.tar")))
|
||||||
|
|
||||||
|
(with-directory-excursion bindir
|
||||||
|
(chmod "." #o755)
|
||||||
|
(rename-file "gcc" ".gcc-wrapped")
|
||||||
|
(call-with-output-file "gcc"
|
||||||
|
(lambda (p)
|
||||||
|
(format p "#!~a
|
||||||
|
exec ~a/bin/.gcc-wrapped -B~a/lib \
|
||||||
|
-Wl,-rpath -Wl,~a/lib \
|
||||||
|
-Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
|
||||||
|
bash
|
||||||
|
out libc libc libc
|
||||||
|
,(glibc-dynamic-linker system))))
|
||||||
|
|
||||||
|
(chmod "gcc" #o555)))))))
|
||||||
|
(inputs
|
||||||
|
`(("tar" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "tar" system)))
|
||||||
|
("xz" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "xz" system)))
|
||||||
|
("bash" ,(lambda (system)
|
||||||
|
(search-bootstrap-binary "bash" system)))
|
||||||
|
("libc" ,%bootstrap-glibc)
|
||||||
|
("tarball" ,(lambda (system)
|
||||||
|
(bootstrap-origin
|
||||||
|
(origin
|
||||||
|
(method http-fetch)
|
||||||
|
(uri (string-append %bootstrap-base-url "/"
|
||||||
|
system "/gcc-4.7.2.tar.xz"))
|
||||||
|
(sha256
|
||||||
|
(match system
|
||||||
|
("x86_64-linux"
|
||||||
|
(base32
|
||||||
|
"07piqzcdaksjbcj037y5gdbh9dfqwzjivg6fkhgg8kif82ibwxxr"))
|
||||||
|
("i686-linux"
|
||||||
|
(base32
|
||||||
|
"0caiihphp23rrqn382cabykz9ps3ixd5p63dgdnkhz1f01jiarl2"))))))))))
|
||||||
|
(synopsis "Bootstrap binaries of the GNU Compiler Collection")
|
||||||
|
(description #f)
|
||||||
|
(home-page #f)))
|
||||||
|
|
||||||
|
(define %bootstrap-inputs
|
||||||
|
;; The initial, pre-built inputs. From now on, we can start building our
|
||||||
|
;; own packages.
|
||||||
|
`(("libc" ,%bootstrap-glibc)
|
||||||
|
("gcc" ,%bootstrap-gcc)
|
||||||
|
("binutils" ,%bootstrap-binutils)
|
||||||
|
("coreutils&co" ,%bootstrap-coreutils&co)))
|
||||||
|
|
||||||
|
;;; bootstrap.scm ends here
|
|
@ -25,6 +25,7 @@
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
#:use-module ((guix packages) #:select (package-derivation))
|
#:use-module ((guix packages) #:select (package-derivation))
|
||||||
|
#:use-module (distro packages bootstrap)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-64))
|
#:use-module (srfi srfi-64))
|
||||||
|
@ -48,9 +49,6 @@
|
||||||
(list name (package-derivation %store package))))
|
(list name (package-derivation %store package))))
|
||||||
(@@ (distro packages base) %boot0-inputs))))
|
(@@ (distro packages base) %boot0-inputs))))
|
||||||
|
|
||||||
(define %bootstrap-guile
|
|
||||||
(@@ (distro packages base) %bootstrap-guile))
|
|
||||||
|
|
||||||
|
|
||||||
(test-begin "builders")
|
(test-begin "builders")
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module ((guix packages) #:select (package-derivation))
|
#:use-module ((guix packages) #:select (package-derivation))
|
||||||
#:use-module ((distro packages base) #:select (%bootstrap-guile))
|
#:use-module (distro packages bootstrap)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
|
@ -209,9 +209,7 @@
|
||||||
|
|
||||||
(define %coreutils
|
(define %coreutils
|
||||||
(false-if-exception
|
(false-if-exception
|
||||||
(or (package-derivation %store
|
(or (package-derivation %store %bootstrap-coreutils&co)
|
||||||
(@@ (distro packages base)
|
|
||||||
%bootstrap-coreutils&co))
|
|
||||||
(nixpkgs-derivation "coreutils"))))
|
(nixpkgs-derivation "coreutils"))))
|
||||||
|
|
||||||
(test-skip (if %coreutils 0 1))
|
(test-skip (if %coreutils 0 1))
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
#:use-module (distro)
|
#:use-module (distro)
|
||||||
#:use-module (distro packages base)
|
#:use-module (distro packages base)
|
||||||
|
#:use-module (distro packages bootstrap)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (srfi srfi-64)
|
#:use-module (srfi srfi-64)
|
||||||
#:use-module (ice-9 match))
|
#:use-module (ice-9 match))
|
||||||
|
@ -44,9 +45,6 @@
|
||||||
;; This still involves building GNU Make and GNU Diffutils.
|
;; This still involves building GNU Make and GNU Diffutils.
|
||||||
(@@ (distro packages base) %boot0-inputs))
|
(@@ (distro packages base) %boot0-inputs))
|
||||||
|
|
||||||
(define %bootstrap-guile
|
|
||||||
(@@ (distro packages base) %bootstrap-guile))
|
|
||||||
|
|
||||||
|
|
||||||
(test-begin "packages")
|
(test-begin "packages")
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#:use-module (guix build union)
|
#:use-module (guix build union)
|
||||||
#:use-module ((guix build utils)
|
#:use-module ((guix build utils)
|
||||||
#:select (with-directory-excursion directory-exists?))
|
#:select (with-directory-excursion directory-exists?))
|
||||||
|
#:use-module (distro packages bootstrap)
|
||||||
#:use-module (srfi srfi-64)
|
#:use-module (srfi srfi-64)
|
||||||
#:use-module (ice-9 match))
|
#:use-module (ice-9 match))
|
||||||
|
|
||||||
|
@ -33,9 +34,6 @@
|
||||||
(define %store
|
(define %store
|
||||||
(false-if-exception (open-connection)))
|
(false-if-exception (open-connection)))
|
||||||
|
|
||||||
(define %bootstrap-guile
|
|
||||||
(@@ (distro packages base) %bootstrap-guile))
|
|
||||||
|
|
||||||
(when %store
|
(when %store
|
||||||
;; By default, use %BOOTSTRAP-GUILE for the current system.
|
;; By default, use %BOOTSTRAP-GUILE for the current system.
|
||||||
(let ((drv (package-derivation %store %bootstrap-guile)))
|
(let ((drv (package-derivation %store %bootstrap-guile)))
|
||||||
|
@ -72,7 +70,7 @@
|
||||||
(let* ((inputs (map (match-lambda
|
(let* ((inputs (map (match-lambda
|
||||||
((name package)
|
((name package)
|
||||||
`(,name ,(package-derivation %store package))))
|
`(,name ,(package-derivation %store package))))
|
||||||
(@@ (distro packages base) %bootstrap-inputs)))
|
%bootstrap-inputs))
|
||||||
(builder `(begin
|
(builder `(begin
|
||||||
(use-modules (guix build union))
|
(use-modules (guix build union))
|
||||||
(union-build (assoc-ref %outputs "out")
|
(union-build (assoc-ref %outputs "out")
|
||||||
|
|
Reference in New Issue