;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.
;;;
"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
+ (lambda* (url hash-algo hash
#:optional name #:key system)
- (fetch store url hash-algo hash
+ (fetch url hash-algo hash
#:guile %bootstrap-guile
#:system system)))
(patch patch))
(origin-patches source))))))
-(define (package-from-tarball name source program-to-test description)
+(define* (package-from-tarball name source program-to-test description
+ #:key snippet)
"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."
+check whether everything is alright. If SNIPPET is provided, it is
+evaluated after extracting SOURCE. SNIPPET should return true if
+successful, or false to signal an error."
(package
(name name)
(version "0")
(with-directory-excursion out
(and (zero? (system* tar "xvf"
(string-append builddir "/binaries.tar")))
+ ,@(if snippet (list snippet) '())
(zero? (system* (string-append "bin/" ,program-to-test)
"--version"))))))))
(inputs
(native-inputs (map rewritten-input
(package-native-inputs p)))
(propagated-inputs (map rewritten-input
- (package-propagated-inputs p)))))))
+ (package-propagated-inputs p)))
+ (replacement (and=> (package-replacement p)
+ package-with-bootstrap-guile))))))
(define* (glibc-dynamic-linker
#:optional (system (or (and=> (%current-target-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")
+ ((string=? system "armhf-linux") "/lib/ld-linux-armhf.so.3")
((string=? system "mips64el-linux") "/lib/ld.so.1")
+
+ ;; XXX: This one is used bare-bones, without a libc, so add a case
+ ;; here just so we can keep going.
+ ((string=? system "xtensa-elf") "no-ld.so")
+ ((string=? system "avr") "no-ld.so")
+
(else (error "dynamic linker name not known for this system"
system))))
;;; Bootstrap packages.
;;;
+(define* (raw-build store name inputs
+ #:key outputs system search-paths
+ #:allow-other-keys)
+ (define (->store file)
+ (add-to-store store file #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 (match system
+ ("armhf-linux"
+ "guile-2.0.11.tar.xz")
+ (_
+ "guile-2.0.9.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
+ bash `(,builder)
+ #:system system
+ #:inputs `((,bash) (,builder)))))
+
+(define* (make-raw-bag name
+ #:key source inputs native-inputs outputs
+ system target)
+ (bag
+ (name name)
+ (system system)
+ (build-inputs inputs)
+ (build raw-build)))
+
(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.
;; 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 search-paths)
- (define (->store file)
- (add-to-store store file #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-2.0.9.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
- bash `(,builder)
- #:system system
- #:inputs `((,bash) (,builder)))))))))
+ (name 'raw)
+ (description "Raw build system with direct store access")
+ (lower make-raw-bag))))
(package
(name "guile-bootstrap")
(version "2.0")
(origin
(method url-fetch)
(uri (map (cut string-append <> "/" system
- "/20131110/static-binaries.tar.xz")
+ (match system
+ ("armhf-linux"
+ "/20150101/static-binaries.tar.xz")
+ (_
+ "/20131110/static-binaries.tar.xz")))
%bootstrap-base-urls))
(sha256
(match system
("i686-linux"
(base32
"0s5b3jb315n13m1k8095l0a5hfrsz8g0fv1b6riyc5hnxqyphlak"))
+ ("armhf-linux"
+ (base32
+ "0gf0fn2kbpxkjixkmx5f4z6hv6qpmgixl69zgg74dbsfdfj8jdv5"))
("mips64el-linux"
(base32
"072y4wyfsj1bs80r6vbybbafy8ya4vfy7qj25dklwk97m6g71753"))))))
- "true" ; the program to test
- "Bootstrap binaries of Coreutils, Awk, etc."))
+ "fgrep" ; the program to test
+ "Bootstrap binaries of Coreutils, Awk, etc."
+ #:snippet
+ '(let ((path (list (string-append (getcwd) "/bin"))))
+ (chmod "bin" #o755)
+ (patch-shebang "bin/egrep" path)
+ (patch-shebang "bin/fgrep" path)
+ (chmod "bin" #o555)
+ #t)))
(define %bootstrap-binutils
(package-from-tarball "binutils-bootstrap"
(origin
(method url-fetch)
(uri (map (cut string-append <> "/" system
- "/20131110/binutils-2.23.2.tar.xz")
+ (match system
+ ("armhf-linux"
+ "/20150101/binutils-2.25.tar.xz")
+ (_
+ "/20131110/binutils-2.23.2.tar.xz")))
%bootstrap-base-urls))
(sha256
(match system
("i686-linux"
(base32
"14jgwf9gscd7l2pnz610b1zia06dvcm2qyzvni31b8zpgmcai2v9"))
+ ("armhf-linux"
+ (base32
+ "1v7dj6bzn6m36f20gw31l99xaabq4xrhrx3gwqkhhig0mdlmr69q"))
("mips64el-linux"
(base32
"1x8kkhcxmfyzg1ddpz2pxs6fbdl6412r7x0nzbmi5n7mj8zw2gy7"))))))
(origin
(method url-fetch)
(uri (map (cut string-append <> "/" (%current-system)
- "/20131110/glibc-2.18.tar.xz")
+ (match (%current-system)
+ ("armhf-linux"
+ "/20150101/glibc-2.20.tar.xz")
+ (_
+ "/20131110/glibc-2.18.tar.xz")))
%bootstrap-base-urls))
(sha256
(match (%current-system)
("i686-linux"
(base32
"1hgrccw1zqdc7lvgivwa54d9l3zsim5pqm0dykxg0z522h6gr05w"))
+ ("armhf-linux"
+ (base32
+ "18cmgvpllqfpn6khsmivqib7ys8ymnq0hdzi3qp24prik0ykz8gn"))
("mips64el-linux"
(base32
"0k97a3whzx3apsi9n2cbsrr79ad6lh00klxph9hw4fqyp1abkdsg")))))))))
(origin
(method url-fetch)
(uri (map (cut string-append <> "/" (%current-system)
- "/20131110/gcc-4.8.2.tar.xz")
+ (match (%current-system)
+ ("armhf-linux"
+ "/20150101/gcc-4.8.4.tar.xz")
+ (_
+ "/20131110/gcc-4.8.2.tar.xz")))
%bootstrap-base-urls))
(sha256
(match (%current-system)
("i686-linux"
(base32
"150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
+ ("armhf-linux"
+ (base32
+ "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
("mips64el-linux"
(base32
"1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
(native-search-paths
(list (search-path-specification
(variable "CPATH")
- (directories '("include")))
+ (files '("include")))
(search-path-specification
(variable "LIBRARY_PATH")
- (directories '("lib" "lib64")))))
+ (files '("lib" "lib64")))))
(synopsis "Bootstrap binaries of the GNU Compiler Collection")
(description #f)
(home-page #f)