summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-30 22:56:38 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-30 22:57:03 +0100
commita18eda2747fa2eb962e3288066d2b1a679589ed3 (patch)
tree3622bccc9d73d6f09eb1a89be841d8faacbc32d5 /guix
parent5cfdb4bcac145abb4f6ce29aaf8fd46504e9e0a9 (diff)
downloadguix-patches-a18eda2747fa2eb962e3288066d2b1a679589ed3.tar
guix-patches-a18eda2747fa2eb962e3288066d2b1a679589ed3.tar.gz
packages: Add `native-search-paths' field and honor it.
* guix/packages.scm (<search-path-specification>): New record type. (search-path-specification->sexp): New procedure. (<package>)[native-search-paths]: New field. (package-derivation): Accumulate the search paths, and pass them as #:search-paths toe BUILDER. * guix/build-system/gnu.scm (gnu-build): Add #:search-paths. Compute `implicit-search-paths'. Pass #:search-paths in BUILDER. * guix/build-system/perl.scm (perl-build): Add #:search-paths, pass it to BUILDER with the search paths of PERL. * guix/build-system/cmake.scm (cmake-build): Add #:search-paths, pass it to BUILDER. * guix/build-system/trivial.scm (trivial-build): Add #:search-paths, ignore it. * guix/build/gnu-build-system.scm (set-paths): Add #:search-paths. Remove explicit settings of CPATH, LIBRARY_PATH, and PKG_CONFIG_PATH. Instead, walk SEARCH-PATHS and call `set-path-environment-variable' for them. * guix/build/perl-build-system.scm (perl-build): Remove PERL5LIB setting. * tests/packages.scm ("search paths"): New test. * gnu/packages/bootstrap.scm (%bootstrap-guile)[raw]: Add #:search-paths. (%bootstrap-gcc): Add `native-search-paths' field. * gnu/packages/perl.scm (perl): Likewise. * gnu/packages/pkg-config.scm (pkg-config): Likewise. * gnu/packages/glib.scm (intltool): Remove `arguments'. * gnu/packages/avahi.scm (avahi): Remove #:phases.
Diffstat (limited to 'guix')
-rw-r--r--guix/build-system/cmake.scm3
-rw-r--r--guix/build-system/gnu.scm25
-rw-r--r--guix/build-system/perl.scm7
-rw-r--r--guix/build-system/trivial.scm6
-rw-r--r--guix/build/gnu-build-system.scm20
-rw-r--r--guix/build/perl-build-system.scm4
-rw-r--r--guix/packages.scm49
7 files changed, 83 insertions, 31 deletions
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index 9794f4d057..4e993f3961 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -38,6 +38,7 @@
(define* (cmake-build store name source inputs
#:key (guile #f)
(outputs '("out")) (configure-flags ''())
+ (search-paths '())
(make-flags ''())
(patches ''()) (patch-flags ''("--batch" "-p1"))
(cmake (@ (gnu packages cmake) cmake))
@@ -70,6 +71,8 @@ provides a 'CMakeLists.txt' file as its build system."
#:system ,system
#:outputs %outputs
#:inputs %build-inputs
+ #:search-paths ',(map search-path-specification->sexp
+ search-paths)
#:patches ,patches
#:patch-flags ,patch-flags
#:phases ,phases
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index f4d0fa4f7c..d5ad1e3e01 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -159,7 +159,9 @@ System: GCC, GNU Make, Bash, Coreutils, etc."
(define* (gnu-build store name source inputs
#:key (guile #f)
- (outputs '("out")) (configure-flags ''())
+ (outputs '("out"))
+ (search-paths '())
+ (configure-flags ''())
(make-flags ''())
(patches ''()) (patch-flags ''("--batch" "-p1"))
(out-of-source? #f)
@@ -189,6 +191,21 @@ the builder's environment, from the host. Note that we distinguish
between both, because for Guile's own modules like (ice-9 foo), we want
to use GUILE's own version of it, rather than import the user's one,
which could lead to gratuitous input divergence."
+ (define implicit-inputs
+ (and implicit-inputs?
+ (parameterize ((%store store))
+ (standard-inputs system))))
+
+ (define implicit-search-paths
+ (if implicit-inputs?
+ (append-map (match-lambda
+ ((_ (? package? p) _ ...)
+ (package-native-search-paths p))
+ (_
+ '()))
+ implicit-inputs)
+ '()))
+
(define builder
`(begin
(use-modules ,@modules)
@@ -198,6 +215,9 @@ which could lead to gratuitous input divergence."
#:system ,system
#:outputs %outputs
#:inputs %build-inputs
+ #:search-paths ',(map search-path-specification->sexp
+ (append implicit-search-paths
+ search-paths))
#:patches ,patches
#:patch-flags ,patch-flags
#:phases ,phases
@@ -231,8 +251,7 @@ which could lead to gratuitous input divergence."
'())
,@inputs
,@(if implicit-inputs?
- (parameterize ((%store store))
- (standard-inputs system))
+ implicit-inputs
'()))
#:outputs outputs
#:modules imported-modules
diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm
index 537c29e799..c97698e225 100644
--- a/guix/build-system/perl.scm
+++ b/guix/build-system/perl.scm
@@ -38,6 +38,7 @@
(define* (perl-build store name source inputs
#:key
(perl (@ (gnu packages perl) perl))
+ (search-paths '())
(tests? #t)
(make-maker-flags ''())
(phases '(@ (guix build perl-build-system)
@@ -53,6 +54,9 @@
(guix build utils))))
"Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE
provides a `Makefile.PL' file as its build system."
+ (define perl-search-paths
+ (package-native-search-paths perl))
+
(define builder
`(begin
(use-modules ,@modules)
@@ -60,6 +64,9 @@ provides a `Makefile.PL' file as its build system."
#:source ,(if (and source (derivation-path? source))
(derivation-path->output-path source)
source)
+ #:search-paths ',(map search-path-specification->sexp
+ (append perl-search-paths
+ search-paths))
#:make-maker-flags ,make-maker-flags
#:system ,system
#:test-target "test"
diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm
index e5bbeaa91d..2eb15aa2e0 100644
--- a/guix/build-system/trivial.scm
+++ b/guix/build-system/trivial.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -26,7 +26,9 @@
#:export (trivial-build-system))
(define* (trivial-build store name source inputs
- #:key outputs guile system builder (modules '()))
+ #:key
+ outputs guile system builder (modules '())
+ search-paths)
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
ignored."
(define guile-for-build
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 891c30df8f..94a7d6bca8 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -48,26 +48,22 @@
#f
dir))
-(define* (set-paths #:key inputs
+(define* (set-paths #:key inputs (search-paths '())
#:allow-other-keys)
(define input-directories
(match inputs
(((_ . dir) ...)
dir)))
- (set-path-environment-variable "PATH" '("bin")
- input-directories)
- (set-path-environment-variable "CPATH" '("include")
- input-directories)
- (set-path-environment-variable "LIBRARY_PATH" '("lib" "lib64")
+ (set-path-environment-variable "PATH" '("bin" "sbin")
input-directories)
- ;; FIXME: Eventually move this to the `search-paths' field of the
- ;; `pkg-config' package.
- (set-path-environment-variable "PKG_CONFIG_PATH"
- '("lib/pkgconfig" "lib64/pkgconfig"
- "share/pkgconfig")
- input-directories)
+ (for-each (match-lambda
+ ((env-var (directories ...) separator)
+ (set-path-environment-variable env-var directories
+ input-directories
+ #:separator separator)))
+ search-paths)
;; Dump the environment variables as a shell script, for handy debugging.
(system "export > environment-variables"))
diff --git a/guix/build/perl-build-system.scm b/guix/build/perl-build-system.scm
index d625ef3ed6..793b6aacb5 100644
--- a/guix/build/perl-build-system.scm
+++ b/guix/build/perl-build-system.scm
@@ -50,10 +50,6 @@
(define* (perl-build #:key inputs (phases %standard-phases)
#:allow-other-keys #:rest args)
"Build the given Perl package, applying all of PHASES in order."
- (set-path-environment-variable "PERL5LIB" '("lib/perl5/site_perl")
- (match inputs
- (((_ . path) ...)
- path)))
(apply gnu:gnu-build
#:inputs inputs #:phases phases
args))
diff --git a/guix/packages.scm b/guix/packages.scm
index 81f09d638e..3a6a07bbcc 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -37,6 +37,11 @@
origin-file-name
base32
+ <search-path-specification>
+ search-path-specification
+ search-path-specification?
+ search-path-specification->sexp
+
package
package?
package-name
@@ -49,6 +54,7 @@
package-native-inputs
package-propagated-inputs
package-outputs
+ package-native-search-paths
package-search-paths
package-synopsis
package-description
@@ -104,8 +110,22 @@ representation."
((_ str)
#'(nix-base32-string->bytevector str)))))
-;; A package.
+;; The specification of a search path.
+(define-record-type* <search-path-specification>
+ search-path-specification make-search-path-specification
+ search-path-specification?
+ (variable search-path-specification-variable)
+ (directories search-path-specification-directories)
+ (separator search-path-specification-separator (default ":")))
+
+(define (search-path-specification->sexp spec)
+ "Return an sexp representing SPEC, a <search-path-specification>. The sexp
+corresponds to the arguments expected by `set-path-environment-variable'."
+ (match spec
+ (($ <search-path-specification> variable directories separator)
+ `(,variable ,directories ,separator))))
+;; A package.
(define-record-type* <package>
package make-package
package?
@@ -128,10 +148,13 @@ representation."
(outputs package-outputs ; list of strings
(default '("out")))
- (search-paths package-search-paths ; list of (ENV-VAR (DIRS ...))
- (default '())) ; tuples; see
- ; `set-path-environment-variable'
- ; (aka. "setup-hook")
+
+ ; lists of
+ ; <search-path-specification>,
+ ; for native and cross
+ ; inputs
+ (native-search-paths package-native-search-paths (default '()))
+ (search-paths package-search-paths (default '()))
(synopsis package-synopsis) ; one-line description
(description package-description) ; one or two paragraphs
@@ -292,16 +315,22 @@ PACKAGE for SYSTEM."
(($ <package> name version source (= build-system-builder builder)
args inputs propagated-inputs native-inputs self-native-input?
outputs)
- ;; TODO: For `search-paths', add a builder prologue that calls
- ;; `set-path-environment-variable'.
- (let ((inputs (map expand-input
- (package-transitive-inputs package))))
+ (let* ((inputs (package-transitive-inputs package))
+ (input-drvs (map expand-input inputs))
+ (paths (delete-duplicates
+ (append-map (match-lambda
+ ((_ (? package? p) _ ...)
+ (package-native-search-paths
+ p))
+ (_ '()))
+ inputs))))
(apply builder
store (package-full-name package)
(and source
(package-source-derivation store source system))
- inputs
+ input-drvs
+ #:search-paths paths
#:outputs outputs #:system system
(args))))))))