build-system/gnu: Fix `#:path-exclusions' handling.

* guix/build/gnu-build-system.scm (set-paths)[relevant-input-directories]:
  New procedure.  Use it.  This fixes #:path-exclusions handling.
This commit is contained in:
Ludovic Courtès 2012-09-06 22:58:43 +02:00
parent 9d9ef458e8
commit 2d14ef0f2c

View file

@ -49,38 +49,34 @@ (define (first-subdirectory dir)
(define* (set-paths #:key inputs (path-exclusions '()) (define* (set-paths #:key inputs (path-exclusions '())
#:allow-other-keys) #:allow-other-keys)
(let ((inputs (map cdr inputs))) (define (relevant-input-directories env-var)
(set-path-environment-variable "PATH" '("bin") ;; Return the subset of INPUTS that should be considered when setting
(remove (cute member <> ;; ENV-VAR.
(or (assoc-ref path-exclusions (match (assoc-ref path-exclusions env-var)
"PATH") (#f
'())) (map cdr inputs))
inputs)) ((excluded ...)
(set-path-environment-variable "CPATH" '("include") (filter-map (match-lambda
(remove (cute member <> ((name . dir)
(or (assoc-ref path-exclusions (and (not (member name excluded))
"CPATH") dir)))
'())) inputs))))
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 (set-path-environment-variable "PATH" '("bin")
;; `pkg-config' package. (relevant-input-directories "PATH"))
(set-path-environment-variable "PKG_CONFIG_PATH" (set-path-environment-variable "CPATH" '("include")
'("lib/pkgconfig" "lib64/pkgconfig") (relevant-input-directories "CPATH"))
(remove (cute member <> (set-path-environment-variable "LIBRARY_PATH" '("lib" "lib64")
(or (assoc-ref path-exclusions (relevant-input-directories "LIBRARY_PATH"))
"PKG_CONFIG_PATH")
'()))
inputs))
;; Dump the environment variables as a shell script, for handy debugging. ;; FIXME: Eventually move this to the `search-paths' field of the
(system "export > environment-variables"))) ;; `pkg-config' package.
(set-path-environment-variable "PKG_CONFIG_PATH"
'("lib/pkgconfig" "lib64/pkgconfig")
(relevant-input-directories "PKG_CONFIG_PATH"))
;; Dump the environment variables as a shell script, for handy debugging.
(system "export > environment-variables"))
(define* (unpack #:key source #:allow-other-keys) (define* (unpack #:key source #:allow-other-keys)
(and (zero? (system* "tar" "xvf" source)) (and (zero? (system* "tar" "xvf" source))