Browse Source

Merge branch 'core-updates'

Conflicts:
	guix/build/union.scm
version-0.8.3
Ludovic Courtès 10 years ago
parent
commit
01e354eb83
  1. 29
      HACKING
  2. 15
      Makefile.am
  3. 4
      build-aux/download.scm
  4. 20
      distro/packages/acl.scm
  5. 40
      distro/packages/attr.scm
  6. 34
      distro/packages/autotools.scm
  7. 285
      distro/packages/base.scm
  8. 41
      distro/packages/bash.scm
  9. 4
      distro/packages/bdb.scm
  10. 33
      distro/packages/bootstrap.scm
  11. 1
      distro/packages/compression.scm
  12. 31
      distro/packages/gawk.scm
  13. 15
      distro/packages/gettext.scm
  14. 20
      distro/packages/guile.scm
  15. 18
      distro/packages/ld-wrapper.scm
  16. 3
      distro/packages/libsigsegv.scm
  17. 11
      distro/packages/linux.scm
  18. 5
      distro/packages/lsh.scm
  19. 14
      distro/packages/m4.scm
  20. 308
      distro/packages/make-bootstrap.scm
  21. 29
      distro/packages/multiprecision.scm
  22. 39
      distro/packages/ncurses.scm
  23. 68
      distro/packages/openssl.scm
  24. 34
      distro/packages/patches/gawk-shell.patch
  25. 28
      distro/packages/patches/glibc-bootstrap-system.patch
  26. 12
      distro/packages/perl.scm
  27. 80
      distro/packages/readline.scm
  28. 18
      distro/packages/time.scm
  29. 2
      doc/guix.texi
  30. 28
      guix/build-system/gnu.scm
  31. 84
      guix/build/download.scm
  32. 90
      guix/build/gnu-build-system.scm
  33. 12
      guix/build/union.scm
  34. 182
      guix/build/utils.scm
  35. 9
      guix/ftp-client.scm
  36. 16
      m4/guix.m4
  37. 12
      nix/sync-with-upstream
  38. 12
      release.nix
  39. 41
      tests/derivations.scm
  40. 5
      tests/union.scm

29
HACKING

@ -2,7 +2,7 @@
#+TITLE: Hacking GNU Guix and its incredible distro
Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -106,26 +106,10 @@ GCC, libc, etc. need to be built. To that end, run the following
commands:
#+BEGIN_SRC sh
./pre-inst-env guix-build \
-e '(@@ (distro packages base) %guile-bootstrap-tarball)' \
./pre-inst-env guix-build \
-e '(@ (distro packages make-bootstrap) bootstrap-tarballs)' \
--system=i686-linux
./pre-inst-env guix-build \
-e '(@@ (distro packages base) %bootstrap-binaries-tarball)' \
--system=i686-linux
./pre-inst-env guix-build \
-e '(@@ (distro packages base) %binutils-bootstrap-tarball)' \
--system=i686-linux
./pre-inst-env guix-build \
-e '(@@ (distro packages base) %glibc-bootstrap-tarball)' \
--system=i686-linux
./pre-inst-env guix-build \
-e '(@@ (distro packages base) %gcc-bootstrap-tarball)' \
--system=i686-linux
#+END_SRC
These should build tarballs containing statically-linked tools usable on
@ -135,12 +119,11 @@ In the source tree, you need to install binaries for ‘mkdir’, ‘bash’,
‘tar’, and ‘xz’ under ‘distro/packages/bootstrap/i686-linux’. These
binaries can be extracted from the static-binaries tarball built above.
A rule for
‘distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz’
A rule for ‘distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz’
needs to be added in ‘Makefile.am’, with the appropriate hexadecimal
vrepresentation of its SHA256 hash.
You may then revert your changes to ‘base.scm’. For the variables
You may then revert your changes to ‘bootstrap.scm’. For the variables
‘%bootstrap-coreutils&co’, ‘%bootstrap-binutils’, ‘%bootstrap-glibc’,
and ‘%bootstrap-gcc’, the expected SHA256 of the corresponding tarballs
for ‘i686-linux’ (built above) must be added.

15
Makefile.am

@ -90,6 +90,7 @@ MODULES = \
distro/packages/nano.scm \
distro/packages/ncurses.scm \
distro/packages/nettle.scm \
distro/packages/openssl.scm \
distro/packages/perl.scm \
distro/packages/pkg-config.scm \
distro/packages/pth.scm \
@ -116,7 +117,9 @@ dist_patch_DATA = \
distro/packages/patches/cpio-gets-undeclared.patch \
distro/packages/patches/diffutils-gets-undeclared.patch \
distro/packages/patches/flex-bison-tests.patch \
distro/packages/patches/gawk-shell.patch \
distro/packages/patches/gettext-gets-undeclared.patch \
distro/packages/patches/glibc-bootstrap-system.patch \
distro/packages/patches/glibc-no-ld-so-cache.patch \
distro/packages/patches/guile-1.8-cpp-4.5.patch \
distro/packages/patches/guile-default-utf8.patch \
@ -154,9 +157,9 @@ dist_bootstrap_i686_linux_DATA = \
# Big bootstrap binaries are not included in the tarball. Instead, they
# are downloaded.
nodist_bootstrap_x86_64_linux_DATA = \
distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz
distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz
nodist_bootstrap_i686_linux_DATA = \
distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz
distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz
# Those files must remain executable, so they remain executable once
# imported into the store.
@ -173,12 +176,12 @@ DOWNLOAD_FILE = \
$(GUILE) --no-auto-compile -L "$(top_builddir)" -L "$(top_srcdir)" \
"$(top_srcdir)/build-aux/download.scm"
distro/packages/bootstrap/x86_64-linux/guile-bootstrap-2.0.6.tar.xz:
distro/packages/bootstrap/x86_64-linux/guile-2.0.7.tar.xz:
$(MKDIR_P) `dirname "$@"`
$(DOWNLOAD_FILE) "$@" "0467a82cbe4136f60a79eb4176011bf88cf28ea19c9ad9defa365811ff8e11cf"
distro/packages/bootstrap/i686-linux/guile-bootstrap-2.0.6.tar.xz:
$(DOWNLOAD_FILE) "$@" "bc43210dcd146d242bef4d354b0aeac12c4ef3118c07502d17ffa8d49e15aa2c"
distro/packages/bootstrap/i686-linux/guile-2.0.7.tar.xz:
$(MKDIR_P) `dirname "$@"`
$(DOWNLOAD_FILE) "$@" "93b537766dfab3ad287143523751e3ec02dd32d3ccaf88ad2d31c63158f342ee"
$(DOWNLOAD_FILE) "$@" "f9a7c6f4c556eaafa2a69bcf07d4ffbb6682ea831d4c9da9ba095aca3ccd217c"
nobase_nodist_guilemodule_DATA = $(GOBJECTS) guix/config.scm

