summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-01-10 00:08:40 +0100
committerLudovic Courtès <ludo@gnu.org>2013-01-10 00:08:40 +0100
commita06a99ff779c7419c2e47c475b5c0fa8a9fc24c1 (patch)
tree5d456ba9b6159c9277edb02d7151699ec803d787
parent9149f1a08731de1db63536e4a29480b769f7e0a7 (diff)
downloadguix-a06a99ff779c7419c2e47c475b5c0fa8a9fc24c1.tar.gz
build-system/gnu: Improve support for "lib" outputs; support "doc" outputs.
* guix/build/gnu-build-system.scm (configure)[package-name]: New
  procedure.
  When LIBDIR is true and INCLUDEDIR is false, add
  --includedir=LIBDIR/include.
  Add support for --docdir when a "doc" output exists.
-rw-r--r--guix/build/gnu-build-system.scm23
1 files changed, 21 insertions, 2 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index e9421000bf..b7b9fdac95 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.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.
 ;;;
@@ -115,10 +115,20 @@ makefiles."
 
 (define* (configure #:key inputs outputs (configure-flags '()) out-of-source?
                     #:allow-other-keys)
+  (define (package-name)
+    (let* ((out  (assoc-ref outputs "out"))
+           (base (basename out))
+           (dash (string-rindex base #\-)))
+      ;; XXX: We'd rather use `package-name->name+version' or similar.
+      (if dash
+          (substring base 0 dash)
+          base)))
+
   (let* ((prefix     (assoc-ref outputs "out"))
          (bindir     (assoc-ref outputs "bin"))
          (libdir     (assoc-ref outputs "lib"))
          (includedir (assoc-ref outputs "include"))
+         (docdir     (assoc-ref outputs "doc"))
          (bash       (or (and=> (assoc-ref inputs "bash")
                                 (cut string-append <> "/bin/bash"))
                          "/bin/sh"))
@@ -133,12 +143,21 @@ makefiles."
                               (list (string-append "--bindir=" bindir "/bin"))
                               '())
                        ,@(if libdir
-                              (list (string-append "--libdir=" libdir "/lib"))
+                              (cons (string-append "--libdir=" libdir "/lib")
+                                    (if includedir
+                                        '()
+                                        (list
+                                         (string-append "--includedir="
+                                                        libdir "/include"))))
                               '())
                        ,@(if includedir
                              (list (string-append "--includedir="
                                                   includedir "/include"))
                              '())
+                       ,@(if docdir
+                             (list (string-append "--docdir=" docdir
+                                                  "/doc/" (package-name)))
+                             '())
                        ,@configure-flags))
          (abs-srcdir (getcwd))
          (srcdir     (if out-of-source?