build-system/gnu: Add `path-exclusions' parameter.

* guix/build/gnu-build-system.scm (set-paths): Add new `path-exclusions'
  parameter; honor it.
* guix/build-system/gnu.scm (gnu-build): New `path-exclusions' keyword
  parameter; pass it to BUILDER.

* distro/base.scm (gcc-4.7): Exclude "libc" from $LIBRARY_PATH.
This commit is contained in:
Ludovic Courtès 2012-09-01 01:14:31 +02:00
parent f1f100b297
commit dc4e02572e
3 changed files with 36 additions and 5 deletions

View file

@ -605,6 +605,15 @@ (define-public gcc-4.7
"-Wl," libc "/lib/ld-linux-x86-64.so.2") "-Wl," libc "/lib/ld-linux-x86-64.so.2")
,(string-append "BOOT_CFLAGS=-O2 " ,(string-append "BOOT_CFLAGS=-O2 "
,(if stripped? "-g0" "-g")))) ,(if stripped? "-g0" "-g"))))
;; Exclude libc from $LIBRARY_PATH since the compiler being used
;; should know whether its libc is, and to avoid linking build tools
;; like `genhooks' against the wrong libc (for instance, when
;; building a gcc-for-glibc-2.16 with a gcc-for-glibc-2.13,
;; `genhooks' could end up being linked with glibc-2.16 but using
;; crt*.o from glibc-2.13.)
#:path-exclusions '(("LIBRARY_PATH" "libc"))
#:tests? #f #:tests? #f
#:phases #:phases
(alist-cons-before (alist-cons-before

View file

@ -47,6 +47,7 @@ (define* (gnu-build store name source inputs
(make-flags ''()) (make-flags ''())
(patches ''()) (patch-flags ''("--batch" "-p1")) (patches ''()) (patch-flags ''("--batch" "-p1"))
(out-of-source? #f) (out-of-source? #f)
(path-exclusions ''())
(tests? #t) (tests? #t)
(parallel-build? #t) (parallel-tests? #t) (parallel-build? #t) (parallel-tests? #t)
(patch-shebangs? #t) (patch-shebangs? #t)
@ -74,6 +75,7 @@ (define builder
#:configure-flags ,configure-flags #:configure-flags ,configure-flags
#:make-flags ,make-flags #:make-flags ,make-flags
#:out-of-source? ,out-of-source? #:out-of-source? ,out-of-source?
#:path-exclusions ,path-exclusions
#:tests? ,tests? #:tests? ,tests?
#:parallel-build? ,parallel-build? #:parallel-build? ,parallel-build?
#:parallel-tests? ,parallel-tests? #:parallel-tests? ,parallel-tests?

View file

@ -47,17 +47,37 @@ (define (first-subdirectory dir)
#f #f
dir)) dir))
(define* (set-paths #:key inputs #:allow-other-keys) (define* (set-paths #:key inputs (path-exclusions '())
#:allow-other-keys)
(let ((inputs (map cdr inputs))) (let ((inputs (map cdr inputs)))
(set-path-environment-variable "PATH" '("bin") inputs) (set-path-environment-variable "PATH" '("bin")
(set-path-environment-variable "CPATH" '("include") inputs) (remove (cute member <>
(set-path-environment-variable "LIBRARY_PATH" '("lib" "lib64") inputs) (or (assoc-ref path-exclusions
"PATH")
'()))
inputs))
(set-path-environment-variable "CPATH" '("include")
(remove (cute member <>
(or (assoc-ref path-exclusions
"CPATH")
'()))
inputs))
(set-path-environment-variable "LIBRARY_PATH" '("lib" "lib64")
(remove (cute member <>
(or (assoc-ref path-exclusions
"LIBRARY_PATH")
'()))
inputs))
;; FIXME: Eventually move this to the `search-paths' field of the ;; FIXME: Eventually move this to the `search-paths' field of the
;; `pkg-config' package. ;; `pkg-config' package.
(set-path-environment-variable "PKG_CONFIG_PATH" (set-path-environment-variable "PKG_CONFIG_PATH"
'("lib/pkgconfig" "lib64/pkgconfig") '("lib/pkgconfig" "lib64/pkgconfig")
inputs) (remove (cute member <>
(or (assoc-ref path-exclusions
"PKG_CONFIG_PATH")
'()))
inputs))
;; Dump the environment variables as a shell script, for handy debugging. ;; Dump the environment variables as a shell script, for handy debugging.
(system "export > environment-variables"))) (system "export > environment-variables")))