summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-11-09 22:22:39 +0100
committerLudovic Courtès <ludo@gnu.org>2019-11-09 23:04:14 +0100
commit0c72a719efee667c7d3eba1c74c357838fc84efa (patch)
tree1e704a8d6c8548d5b53846177ef95ea87ec5029a
parent2a4309de43011f87b3a5044c3d956c261ae151e4 (diff)
gnu: make-bootstrap: Memoize GCC variant.
This reduces the number of nodes in "guix graph guile-static-stripped" from 165 to 150. Likewise, the hit rate in the 'add-data-to-store' cache for "guix build guile-static-stripped -nd" goes from 24% to 12%. * gnu/packages/make-bootstrap.scm (gcc-for-bootstrap): New procedure. (package-with-relocatable-glibc): Use it.
-rw-r--r--gnu/packages/make-bootstrap.scm62
1 files changed, 34 insertions, 28 deletions
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 4b8387a65fb..4e6be3270aa 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -88,6 +88,39 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
88 ;; contain store file names, so the CRC changes at every rebuild.) 88 ;; contain store file names, so the CRC changes at every rebuild.)
89 (outputs (delete "debug" (package-outputs base)))))) 89 (outputs (delete "debug" (package-outputs base))))))
90 90
91(define gcc-for-bootstrap
92 (mlambdaq (glibc)
93 "Return a variant of GCC that uses the bootstrap variant of GLIBC."
94 (package
95 (inherit gcc)
96 (outputs '("out")) ;all in one so libgcc_s is easily found
97 (native-search-paths
98 ;; Set CPLUS_INCLUDE_PATH so GCC is able to find the libc
99 ;; C++ headers.
100 (cons (search-path-specification
101 (variable "CPLUS_INCLUDE_PATH")
102 (files '("include")))
103 (package-native-search-paths gcc)))
104 (inputs
105 `( ;; Distinguish the name so we can refer to it below.
106 ("bootstrap-libc" ,(glibc-for-bootstrap glibc))
107 ("libc:static" ,(glibc-for-bootstrap glibc) "static")
108 ,@(package-inputs gcc)))
109 (arguments
110 (substitute-keyword-arguments (package-arguments gcc)
111 ((#:phases phases)
112 `(modify-phases ,phases
113 (add-before 'configure 'treat-glibc-as-system-header
114 (lambda* (#:key inputs #:allow-other-keys)
115 (let ((libc (assoc-ref inputs "bootstrap-libc")))
116 ;; GCCs build processes requires that the libc
117 ;; we're building against is on the system header
118 ;; search path.
119 (for-each (lambda (var)
120 (setenv var (string-append libc "/include")))
121 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
122 #t))))))))))
123
91(define (package-with-relocatable-glibc p) 124(define (package-with-relocatable-glibc p)
92 "Return a variant of P that uses the libc as defined by 125 "Return a variant of P that uses the libc as defined by
93`glibc-for-bootstrap'." 126`glibc-for-bootstrap'."
@@ -127,34 +160,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
127 ,@(%final-inputs))) 160 ,@(%final-inputs)))
128 `(("libc" ,(glibc-for-bootstrap glibc)) 161 `(("libc" ,(glibc-for-bootstrap glibc))
129 ("libc:static" ,(glibc-for-bootstrap glibc) "static") 162 ("libc:static" ,(glibc-for-bootstrap glibc) "static")
130 ("gcc" ,(package (inherit gcc) 163 ("gcc" ,(gcc-for-bootstrap glibc))
131 (outputs '("out")) ;all in one so libgcc_s is easily found
132 (native-search-paths
133 ;; Set CPLUS_INCLUDE_PATH so GCC is able to find the libc
134 ;; C++ headers.
135 (cons (search-path-specification
136 (variable "CPLUS_INCLUDE_PATH")
137 (files '("include")))
138 (package-native-search-paths gcc)))
139 (inputs
140 `(;; Distinguish the name so we can refer to it below.
141 ("bootstrap-libc" ,(glibc-for-bootstrap glibc))
142 ("libc:static" ,(glibc-for-bootstrap glibc) "static")
143 ,@(package-inputs gcc)))
144 (arguments
145 (substitute-keyword-arguments (package-arguments gcc)
146 ((#:phases phases)
147 `(modify-phases ,phases
148 (add-before 'configure 'treat-glibc-as-system-header
149 (lambda* (#:key inputs #:allow-other-keys)
150 (let ((libc (assoc-ref inputs "bootstrap-libc")))
151 ;; GCCs build processes requires that the libc
152 ;; we're building against is on the system header
153 ;; search path.
154 (for-each (lambda (var)
155 (setenv var (string-append libc "/include")))
156 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
157 #t)))))))))
158 ,@(fold alist-delete (%final-inputs) '("libc" "gcc"))))) 164 ,@(fold alist-delete (%final-inputs) '("libc" "gcc")))))
159 165
160 (package-with-explicit-inputs p inputs 166 (package-with-explicit-inputs p inputs