summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-12-01 22:24:21 +0100
committerLudovic Courtès <ludo@gnu.org>2014-12-01 22:41:04 +0100
commitc8b7569558d8cdde352960ad4eac9bc43a503c5a (patch)
treecc7bb4507220a5cbeca366f26c87e9c7682106df
parent4efdabb810717cee845de30a81799c953915d1eb (diff)
downloadguix-c8b7569558d8cdde352960ad4eac9bc43a503c5a.tar.gz
build-system/glib-or-gtk: Correctly handle multiple-output packages.
* guix/build/glib-or-gtk-build-system.scm (wrap-all-programs): Move body
  to 'handle-output' inner procedure, and parametrize it by output name
  and directory.  Call it for each element of OUTPUTS.
  (compile-glib-schemas): Likewise.
-rw-r--r--guix/build/glib-or-gtk-build-system.scm69
1 files changed, 39 insertions, 30 deletions
diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm
index 011f9b3f4f..5fc3b7c003 100644
--- a/guix/build/glib-or-gtk-build-system.scm
+++ b/guix/build/glib-or-gtk-build-system.scm
@@ -83,41 +83,50 @@ a list with all found directories."
   "Implement phase \"glib-or-gtk-wrap\": look for GSettings schemas and
 gtk+-v.0 libraries and create wrappers with suitably set environment variables
 if found."
-  (let* ((out (assoc-ref outputs "out"))
-         (bindir (string-append out "/bin"))
-         (bin-list (find-files bindir ".*"))
-         (schemas (schemas-directories (acons "out" out inputs)))
+  (define handle-output
+    (match-lambda
+     ((output . directory)
+      (let* ((bindir       (string-append directory "/bin"))
+             (bin-list     (find-files bindir ".*"))
+             (schemas      (schemas-directories
+                            (alist-cons output directory inputs)))
+             (gtk-mod-dirs (gtk-module-directories
+                            (alist-cons output directory inputs)))
+             (schemas-env-var
+              (if (not (null? schemas))
+                  `("XDG_DATA_DIRS" ":" prefix ,schemas)
+                  #f))
+             (gtk-mod-env-var
+              (if (not (null? gtk-mod-dirs))
+                  `("GTK_PATH" ":" prefix ,gtk-mod-dirs)
+                  #f)))
+        (cond
+         ((and schemas-env-var gtk-mod-env-var)
+          (for-each (cut wrap-program <> schemas-env-var gtk-mod-env-var)
+                    bin-list))
          (schemas-env-var
-          (if (not (null? schemas))
-              `("XDG_DATA_DIRS" ":" prefix ,schemas)
-              #f))
-         (gtk-mod-dirs (gtk-module-directories (acons "out" out inputs)))
+          (for-each (cut wrap-program <> schemas-env-var)
+                    bin-list))
          (gtk-mod-env-var
-          (if (not (null? gtk-mod-dirs))
-              `("GTK_PATH" ":" prefix ,gtk-mod-dirs)
-              #f)))
-    (cond
-     ((and schemas-env-var gtk-mod-env-var)
-      (for-each (cut wrap-program <> schemas-env-var gtk-mod-env-var)
-                bin-list))
-     (schemas-env-var
-      (for-each (cut wrap-program <> schemas-env-var)
-                bin-list))
-     (gtk-mod-env-var
-      (for-each (cut wrap-program <> gtk-mod-env-var)
-                bin-list)))
-    #t))
+          (for-each (cut wrap-program <> gtk-mod-env-var)
+                    bin-list)))))))
 
-(define* (compile-glib-schemas #:key inputs outputs #:allow-other-keys)
+  (for-each handle-output outputs)
+  #t)
+
+(define* (compile-glib-schemas #:key outputs #:allow-other-keys)
   "Implement phase \"glib-or-gtk-compile-schemas\": compile \"glib\" schemas
 if needed."
-  (let* ((out (assoc-ref outputs "out"))
-         (schemasdir (string-append out "/share/glib-2.0/schemas")))
-    (if (and (directory-exists? schemasdir)
-             (not (file-exists?
-                   (string-append schemasdir "/gschemas.compiled"))))
-        (system* "glib-compile-schemas" schemasdir)
-        #t)))
+  (every (match-lambda
+          ((output . directory)
+           (let ((schemasdir (string-append directory
+                                            "/share/glib-2.0/schemas")))
+             (if (and (directory-exists? schemasdir)
+                      (not (file-exists?
+                            (string-append schemasdir "/gschemas.compiled"))))
+                 (zero? (system* "glib-compile-schemas" schemasdir))
+                 #t))))
+         outputs))
 
 (define %standard-phases
   (alist-cons-after