summaryrefslogtreecommitdiff
path: root/gnu/packages/make-bootstrap.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/make-bootstrap.scm')
-rw-r--r--gnu/packages/make-bootstrap.scm87
1 files changed, 67 insertions, 20 deletions
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 37bf4e9744..4594e2fe36 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -3,7 +3,8 @@
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -105,20 +106,52 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
(define (native-inputs)
(if (%current-target-system)
- (let ((target (%current-target-system)))
- `(("cross-gcc" ,(cross-gcc target
- #:xbinutils (cross-binutils target)
- #:libc (cross-bootstrap-libc)))
+ (let* ((target (%current-target-system))
+ (xgcc (cross-gcc
+ target
+ #:xbinutils (cross-binutils target)
+ #:libc (cross-bootstrap-libc))))
+ `(("cross-gcc" ,(package
+ (inherit xgcc)
+ (search-paths
+ ;; Ensure the cross libc headers appears on the
+ ;; C++ system header search path.
+ (cons (search-path-specification
+ (variable "CROSS_CPLUS_INCLUDE_PATH")
+ (files '("include")))
+ (package-search-paths gcc)))))
("cross-binutils" ,(cross-binutils target))
,@(%final-inputs)))
`(("libc" ,(glibc-for-bootstrap))
("libc:static" ,(glibc-for-bootstrap) "static")
("gcc" ,(package (inherit gcc)
- (outputs '("out")) ; all in one so libgcc_s is easily found
+ (outputs '("out")) ;all in one so libgcc_s is easily found
+ (native-search-paths
+ ;; Set CPLUS_INCLUDE_PATH so GCC is able to find the libc
+ ;; C++ headers.
+ (cons (search-path-specification
+ (variable "CPLUS_INCLUDE_PATH")
+ (files '("include")))
+ (package-native-search-paths gcc)))
(inputs
- `(("libc" ,(glibc-for-bootstrap))
+ `(;; Distinguish the name so we can refer to it below.
+ ("bootstrap-libc" ,(glibc-for-bootstrap))
("libc:static" ,(glibc-for-bootstrap) "static")
- ,@(package-inputs gcc)))))
+ ,@(package-inputs gcc)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments gcc)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'configure 'treat-glibc-as-system-header
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((libc (assoc-ref inputs "bootstrap-libc")))
+ ;; GCCs build processes requires that the libc
+ ;; we're building against is on the system header
+ ;; search path.
+ (for-each (lambda (var)
+ (setenv var (string-append libc "/include")))
+ '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
+ #t)))))))))
,@(fold alist-delete (%final-inputs) '("libc" "gcc")))))
(package-with-explicit-inputs p inputs
@@ -143,7 +176,15 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
"--disable-silent-rules"
"--enable-no-install-program=stdbuf,libstdbuf.so"
"CFLAGS=-Os -g0" ; smaller, please
- "LDFLAGS=-static -pthread")
+ "LDFLAGS=-static -pthread"
+
+ ;; Work around a cross-compilation bug whereby libcoreutils.a
+ ;; would provide '__mktime_internal', which conflicts with the
+ ;; one in libc.a.
+ ,@(if (%current-target-system)
+ `("gl_cv_func_working_mktime=yes")
+ '()))
+
#:tests? #f ; signal-related Gnulib tests fail
,@(package-arguments coreutils)))
@@ -168,6 +209,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
"LDFLAGS = -static"))
#t))))))))
(xz (package (inherit xz)
+ (outputs '("out"))
(arguments
`(#:strip-flags '("--strip-all")
#:phases (modify-phases %standard-phases
@@ -205,17 +247,22 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
'()))))
(tar (package (inherit tar)
(arguments
- (substitute-keyword-arguments (package-arguments tar)
- ((#:phases phases)
- `(modify-phases ,phases
- (replace 'set-shell-file-name
- (lambda _
- ;; Do not use "/bin/sh" to run programs; see
- ;; <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg02272.html>.
- (substitute* "src/system.c"
- (("/bin/sh") "sh")
- (("execv ") "execvp "))
- #t))))))))
+ `(;; Work around a cross-compilation bug whereby libgnu.a would provide
+ ;; '__mktime_internal', which conflicts with the one in libc.a.
+ ,@(if (%current-target-system)
+ `(#:configure-flags '("gl_cv_func_working_mktime=yes"))
+ '())
+ ,@(substitute-keyword-arguments (package-arguments tar)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (replace 'set-shell-file-name
+ (lambda _
+ ;; Do not use "/bin/sh" to run programs; see
+ ;; <http://lists.gnu.org/archive/html/guix-devel/2016-09/msg02272.html>.
+ (substitute* "src/system.c"
+ (("/bin/sh") "sh")
+ (("execv ") "execvp "))
+ #t)))))))))
;; We don't want to retain a reference to /gnu/store in the bootstrap
;; versions of egrep/fgrep, so we remove the custom phase added since
;; grep@2.25. The effect is 'egrep' and 'fgrep' look for 'grep' in