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.
This commit is contained in:
Ludovic Courtès 2014-12-01 22:39:05 +01:00
parent c8b7569558
commit 73aa8ddb75
3 changed files with 44 additions and 26 deletions

View File

@ -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} that appropriately set the @code{XDG_DATA_DIRS} and @code{GTK_PATH}
environment variables. 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 @item glib-or-gtk-compile-schemas
The phase @code{glib-or-gtk-compile-schemas} makes sure that all GLib's 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, @uref{https://developer.gnome.org/gio/stable/glib-compile-schemas.html,

View File

@ -122,6 +122,7 @@
"bin" "sbin")) "bin" "sbin"))
(phases '(@ (guix build glib-or-gtk-build-system) (phases '(@ (guix build glib-or-gtk-build-system)
%standard-phases)) %standard-phases))
(glib-or-gtk-wrap-excluded-outputs '())
(system (%current-system)) (system (%current-system))
(imported-modules %default-imported-modules) (imported-modules %default-imported-modules)
(modules %default-modules) (modules %default-modules)
@ -153,6 +154,8 @@
#:search-paths ',(map search-path-specification->sexp #:search-paths ',(map search-path-specification->sexp
search-paths) search-paths)
#:phases ,phases #:phases ,phases
#:glib-or-gtk-wrap-excluded-outputs
,glib-or-gtk-wrap-excluded-outputs
#:configure-flags ,configure-flags #:configure-flags ,configure-flags
#:make-flags ,make-flags #:make-flags ,make-flags
#:out-of-source? ,out-of-source? #:out-of-source? ,out-of-source?

View File

@ -79,37 +79,45 @@ a list with all found directories."
(fold glib-schemas '() inputs)) (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 "Implement phase \"glib-or-gtk-wrap\": look for GSettings schemas and
gtk+-v.0 libraries and create wrappers with suitably set environment variables 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 (define handle-output
(match-lambda (match-lambda
((output . directory) ((output . directory)
(let* ((bindir (string-append directory "/bin")) (unless (member output glib-or-gtk-wrap-excluded-outputs)
(bin-list (find-files bindir ".*")) (let* ((bindir (string-append directory "/bin"))
(schemas (schemas-directories (bin-list (find-files bindir ".*"))
(alist-cons output directory inputs))) (schemas (schemas-directories
(gtk-mod-dirs (gtk-module-directories (alist-cons output directory inputs)))
(alist-cons output directory inputs))) (gtk-mod-dirs (gtk-module-directories
(schemas-env-var (alist-cons output directory inputs)))
(if (not (null? schemas)) (schemas-env-var
`("XDG_DATA_DIRS" ":" prefix ,schemas) (if (not (null? schemas))
#f)) `("XDG_DATA_DIRS" ":" prefix ,schemas)
(gtk-mod-env-var #f))
(if (not (null? gtk-mod-dirs)) (gtk-mod-env-var
`("GTK_PATH" ":" prefix ,gtk-mod-dirs) (if (not (null? gtk-mod-dirs))
#f))) `("GTK_PATH" ":" prefix ,gtk-mod-dirs)
(cond #f)))
((and schemas-env-var gtk-mod-env-var) (cond
(for-each (cut wrap-program <> schemas-env-var gtk-mod-env-var) ((and schemas-env-var gtk-mod-env-var)
bin-list)) (for-each (cut wrap-program <> schemas-env-var gtk-mod-env-var)
(schemas-env-var bin-list))
(for-each (cut wrap-program <> schemas-env-var) (schemas-env-var
bin-list)) (for-each (cut wrap-program <> schemas-env-var)
(gtk-mod-env-var bin-list))
(for-each (cut wrap-program <> gtk-mod-env-var) (gtk-mod-env-var
bin-list))))))) (for-each (cut wrap-program <> gtk-mod-env-var)
bin-list))))))))
(for-each handle-output outputs) (for-each handle-output outputs)
#t) #t)