summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-12-01 22:39:05 +0100
committerLudovic Courtès <ludo@gnu.org>2014-12-01 22:41:04 +0100
commit73aa8ddb75bf143ae21e383118ae69582a0d93b5 (patch)
tree716504637e30776bd11b2c39d7faab8b2e0ce62f
parentc8b7569558d8cdde352960ad4eac9bc43a503c5a (diff)
downloadguix-73aa8ddb75bf143ae21e383118ae69582a0d93b5.tar.gz
build-system/glib-or-gtk: Allow specific outputs to be excluded from wrapping.
* guix/build/glib-or-gtk-build-system.scm (wrap-all-programs): Add
  #:glib-or-gtk-wrap-excluded-outputs parameter and honor it.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build): Add
  #:glib-or-gtk-wrap-excluded-outputs parameter and pass it in BUILDER.
* doc/guix.texi (Build Systems): Mention it.
-rw-r--r--doc/guix.texi7
-rw-r--r--guix/build-system/glib-or-gtk.scm3
-rw-r--r--guix/build/glib-or-gtk-build-system.scm60
3 files changed, 44 insertions, 26 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 75ce632602..157aecbe33 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1808,6 +1808,13 @@ modules}.  This is achieved by wrapping the programs in launch scripts
 that appropriately set the @code{XDG_DATA_DIRS} and @code{GTK_PATH}
 environment variables.
 
+It is possible to exclude specific package outputs from that wrapping
+process by listing their names in the
+@code{#:glib-or-gtk-wrap-excluded-outputs} parameter.  This is useful
+when an output is known not to contain any GLib or GTK+ binaries, and
+where wrapping would gratuitously add a dependency of that output on
+GLib and GTK+.
+
 @item glib-or-gtk-compile-schemas
 The phase @code{glib-or-gtk-compile-schemas} makes sure that all GLib's
 @uref{https://developer.gnome.org/gio/stable/glib-compile-schemas.html,
diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm
index 51e0c419e3..039bfb948c 100644
--- a/guix/build-system/glib-or-gtk.scm
+++ b/guix/build-system/glib-or-gtk.scm
@@ -122,6 +122,7 @@
                                                   "bin" "sbin"))
                             (phases '(@ (guix build glib-or-gtk-build-system)
                                         %standard-phases))
+                            (glib-or-gtk-wrap-excluded-outputs '())
                             (system (%current-system))
                             (imported-modules %default-imported-modules)
                             (modules %default-modules)
@@ -153,6 +154,8 @@
                           #:search-paths ',(map search-path-specification->sexp
                                                 search-paths)
                           #:phases ,phases
+                          #:glib-or-gtk-wrap-excluded-outputs
+                           ,glib-or-gtk-wrap-excluded-outputs
                           #:configure-flags ,configure-flags
                           #:make-flags ,make-flags
                           #:out-of-source? ,out-of-source?
diff --git a/guix/build/glib-or-gtk-build-system.scm b/guix/build/glib-or-gtk-build-system.scm
index 5fc3b7c003..9351a70a0e 100644
--- a/guix/build/glib-or-gtk-build-system.scm
+++ b/guix/build/glib-or-gtk-build-system.scm
@@ -79,37 +79,45 @@ a list with all found directories."
 
   (fold glib-schemas '() inputs))
 
-(define* (wrap-all-programs #:key inputs outputs #:allow-other-keys)
+(define* (wrap-all-programs #:key inputs outputs
+                            (glib-or-gtk-wrap-excluded-outputs '())
+                            #:allow-other-keys)
   "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."
+if found.
+
+Wrapping is not applied to outputs whose name is listed in
+GLIB-OR-GTK-WRAP-EXCLUDED-OUTPUTS.  This is useful when an output is known not
+to contain any GLib or GTK+ binaries, and where wrapping would gratuitously
+add a dependency of that output on GLib and GTK+."
   (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
-          (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)))))))
+      (unless (member output glib-or-gtk-wrap-excluded-outputs)
+        (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
+            (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))))))))
 
   (for-each handle-output outputs)
   #t)