4
build-aux/download.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -35,7 +35,7 @@
(match (string-tokenize file (char-set-complement (char-set #\/)))
((_ ... system basename)
(string->uri (string-append %url-base "/" system
"/20121115/" basename)))))
"/20130105/" basename)))))
(match (command-line)
((_ file expected-hash)

20
distro/packages/acl.scm

@ -41,15 +41,19 @@
(build-system gnu-build-system)
(arguments
`(#:phases
(alist-replace 'check
(lambda _
(patch-shebang "test/run")
(system* "make" "tests" "-C" "test")
(alist-cons-after
'configure 'patch-makefile-SHELL
(lambda _
(patch-makefile-SHELL "include/buildmacros"))
(alist-replace
'check
(lambda _
(system* "make" "tests" "-C" "test")
;; XXX: Ignore the test result since this is
;; dependent on the underlying file system.
#t)
%standard-phases)))
;; XXX: Ignore the test result since this is
;; dependent on the underlying file system.
#t)
%standard-phases))))
(inputs `(("attr" ,attr)
("gettext" ,guix:gettext)
("perl" ,perl)))

40
distro/packages/attr.scm

@ -41,23 +41,31 @@
(build-system gnu-build-system)
(arguments
`(#:phases
(alist-replace 'install
(lambda _
(zero? (system* "make"
"install"
"install-lib"
"install-dev")))
(alist-replace 'check
(lambda _
(for-each patch-shebang
(find-files "test" ".*"))
(system* "make" "tests" "-C" "test")
(alist-cons-after
'configure 'patch-makefile-SHELL
(lambda _
(patch-makefile-SHELL "include/buildmacros"))
(alist-replace
'install
(lambda _
(zero? (system* "make"
"install"
"install-lib"
"install-dev")))
(alist-replace
'check
(lambda _
;; Use the right shell.
(substitute* "test/run"
(("/bin/sh")
(which "bash")))
;; XXX: Ignore the test result since
;; this is dependent on the underlying
;; file system.
#t)
%standard-phases))))
(system* "make" "tests" "-C" "test")
;; XXX: Ignore the test result since this is dependent on the
;; underlying file system.
#t)
%standard-phases)))))
(inputs `(("perl" ,perl)
("gettext" ,guix:gettext)))
(home-page

34
distro/packages/autotools.scm

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -99,9 +99,37 @@ Standards. Automake requires the use of Autoconf.")
(build-system gnu-build-system)
(native-inputs `(("m4" ,m4)
("perl" ,perl)))
;; Separate binaries from the rest. During bootstrap, only ltdl is
;; used; not depending on the binaries allows us to avoid retaining
;; a reference to the bootstrap bash.
(outputs '("bin" ; libtoolize, libtool, etc.
"out")) ; libltdl.so, ltdl.h, etc.
(arguments
;; TODO: Use `TESTSUITEFLAGS=-jN' for tests.
`(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))))
`(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
#:phases (alist-cons-before
'check 'pre-check
(lambda* (#:key inputs #:allow-other-keys)
;; Run the test suite in parallel, if possible.
(let ((ncores
(cond
((getenv "NIX_BUILD_CORES")
=>
(lambda (n)
(if (zero? (string->number n))
(number->string (current-processor-count))
n)))
(else "1"))))
(setenv "TESTSUITEFLAGS"
(string-append "-j" ncores)))
;; Path references to /bin/sh.
(let ((bash (assoc-ref inputs "bash")))
(substitute* "tests/testsuite"
(("/bin/sh")
(string-append bash "/bin/bash")))))
%standard-phases)))
(inputs `(("patch/skip-tests"
,(search-patch "libtool-skip-tests.patch"))))
(synopsis "GNU Libtool, a generic library support script")

285
distro/packages/base.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;;
;;; This file is part of GNU Guix.
@ -20,6 +20,7 @@
(define-module (distro packages base)
#:use-module (guix licenses)
#:use-module (distro)
#:use-module (distro packages acl)
#:use-module (distro packages bash)
#:use-module (distro packages bootstrap)
#:use-module (distro packages compression)
@ -97,6 +98,17 @@ lines.")
"13wlsb4sf5d5a82xjhxqmdvrrn36rmw5f0pl9qyb9zkvldnb7hra"))))
(build-system gnu-build-system)
(synopsis "GNU sed, a batch stream editor")
(arguments
`(#:phases (alist-cons-before
'patch-source-shebangs 'patch-test-suite
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(patch-makefile-SHELL "testsuite/Makefile.tests")
(substitute* '("testsuite/bsd.sh"
"testsuite/bug-regex9.c")
(("/bin/sh")
(string-append bash "/bin/bash")))))
%standard-phases)))
(description
"Sed (stream editor) isn't really a true text editor or text processor.
Instead, it is used to filter text, i.e., it takes text input and performs
@ -252,19 +264,33 @@ The tools supplied with this package are:
(define-public coreutils
(package
(name "coreutils")
(version "8.19")
(version "8.20")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/coreutils/coreutils-"
version ".tar.xz"))
(sha256
(base32
"1rx9x3fp848w4nny7irdkcpkan9fcx24d99v5dkwgkyq7wc76f5d"))))
"1cly97xdy3v4nbbx631k43smqw0nnpn651kkprs0yyl2cj3pkjyv"))))
(build-system gnu-build-system)
(inputs `()) ; TODO: optional deps: SELinux, ACL, GMP
(inputs `(("acl" ,acl)
("gmp" ,gmp)
("perl" ,perl))) ; TODO: add SELinux
(arguments
'(;; Perl is missing, and some tests are failing.
#:tests? #f))
`(#:parallel-build? #f ; help2man may be called too early
#:phases (alist-cons-before
'build 'patch-shell-references
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(substitute* (cons "src/split.c"
(find-files "gnulib-tests"
"\\.c$"))
(("/bin/sh")
(format #f "~a/bin/sh" bash)))
(substitute* (find-files "tests" "\\.sh$")
(("#!/bin/sh")
(format #f "#!~a/bin/bash" bash)))))
%standard-phases)))
(synopsis
"The basic file, shell and text manipulation utilities of the GNU
operating system")
@ -289,8 +315,18 @@ are expected to exist on every operating system.")
(build-system gnu-build-system)
(native-inputs
`(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch"))))
(arguments `(#:patches (list (assoc-ref %build-inputs
"patch/impure-dirs"))))
(arguments
'(#:patches (list (assoc-ref %build-inputs "patch/impure-dirs"))
#:phases (alist-cons-before
'build 'set-default-shell
(lambda* (#:key inputs #:allow-other-keys)
;; Change the default shell from /bin/sh.
(let ((bash (assoc-ref inputs "bash")))
(substitute* "job.c"
(("default_shell\\[\\] =.*$")
(format #f "default_shell[] = \"~a/bin/bash\";\n"
bash)))))
%standard-phases)))
(synopsis "GNU Make, a program controlling the generation of non-source
files from sources")
(description
@ -317,6 +353,11 @@ that it is possible to use Make to build and install the program.")
"1a9w66v5dwvbnawshjwqcgz7km6kw6ihkzp6sswv9ycc3knzhykc"))))
(build-system gnu-build-system)
;; Split Binutils in several outputs, mostly to avoid collisions in
;; user profiles with GCC---e.g., libiberty.a.
(outputs '("out" ; ar, ld, binutils.info, etc.
"lib")) ; libbfd.a, bfd.h, etc.
;; TODO: Add dependency on zlib + those for Gold.
(native-inputs
`(("patch/new-dtags" ,(search-patch "binutils-ld-new-dtags.patch"))))
@ -455,14 +496,14 @@ used in the GNU system including the GNU/Linux variant.")
(define-public glibc
(package
(name "glibc")
(version "2.16.0")
(version "2.17")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/glibc/glibc-"
version ".tar.xz"))
(sha256
(base32
"092rdm49zh6l1pqkxbcpcaawgsgzxhpf1s7wf5wi5dvc5am3dp0y"))))
"0gmjnn4kma9vgizccw1jv979xw55a8n1nkk94gg0l3hy80vy6539"))))
(build-system gnu-build-system)
;; Glibc's <limits.h> refers to <linux/limit.h>, for instance, so glibc
@ -485,13 +526,20 @@ used in the GNU system including the GNU/Linux variant.")
;; GNU libc for details.
"--enable-kernel=2.6.30"
;; Use our Bash instead of /bin/sh.
(string-append "BASH_SHELL="
(assoc-ref %build-inputs "bash")
"/bin/bash")
;; XXX: Work around "undefined reference to `__stack_chk_guard'".
"libc_cv_ssp=no")
#:tests? #f ; XXX
#:phases (alist-cons-before
'configure 'pre-configure
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin")))
;; Use `pwd', not `/bin/pwd'.
(substitute* "configure"
(("/bin/pwd") "pwd"))
@ -509,10 +557,35 @@ used in the GNU system including the GNU/Linux variant.")
;; <http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html>,
;; linking against libgcc_s is not needed with GCC
;; 4.7.1.
((" -lgcc_s") ""))))
((" -lgcc_s") ""))
;; Copy a statically-linked Bash in the output, with
;; no references to other store paths.
(mkdir-p bin)
(copy-file (string-append (assoc-ref inputs "static-bash")
"/bin/bash")
(string-append bin "/bash"))
(remove-store-references (string-append bin "/bash"))
(chmod (string-append bin "/bash") #o555)
;; Keep a symlink, for `patch-shebang' resolution.
(with-directory-excursion bin
(symlink "bash" "sh"))
;; Have `system' use that Bash.
(substitute* "sysdeps/posix/system.c"
(("#define[[:blank:]]+SHELL_PATH.*$")
(format #f "#define SHELL_PATH \"~a/bin/bash\"\n"
out)))
;; Same for `popen'.
(substitute* "libio/iopopen.c"
(("/bin/sh")
(string-append out "/bin/bash")))))
%standard-phases)))
(inputs `(("patch/ld.so.cache"
,(search-patch "glibc-no-ld-so-cache.patch"))))
,(search-patch "glibc-no-ld-so-cache.patch"))
("static-bash" ,(static-package bash-light))))
(synopsis "The GNU C Library")
(description
"Any Unix-like operating system needs a C library: the library which
@ -534,21 +607,23 @@ with the Linux kernel.")
(package (inherit gnu-make)
(name "make-boot0")
(location (source-properties->location (current-source-location)))
(arguments `(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
#:tests? #f ; cannot run "make check"
#:phases
(alist-replace
'build (lambda _
(zero? (system* "./build.sh")))
(alist-replace
'install (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin")))
(mkdir-p bin)
(copy-file "make"
(string-append bin "/make"))))
%standard-phases))))
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
#:tests? #f ; cannot run "make check"
,@(substitute-keyword-arguments (package-arguments gnu-make)
((#:phases phases)
`(alist-replace
'build (lambda _
(zero? (system* "./build.sh")))
(alist-replace
'install (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin")))
(mkdir-p bin)
(copy-file "make"
(string-append bin "/make"))))
,phases))))))
(inputs %bootstrap-inputs))))
(define diffutils-boot0
@ -728,82 +803,125 @@ identifier SYSTEM."
;; cross-`as'.
,@%boot0-inputs))
(define-public glibc-final
(define glibc-final-with-bootstrap-bash
;; The final libc, "cross-built". If everything went well, the resulting
;; store path has no dependencies.
;; store path has no dependencies. Actually, the really-final libc is
;; built just below; the only difference is that this one uses the
;; bootstrap Bash.
(package-with-bootstrap-guile
(package (inherit glibc)
(name "glibc-intermediate")
(arguments
(lambda (system)
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
;; Leave /bin/sh as the interpreter for `ldd', `sotruss', etc. to
;; avoid keeping a reference to the bootstrap Bash.
#:patch-shebangs? #f
,@(substitute-keyword-arguments (package-arguments glibc)
((#:configure-flags flags)
`(append (list ,(string-append "--host=" (boot-triplet system))
,(string-append "--build="
(nix-system->gnu-triplet system))
"BASH_SHELL=/bin/sh"
;; Build Sun/ONC RPC support. In particular,
;; install rpc/*.h.
"--enable-obsolete-rpc")
,flags))))))
(propagated-inputs `(("linux-headers" ,linux-libre-headers-boot0)))
(inputs `( ;; A native GCC is needed to build `cross-rpcgen'.
("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
,@%boot1-inputs
,@(package-inputs glibc)))))) ; patches
(inputs
`( ;; A native GCC is needed to build `cross-rpcgen'.
("native-gcc" ,@(assoc-ref %boot0-inputs "gcc"))
(define gcc-boot0-wrapped
;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
;; non-cross names.
;; Here, we use the bootstrap Bash, which is not satisfactory
;; because we don't want to depend on bootstrap tools.
("static-bash" ,@(assoc-ref %boot0-inputs "bash"))
,@%boot1-inputs
,@(alist-delete "static-bash"
(package-inputs glibc))))))) ; patches
(define (cross-gcc-wrapper gcc binutils glibc bash)
"Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
that makes it available under the native tool names."
(package (inherit gcc-4.7)
(name (string-append (package-name gcc-boot0) "-wrapped"))
(name (string-append (package-name gcc) "-wrapped"))
(source #f)
(build-system trivial-build-system)
(arguments
(lambda (system)
`(#:guile ,%bootstrap-guile
#:modules ((guix build utils))
#:builder (begin
(use-modules (guix build utils))
(let* ((binutils (assoc-ref %build-inputs "binutils"))
(gcc (assoc-ref %build-inputs "gcc"))
(libc (assoc-ref %build-inputs "libc"))
(out (assoc-ref %outputs "out"))
(bindir (string-append out "/bin"))
(triplet ,(boot-triplet system)))
(mkdir-p bindir)
(with-directory-excursion bindir
(for-each (lambda (tool)
(symlink (string-append binutils "/bin/"
triplet "-" tool)
tool))
'("ar" "ranlib"))
;; GCC-BOOT0 is a libc-less cross-compiler, so it
;; needs to be told where to find the crt files and
;; the dynamic linker.
(call-with-output-file "gcc"
(lambda (p)
(format p "#!/bin/sh
`(#:guile ,%bootstrap-guile
#:modules ((guix build utils))
#:builder (begin
(use-modules (guix build utils))
(let* ((binutils (assoc-ref %build-inputs "binutils"))
(gcc (assoc-ref %build-inputs "gcc"))
(libc (assoc-ref %build-inputs "libc"))
(bash (assoc-ref %build-inputs "bash"))
(out (assoc-ref %outputs "out"))
(bindir (string-append out "/bin"))
(triplet ,(boot-triplet system)))
(mkdir-p bindir)
(with-directory-excursion bindir
(for-each (lambda (tool)
(symlink (string-append binutils "/bin/"
triplet "-" tool)
tool))
'("ar" "ranlib"))
;; GCC-BOOT0 is a libc-less cross-compiler, so it
;; needs to be told where to find the crt files and
;; the dynamic linker.
(call-with-output-file "gcc"
(lambda (p)
(format p "#!~a/bin/bash
exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
gcc triplet
libc libc
,(glibc-dynamic-linker system))))
bash
gcc triplet
libc libc
,(glibc-dynamic-linker system))))
(chmod "gcc" #o555)))))))
(chmod "gcc" #o555)))))))
(native-inputs
`(("binutils" ,binutils-boot0)
("gcc" ,gcc-boot0)
("libc" ,glibc-final)))
`(("binutils" ,binutils)
("gcc" ,gcc)
("libc" ,glibc)
("bash" ,bash)))
(inputs '())))
(define static-bash-for-glibc
;; A statically-linked Bash to be embedded in GLIBC-FINAL, for use by
;; system(3) & co.
(let* ((gcc (cross-gcc-wrapper gcc-boot0 binutils-boot0
glibc-final-with-bootstrap-bash
(car (assoc-ref %boot1-inputs "bash"))))
(bash (package (inherit bash-light)
(arguments
(lambda (system)
`(#:guile ,%bootstrap-guile
,@(package-arguments bash-light)))))))
(package-with-bootstrap-guile
(package-with-explicit-inputs (static-package bash)
`(("gcc" ,gcc)
("libc" ,glibc-final-with-bootstrap-bash)
,@(fold alist-delete %boot1-inputs
'("gcc" "libc")))
(current-source-location)))))
(define-public glibc-final
;; The final glibc, which embeds the statically-linked Bash built above.
(package (inherit glibc-final-with-bootstrap-bash)
(name "glibc")
(inputs `(("static-bash" ,static-bash-for-glibc)
,@(alist-delete
"static-bash"
(package-inputs glibc-final-with-bootstrap-bash))))))
(define 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)
@ -857,9 +975,10 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(source #f)
(build-system trivial-build-system)
(inputs `(("binutils" ,binutils-final)
("guile" ,%bootstrap-guile)
("wrapper" ,(search-path %load-path
"distro/packages/ld-wrapper.scm"))))
("guile" ,%bootstrap-guile)
("bash" ,@(assoc-ref %boot2-inputs "bash"))
("wrapper" ,(search-path %load-path
"distro/packages/ld-wrapper.scm"))))
(arguments
`(#:guile ,%bootstrap-guile
#:modules ((guix build utils))
@ -883,6 +1002,9 @@ exec ~a/bin/~a-gcc -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
(("@GUILE@")
(string-append (assoc-ref %build-inputs "guile")
"/bin/guile"))
(("@BASH@")
(string-append (assoc-ref %build-inputs "bash")
"/bin/bash"))
(("@LD@")
(string-append (assoc-ref %build-inputs "binutils")
"/bin/ld")))
@ -917,9 +1039,6 @@ store.")
,@(alist-delete "bash" %boot3-inputs)))
(define-public guile-final
;; FIXME: The Libtool used here, specifically its `bin/libtool' script,
;; holds a dependency on the bootstrap Binutils. Use multiple outputs for
;; Libtool, so that that dependency is isolated in the "bin" output.
(package-with-bootstrap-guile
(package-with-explicit-inputs guile-2.0/fixed
%boot4-inputs
@ -931,7 +1050,9 @@ store.")
(package (inherit ld-wrapper-boot3)
(name "ld-wrapper")
(inputs `(("guile" ,guile-final)
,@(alist-delete "guile" (package-inputs ld-wrapper-boot3))))))
("bash" ,bash-final)
,@(fold alist-delete (package-inputs ld-wrapper-boot3)
'("guile" "bash"))))))
(define-public %final-inputs
;; Final derivations used as implicit inputs by `gnu-build-system'.

41
distro/packages/bash.scm

@ -32,7 +32,13 @@
"-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
"-DNON_INTERACTIVE_LOGIN_SHELLS"
"-DSSH_SOURCE_BASHRC")
" ")))
" "))
(post-install-phase
'(lambda* (#:key outputs #:allow-other-keys)
;; Add a `bash' -> `sh' link.
(let ((out (assoc-ref outputs "out")))
(with-directory-excursion (string-append out "/bin")
(symlink "bash" "sh"))))))
(package
(name "bash")
(version "4.2")
@ -67,15 +73,9 @@
;; for now.
#:tests? #f
#:phases
(alist-cons-after 'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
;; Add a `bash' -> `sh' link.
(let ((out (assoc-ref outputs "out")))
(with-directory-excursion
(string-append out "/bin")
(symlink "bash" "sh"))))
%standard-phases)))
#:phases (alist-cons-after 'install 'post-install
,post-install-phase
%standard-phases)))
(synopsis "GNU Bourne-Again Shell")
(description
"Bash is the shell, or command language interpreter, that will appear in
@ -87,3 +87,24 @@ use. In addition, most sh scripts can be run by Bash without
modification.")
(license gpl3+)
(home-page "http://www.gnu.org/software/bash/"))))
(define-public bash-light
;; A stripped-down Bash for non-interactive use.
(package (inherit bash)
(name "bash-light")
(inputs '()) ; no readline, no curses
(arguments
(let ((args `(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1)
(srfi srfi-26))
,@(package-arguments bash))))
(substitute-keyword-arguments args
((#:configure-flags flags)
`(list "--without-bash-malloc"
"--disable-readline"
"--disable-history"
"--disable-help-builtin"
"--disable-progcomp"
"--disable-net-redirections"
"--disable-nls")))))))

4
distro/packages/bdb.scm

@ -44,7 +44,9 @@
(let ((out (assoc-ref outputs "out")))
(zero?
(system* "./dist/configure"
(string-append "--prefix=" out)))))
(string-append "--prefix=" out)
(string-append "CONFIG_SHELL=" (which "bash"))
(string-append "SHELL=" (which "bash"))))))
%standard-phases))))
(synopsis "db, the Berkeley database")
(description

33
distro/packages/bootstrap.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -167,7 +167,7 @@ check whether everything is alright."
(xz (->store "xz"))
(mkdir (->store "mkdir"))
(bash (->store "bash"))
(guile (->store "guile-bootstrap-2.0.6.tar.xz"))
(guile (->store "guile-2.0.7.tar.xz"))
(builder
(add-text-to-store store
"build-bootstrap-guile.sh"
@ -205,15 +205,15 @@ $out/bin/guile --version~%"
(method url-fetch)
(uri (string-append
%bootstrap-base-url "/"
system "/20121115/static-binaries.tar.xz"))
system "/20130105/static-binaries.tar.xz"))
(sha256
(match system
("x86_64-linux"
(base32
"0azisn8l2b3cvgni9k0ahzsxs5cxrj0hmf38zgpq3k6pggk3zbfm"))
"0md23alzy6nc5f16pric7mkagczdzr8xbh074sb3rjzrls06j1ls"))
("i686-linux"
(base32
"16v60frbh0naccanwxcxz0z3444dd8salbg8p7cp7vwz8245nhfk"))))))
"0nzj1lmm9b94g7k737cr4w1dv282w5nmhb53238ikax9r6pkc0yb"))))))
"true" ; the program to test
"Bootstrap binaries of Coreutils, Awk, etc."))
@ -224,15 +224,15 @@ $out/bin/guile --version~%"
(method url-fetch)
(uri (string-append
%bootstrap-base-url "/"
system "/20121115/binutils-2.22.tar.xz"))
system "/20130105/binutils-2.22.tar.xz"))
(sha256
(match system
("x86_64-linux"
(base32
"0ms6i035v40n7mhi91n4b8ivwv2qni3mcd5dj9sj9qmvgqb50r84"))
"1ffmk2yy2pxvkqgzrkzp3s4jpn4qaaksyk3b5nsc5cjwfm7qkgzh"))
("i686-linux"
(base32
"193x62ach4l4x16rbzglrqa1d0a825z2as6czdiv9xjiizmcr0ad"))))))
"1rafk6aq4sayvv3r3d2khn93nkyzf002xzh0xadlyci4mznr6b0a"))))))
"ld" ; the program to test
"Bootstrap binaries of the GNU Binutils"))
@ -277,15 +277,15 @@ $out/bin/guile --version~%"
(origin
(method url-fetch)
(uri (string-append %bootstrap-base-url "/" system
"/20121115/glibc-2.16.0.tar.xz"))
"/20130105/glibc-2.17.tar.xz"))
(sha256
(match system
("x86_64-linux"
(base32
"1cz587p3scrrx0zgqnmp4nnfj0vvf01zdqdgkz445dnbfh64nl0v"))
"18kv1z9d8dr1j3hm9w7663kchqw9p6rsx11n1m143jgba2jz6jy3"))
("i686-linux"
(base32
"0vzybz1577vflm0p0zg1slqj32carj5102b45k7iskkj46viy14z"))))))))))
"08hv8i0axwnihrcgbz19x0a7s6zyv3yx38x8r29liwl8h82x9g88"))))))))))
(synopsis "Bootstrap binaries and headers of the GNU C Library")
(description #f)
(home-page #f)))
@ -348,15 +348,15 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
(origin
(method url-fetch)
(uri (string-append %bootstrap-base-url "/" system
"/20121115/gcc-4.7.2.tar.xz"))
"/20130105/gcc-4.7.2.tar.xz"))
(sha256
(match system
("x86_64-linux"
(base32
"0fg65i2qcym8ls5ig3g1cc9ida5cxwwsd6zi95xi1d8dnfrja4zz"))
"1x1p7han5crnbw906iwdifykr6grzm0w27dy9gz75j0q1b32i4px"))
("i686-linux"
(base32
"01hlz98qmc8yhqrxqajpg5kbkhpvqq6wjnbfvplys32n895avzxg"))))))))))
"06wqs0xxnpw3hn0xjb4c9cs0899p1xwkcysa2rvzhvpra0c5vsg2"))))))))))
(synopsis "Bootstrap binaries of the GNU Compiler Collection")
(description #f)
(home-page #f)))
@ -367,6 +367,9 @@ exec ~a/bin/.gcc-wrapped -B~a/lib \
`(("libc" ,%bootstrap-glibc)
("gcc" ,%bootstrap-gcc)
("binutils" ,%bootstrap-binutils)
("coreutils&co" ,%bootstrap-coreutils&co)))
("coreutils&co" ,%bootstrap-coreutils&co)
;; In gnu-build-system.scm, we rely on the availability of Bash.
("bash" ,%bootstrap-coreutils&co)))
;;; bootstrap.scm ends here

1
distro/packages/compression.scm

@ -98,6 +98,7 @@ superior compression ratio of gzip is just a bonus.")
(build-shared-lib
;; Build a shared library.
'(lambda* (#:key inputs #:allow-other-keys)
(patch-makefile-SHELL "Makefile-libbz2_so")
(zero? (system* "make" "-f" "Makefile-libbz2_so"))))
(install-shared-lib
'(lambda* (#:key outputs #:allow-other-keys)

31
distro/packages/gawk.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -35,15 +35,26 @@
(sha256
(base32 "0sss7rhpvizi2a88h6giv0i7w5h07s2fxkw3s6n1hqvcnhrfgbb0"))))
(build-system gnu-build-system)
(arguments (case-lambda
((system)
(if (string=? system "i686-cygwin")
'(#:tests? #f) ; work around test failure on Cygwin
'(#:parallel-tests? #f))) ; test suite fails in parallel
((system cross-system)
'(#:parallel-tests? #f))))
(inputs `(("libsigsegv" ,libsigsegv) ; headers
("libsigsegv/lib" ,libsigsegv "lib"))) ; library
(arguments
(case-lambda
((system)
`(#:parallel-tests? #f ; test suite fails in parallel
;; Work around test failure on Cygwin.
#:tests? ,(not (string=? system "i686-cygwin"))
#:phases (alist-cons-before
'configure 'set-shell-file-name
(lambda* (#:key inputs #:allow-other-keys)
;; Refer to the right shell.
(let ((bash (assoc-ref inputs "bash")))
(substitute* "io.c"
(("/bin/sh")
(string-append bash "/bin/bash")))))
%standard-phases)))
((system cross-system)
'(#:parallel-tests? #f))))
(inputs `(("libsigsegv" ,libsigsegv)))
(home-page "http://www.gnu.org/software/gawk/")
(synopsis "GNU implementation of the Awk programming language")
(description

15
distro/packages/gettext.scm

@ -37,7 +37,20 @@
"1sa3ch12qxa4h3ya6hkz119yclcccmincl9j20dhrdx5mykp3b4k"))))
(build-system gnu-build-system)
(arguments
`(#:patches (list (assoc-ref %build-inputs "patch/gets"))))
`(#:patches (list (assoc-ref %build-inputs "patch/gets"))
#:phases (alist-cons-before
'check 'patch-tests
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(substitute* (find-files "gettext-tools/tests"
"^msgexec-[0-9]")
(("#![[:blank:]]/bin/sh")
(format #f "#!~a/bin/sh" bash)))
(substitute* (find-files "gettext-tools/gnulib-tests"
"posix_spawn")
(("/bin/sh")
(format #f "~a/bin/bash" bash)))))
%standard-phases)))
(inputs
`(("patch/gets"
,(search-patch "gettext-gets-undeclared.patch"))))

20
distro/packages/guile.scm

@ -120,6 +120,16 @@ extensible. It supports many SRFIs.")
(self-native-input? #t)
(arguments
'(#:phases (alist-cons-before
'configure 'pre-configure
(lambda* (#:key inputs #:allow-other-keys)
(let ((bash (assoc-ref inputs "bash")))
(substitute* "module/ice-9/popen.scm"
(("/bin/sh")
(string-append bash "/bin/bash")))))
%standard-phases)))
(synopsis "GNU Guile 2.0, an embeddable Scheme implementation")
(description
"GNU Guile is an implementation of the Scheme programming language, with
@ -134,15 +144,7 @@ call interface, and powerful string processing.")
(define-public guile-2.0/fixed
;; A package of Guile 2.0 that's rarely changed. It is the one used
;; in the `base' module, and thus changing it entails a full rebuild.
(package (inherit guile-2.0)
(version "2.0.6")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/guile/guile-" version
".tar.xz"))
(sha256
(base32
"000ng5qsq3cl1k35jvzvhwxj92wx4q87745n2fppkd4irh58vv5l"))))))
guile-2.0)
;;;

