bootstrap: Move use-modules to top of builder.

* gnu/packages/bootstrap.scm (package-from-tarball): Move use-modules to top of builder.
(%bootstrap-glibc): Likewise.
(%bootstrap-gcc): Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-21 23:39:43 +02:00
parent 35dcf85157
commit 668ffe1e4e
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -115,23 +115,25 @@ (define* (package-from-tarball name source program-to-test description
`(#:guile ,%bootstrap-guile `(#:guile ,%bootstrap-guile
#:modules ((guix build utils)) #:modules ((guix build utils))
#:builder #:builder
(let ((out (assoc-ref %outputs "out")) (begin
(tar (assoc-ref %build-inputs "tar"))
(xz (assoc-ref %build-inputs "xz"))
(tarball (assoc-ref %build-inputs "tarball")))
(use-modules (guix build utils)) (use-modules (guix build utils))
(mkdir out) (let ((out (assoc-ref %outputs "out"))
(copy-file tarball "binaries.tar.xz") (tar (assoc-ref %build-inputs "tar"))
(invoke xz "-d" "binaries.tar.xz") (xz (assoc-ref %build-inputs "xz"))
(let ((builddir (getcwd))) (tarball (assoc-ref %build-inputs "tarball")))
(with-directory-excursion out
(invoke tar "xvf" (mkdir out)
(string-append builddir "/binaries.tar")) (copy-file tarball "binaries.tar.xz")
,@(if snippet (list snippet) '()) (invoke xz "-d" "binaries.tar.xz")
(or (not ,program-to-test) (let ((builddir (getcwd)))
(invoke (string-append "bin/" ,program-to-test) (with-directory-excursion out
"--version"))))))) (invoke tar "xvf"
(string-append builddir "/binaries.tar"))
,@(if snippet (list snippet) '())
(or (not ,program-to-test)
(invoke (string-append "bin/" ,program-to-test)
"--version"))))))))
(inputs (inputs
`(("tar" ,(search-bootstrap-binary "tar" (%current-system))) `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
@ -460,28 +462,30 @@ (define %bootstrap-glibc
`(#:guile ,%bootstrap-guile `(#:guile ,%bootstrap-guile
#:modules ((guix build utils)) #:modules ((guix build utils))
#:builder #:builder
(let ((out (assoc-ref %outputs "out")) (begin
(tar (assoc-ref %build-inputs "tar"))
(xz (assoc-ref %build-inputs "xz"))
(tarball (assoc-ref %build-inputs "tarball")))
(use-modules (guix build utils)) (use-modules (guix build utils))
(mkdir out) (let ((out (assoc-ref %outputs "out"))
(copy-file tarball "binaries.tar.xz") (tar (assoc-ref %build-inputs "tar"))
(invoke xz "-d" "binaries.tar.xz") (xz (assoc-ref %build-inputs "xz"))
(let ((builddir (getcwd))) (tarball (assoc-ref %build-inputs "tarball")))
(with-directory-excursion out
(invoke tar "xvf"
(string-append builddir
"/binaries.tar"))
(chmod "lib" #o755)
;; Patch libc.so so it refers to the right path. (mkdir out)
(substitute* "lib/libc.so" (copy-file tarball "binaries.tar.xz")
(("/[^ ]+/lib/(libc|ld)" _ prefix) (invoke xz "-d" "binaries.tar.xz")
(string-append out "/lib/" prefix))) (let ((builddir (getcwd)))
(with-directory-excursion out
(invoke tar "xvf"
(string-append builddir
"/binaries.tar"))
(chmod "lib" #o755)
#t))))) ;; Patch libc.so so it refers to the right path.
(substitute* "lib/libc.so"
(("/[^ ]+/lib/(libc|ld)" _ prefix)
(string-append out "/lib/" prefix)))
#t))))))
(inputs (inputs
`(("tar" ,(search-bootstrap-binary "tar" (%current-system))) `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
@ -531,39 +535,41 @@ (define %bootstrap-gcc
`(#:guile ,%bootstrap-guile `(#:guile ,%bootstrap-guile
#:modules ((guix build utils)) #:modules ((guix build utils))
#:builder #:builder
(let ((out (assoc-ref %outputs "out")) (begin
(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) (use-modules (guix build utils)
(ice-9 popen)) (ice-9 popen))
(mkdir out) (let ((out (assoc-ref %outputs "out"))
(copy-file tarball "binaries.tar.xz") (tar (assoc-ref %build-inputs "tar"))
(invoke xz "-d" "binaries.tar.xz") (xz (assoc-ref %build-inputs "xz"))
(let ((builddir (getcwd)) (bash (assoc-ref %build-inputs "bash"))
(bindir (string-append out "/bin"))) (libc (assoc-ref %build-inputs "libc"))
(with-directory-excursion out (tarball (assoc-ref %build-inputs "tarball")))
(invoke tar "xvf"
(string-append builddir "/binaries.tar")))
(with-directory-excursion bindir (mkdir out)
(chmod "." #o755) (copy-file tarball "binaries.tar.xz")
(rename-file "gcc" ".gcc-wrapped") (invoke xz "-d" "binaries.tar.xz")
(call-with-output-file "gcc" (let ((builddir (getcwd))
(lambda (p) (bindir (string-append out "/bin")))
(format p "#!~a (with-directory-excursion out
(invoke 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 \ exec ~a/bin/.gcc-wrapped -B~a/lib \
-Wl,-rpath -Wl,~a/lib \ -Wl,-rpath -Wl,~a/lib \
-Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
bash bash
out libc libc libc out libc libc libc
,(glibc-dynamic-linker)))) ,(glibc-dynamic-linker))))
(chmod "gcc" #o555) (chmod "gcc" #o555)
#t))))) #t))))))
(inputs (inputs
`(("tar" ,(search-bootstrap-binary "tar" (%current-system))) `(("tar" ,(search-bootstrap-binary "tar" (%current-system)))
("xz" ,(search-bootstrap-binary "xz" (%current-system))) ("xz" ,(search-bootstrap-binary "xz" (%current-system)))
@ -571,33 +577,33 @@ (define %bootstrap-gcc
("libc" ,%bootstrap-glibc) ("libc" ,%bootstrap-glibc)
("tarball" ,(bootstrap-origin ("tarball" ,(bootstrap-origin
(origin (origin
(method url-fetch) (method url-fetch)
(uri (map (cut string-append <> "/" (%current-system) (uri (map (cut string-append <> "/" (%current-system)
(match (%current-system) (match (%current-system)
("armhf-linux" ("armhf-linux"
"/20150101/gcc-4.8.4.tar.xz") "/20150101/gcc-4.8.4.tar.xz")
("aarch64-linux" ("aarch64-linux"
"/20170217/gcc-5.4.0.tar.xz") "/20170217/gcc-5.4.0.tar.xz")
(_ (_
"/20131110/gcc-4.8.2.tar.xz"))) "/20131110/gcc-4.8.2.tar.xz")))
%bootstrap-base-urls)) %bootstrap-base-urls))
(sha256 (sha256
(match (%current-system) (match (%current-system)
("x86_64-linux" ("x86_64-linux"
(base32 (base32
"17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls")) "17ga4m6195n4fnbzdkmik834znkhs53nkypp6557pl1ps7dgqbls"))
("i686-linux" ("i686-linux"
(base32 (base32
"150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw")) "150c1arrf2k8vfy6dpxh59vcgs4p1bgiz2av5m19dynpks7rjnyw"))
("armhf-linux" ("armhf-linux"
(base32 (base32
"0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v")) "0ghz825yzp43fxw53kd6afm8nkz16f7dxi9xi40bfwc8x3nbbr8v"))
("aarch64-linux" ("aarch64-linux"
(base32 (base32
"1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1")) "1ar3vdzyqbfm0z36kmvazvfswxhcihlacl2dzdjgiq25cqnq9ih1"))
("mips64el-linux" ("mips64el-linux"
(base32 (base32
"1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks"))))))))) "1m5miqkyng45l745n0sfafdpjkqv9225xf44jqkygwsipj2cv9ks")))))))))
(native-search-paths (native-search-paths
(list (search-path-specification (list (search-path-specification
(variable "CPATH") (variable "CPATH")