18
distro/packages/ld-wrapper.scm

@ -1,4 +1,4 @@
#!/bin/sh
#!@BASH@
# -*- mode: scheme; coding: utf-8; -*-
# XXX: We have to go through Bash because there's no command-line switch to
@ -7,28 +7,28 @@
# Use `load-compiled' because `load' (and `-l') doesn't otherwise load our
# .go file (see <http://bugs.gnu.org/12519>).
main="(@ (distro packages ld-wrapper) ld-wrapper)"
main="(@ (gnu build-support ld-wrapper) ld-wrapper)"
exec @GUILE@ -c "(load-compiled \"$0.go\") (apply $main (cdr (command-line)))" "$@"
!#
;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of Guix.
;;; This file is part of GNU Guix.
;;;
;;; Guix is free software; you can redistribute it and/or modify it
;;; 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.
;;;
;;; Guix is distributed in the hope that it will be useful, but
;;; 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 Guix. If not, see <http://www.gnu.org/licenses/>.
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (distro packages ld-wrapper)
(define-module (gnu build-support ld-wrapper)
#:use-module (srfi srfi-1)
#:export (ld-wrapper))

3
distro/packages/libsigsegv.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -35,7 +35,6 @@
(sha256
(base32 "16hrs8k3nmc7a8jam5j1fpspd6sdpkamskvsdpcw6m29vnis8q44"))))
(build-system gnu-build-system)
(outputs '("out" "lib")) ; separate libdir from the rest
(home-page "http://www.gnu.org/software/libsigsegv/")
(synopsis "GNU libsigsegv, a library to handle page faults in user mode")
(description

11
distro/packages/linux.scm

@ -33,8 +33,13 @@
(define-public linux-libre-headers
(let* ((version* "3.3.8")
(build-phase
'(lambda* (#:key outputs #:allow-other-keys)
(setenv "ARCH" "x86_64") ; XXX
'(lambda* (#:key system #:allow-other-keys)
(let ((arch (car (string-split system #\-))))
(setenv "ARCH"
(cond ((string=? arch "i686") "i386")
(else arch)))
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
(and (zero? (system* "make" "defconfig"))
(zero? (system* "make" "mrproper" "headers_check")))))
(install-phase
@ -193,4 +198,4 @@ providing the system administrator with some help in common tasks.")
"Tools for working with USB devices, such as lsusb")
(description
"Tools for working with USB devices, such as lsusb.")
(license gpl2+)))
(license gpl2+)))

5
distro/packages/lsh.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -114,8 +114,7 @@
(substitute* "src/testsuite/login-auth-test"
(("/bin/cat")
;; Use the right path to `cat'.
(search-path (search-path-as-string->list (getenv "PATH"))
"cat"))))
(which "cat"))))
%standard-phases)))
(home-page "http://www.lysator.liu.se/~nisse/lsh/")
(synopsis

14
distro/packages/m4.scm

@ -46,7 +46,19 @@
#:patches (list (assoc-ref %build-inputs "patch/s_isdir")
(assoc-ref %build-inputs
"patch/readlink-EINVAL")
(assoc-ref %build-inputs "patch/gets"))))
(assoc-ref %build-inputs "patch/gets"))
#:phases (alist-cons-before
'check 'pre-check
(lambda* (#:key inputs #:allow-other-keys)
;; Fix references to /bin/sh.
(let ((bash (assoc-ref inputs "bash")))
(for-each patch-shebang
(find-files "tests" "\\.sh$"))
(substitute* (find-files "tests"
"posix_spawn")
(("/bin/sh")
(format #f "~a/bin/bash" bash)))))
%standard-phases)))
((system cross-system)
`(#:patches (list (assoc-ref %build-inputs "patch/s_isdir")
(assoc-ref %build-inputs

308
distro/packages/make-bootstrap.scm

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -19,7 +19,9 @@
(define-module (distro packages make-bootstrap)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix licenses)
#:use-module (guix build-system trivial)
#:use-module (guix build-system gnu)
#:use-module ((distro) #:select (search-patch))
#:use-module (distro packages base)
#:use-module (distro packages bash)
@ -29,11 +31,13 @@
#:use-module (distro packages linux)
#:use-module (distro packages multiprecision)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:export (%bootstrap-binaries-tarball
%binutils-bootstrap-tarball
%glibc-bootstrap-tarball
%gcc-bootstrap-tarball
%guile-bootstrap-tarball))
%guile-bootstrap-tarball
%bootstrap-tarballs))
;;; Commentary:
;;;
@ -43,48 +47,38 @@
;;;
;;; Code:
(define* (static-package p #:optional (loc (current-source-location)))
"Return a statically-linked version of package P."
;; TODO: Move to (guix build-system gnu).
(let ((args (package-arguments p)))
(package (inherit p)
(location (source-properties->location loc))
(arguments
(let ((augment (lambda (args)
(let ((a (default-keyword-arguments args
'(#:configure-flags '()
#:strip-flags #f))))
(substitute-keyword-arguments a
((#:configure-flags flags)
`(cons* "--disable-shared"
"LDFLAGS=-static"
,flags))
((#:strip-flags _)
''("--strip-all")))))))
(if (procedure? args)
(lambda x
(augment (apply args x)))
(augment args)))))))
(define %glibc-for-bootstrap
;; A libc whose `system' and `popen' functions looks for `sh' in $PATH,
;; without nscd, and with static NSS modules.
(package (inherit glibc-final)
(arguments
(lambda (system)
(substitute-keyword-arguments ((package-arguments glibc-final) system)
((#:patches patches)
`(cons (assoc-ref %build-inputs "patch/system")
,patches))
((#:configure-flags flags)
;; Arrange so that getaddrinfo & co. do not contact the nscd,
;; and can use statically-linked NSS modules.
`(cons* "--disable-nscd" "--disable-build-nscd"
"--enable-static-nss"
,flags)))))
(inputs
`(("patch/system" ,(search-patch "glibc-bootstrap-system.patch"))
,@(package-inputs glibc-final)))))
(define %standard-inputs-with-relocatable-glibc
;; Standard inputs with the above libc and corresponding GCC.
`(("libc", %glibc-for-bootstrap)
("gcc" ,(package-with-explicit-inputs
gcc-4.7
`(("libc",%glibc-for-bootstrap)
,@(alist-delete "libc" %final-inputs))
(current-source-location)))
,@(fold alist-delete %final-inputs '("libc" "gcc"))))
(define %bash-static
(let ((bash-light (package (inherit bash-final)
(inputs '()) ; no readline, no curses
(arguments
(let ((args `(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1)
(srfi srfi-26))
,@(package-arguments bash))))
(substitute-keyword-arguments args
((#:configure-flags flags)
`(list "--without-bash-malloc"
"--disable-readline"
"--disable-history"
"--disable-help-builtin"
"--disable-progcomp"
"--disable-net-redirections"
"--disable-nls"))))))))
(static-package bash-light)))
(static-package bash-light))
(define %static-inputs
;; Packages that are to be used as %BOOTSTRAP-INPUTS.
@ -94,8 +88,13 @@
'("--disable-nls"
"--disable-silent-rules"
"--enable-no-install-program=stdbuf,libstdbuf.so"
"CFLAGS=-Os -g0" ; smaller, please
"LDFLAGS=-static -pthread")
,@(package-arguments coreutils)))))
#:tests? #f ; signal-related Gnulib tests fail
,@(package-arguments coreutils)))
;; Remove optional dependencies such as GMP.
(inputs `(,(assoc "perl" (package-inputs coreutils))))))
(bzip2 (package (inherit bzip2)
(arguments
(substitute-keyword-arguments (package-arguments bzip2)
@ -121,18 +120,27 @@
(gawk (package (inherit gawk)
(arguments
(lambda (system)
`(#:phases (alist-cons-before
'build 'no-export-dynamic
(lambda* (#:key outputs #:allow-other-keys)
;; Since we use `-static', remove
;; `-export-dynamic'.
(substitute* "configure"
(("-export-dynamic") "")))
%standard-phases)
,@((package-arguments gawk) system)))))))
`(#:patches (list (assoc-ref %build-inputs "patch/sh"))
,@(substitute-keyword-arguments
((package-arguments gawk) system)
((#:phases phases)
`(alist-cons-before
'configure 'no-export-dynamic
(lambda _
;; Since we use `-static', remove
;; `-export-dynamic'.
(substitute* "configure"
(("-export-dynamic") "")))
,phases))))))
(inputs `(("patch/sh" ,(search-patch "gawk-shell.patch"))))))
(finalize (lambda (p)
(static-package (package-with-explicit-inputs
p
%standard-inputs-with-relocatable-glibc)
(current-source-location)))))
`(,@(map (match-lambda
((name package)
(list name (static-package package (current-source-location)))))
(list name (finalize package))))
`(("tar" ,tar)
("gzip" ,gzip)
("bzip2" ,bzip2)
@ -272,84 +280,87 @@
;; GNU libc's essential shared libraries, dynamic linker, and headers,
;; with all references to store directories stripped. As a result,
;; libc.so is unusable and need to be patched for proper relocation.
(package (inherit glibc-final)
(name "glibc-stripped")
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils))
(setvbuf (current-output-port) _IOLBF)
(let* ((out (assoc-ref %outputs "out"))
(libdir (string-append out "/lib"))
(incdir (string-append out "/include"))
(libc (assoc-ref %build-inputs "libc"))
(linux (assoc-ref %build-inputs "linux-headers")))
(mkdir-p libdir)
(for-each (lambda (file)
(let ((target (string-append libdir "/"
(basename file))))
(copy-file file target)
(remove-store-references target)))
(find-files (string-append libc "/lib")
"^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$"))
(copy-recursively (string-append libc "/include") incdir)
;; Copy some of the Linux-Libre headers that glibc headers
;; refer to.
(mkdir (string-append incdir "/linux"))
(for-each (lambda (file)
(copy-file (string-append linux "/include/linux/" file)
(string-append incdir "/linux/"
(basename file))))
'("limits.h" "errno.h" "socket.h" "kernel.h"
"sysctl.h" "param.h" "ioctl.h" "types.h"
"posix_types.h" "stddef.h"))
(copy-recursively (string-append linux "/include/asm")
(string-append incdir "/asm"))
(copy-recursively (string-append linux "/include/asm-generic")
(string-append incdir "/asm-generic"))
#t))))
(inputs `(("libc" ,glibc-final)
("linux-headers" ,linux-libre-headers)))))
(let ((glibc %glibc-for-bootstrap))
(package (inherit glibc)
(name "glibc-stripped")
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils))
(setvbuf (current-output-port) _IOLBF)
(let* ((out (assoc-ref %outputs "out"))
(libdir (string-append out "/lib"))
(incdir (string-append out "/include"))
(libc (assoc-ref %build-inputs "libc"))
(linux (assoc-ref %build-inputs "linux-headers")))
(mkdir-p libdir)
(for-each (lambda (file)
(let ((target (string-append libdir "/"
(basename file))))
(copy-file file target)
(remove-store-references target)))
(find-files (string-append libc "/lib")
"^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|util).*\\.so(\\..*)?|libc_nonshared\\.a)$"))
(copy-recursively (string-append libc "/include") incdir)
;; Copy some of the Linux-Libre headers that glibc headers
;; refer to.
(mkdir (string-append incdir "/linux"))
(for-each (lambda (file)
(copy-file (string-append linux "/include/linux/" file)
(string-append incdir "/linux/"
(basename file))))
'("limits.h" "errno.h" "socket.h" "kernel.h"
"sysctl.h" "param.h" "ioctl.h" "types.h"
"posix_types.h" "stddef.h"))
(copy-recursively (string-append linux "/include/asm")
(string-append incdir "/asm"))
(copy-recursively (string-append linux "/include/asm-generic")
(string-append incdir "/asm-generic"))
#t))))
(inputs `(("libc" ,glibc)
("linux-headers" ,linux-libre-headers))))))
(define %gcc-static
;; A statically-linked GCC, with stripped-down functionality.
(package (inherit gcc-final)
(name "gcc-static")
(arguments
(lambda (system)
`(#:modules ((guix build utils)
(guix build gnu-build-system)
(srfi srfi-1)
(srfi srfi-26)
(ice-9 regex))
,@(substitute-keyword-arguments ((package-arguments gcc-final) system)
((#:guile _) #f)
((#:implicit-inputs? _) #t)
((#:configure-flags flags)
`(append (list
"--disable-shared"
"--disable-plugin"
"--enable-languages=c"
"--disable-libmudflap"
"--disable-libgomp"
"--disable-libssp"
"--disable-libquadmath"
"--disable-decimal-float")
(remove (cut string-match "--(.*plugin|enable-languages)" <>)
,flags)))
((#:make-flags flags)
`(cons "BOOT_LDFLAGS=-static" ,flags))))))
(inputs `(("gmp-source" ,(package-source gmp))
("mpfr-source" ,(package-source mpfr))
("mpc-source" ,(package-source mpc))
("binutils" ,binutils-final)
,@(package-inputs gcc-4.7)))))
(package-with-explicit-inputs
(package (inherit gcc-final)
(name "gcc-static")
(arguments
(lambda (system)
`(#:modules ((guix build utils)
(guix build gnu-build-system)
(srfi srfi-1)
(srfi srfi-26)
(ice-9 regex))
,@(substitute-keyword-arguments ((package-arguments gcc-final) system)
((#:guile _) #f)
((#:implicit-inputs? _) #t)
((#:configure-flags flags)