[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
133/136: build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file
From: |
guix-commits |
Subject: |
133/136: build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file in a phase. |
Date: |
Sun, 17 Oct 2021 05:16:27 -0400 (EDT) |
apteryx pushed a commit to branch core-updates-frozen-batched-changes
in repository guix.
commit d44dddbadfbb62790fcf09294680c08e9ea7e3c6
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sun Oct 3 00:25:36 2021 -0400
build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file in a phase.
Adding a profile hook to do so covers most use cases, but it is still
necessary to have the gdk-pixbuf loaders cache file computed at build time,
as
software may expect to find loaders support at that time.
* guix/build/glib-or-gtk-build-system.scm: Delete trailing #t.
(%gdk-pixbuf-loaders-cache-file-prefix): New variable.
(generate-gdk-pixbuf-loaders-cache): New procedure.
(generate-gdk-pixbuf-loaders-cache-file): Add procedure...
(%standard-phases): ... and register it as a build phase.
---
guix/build/glib-or-gtk-build-system.scm | 55 ++++++++++++++++++++++++++++++---
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/guix/build/glib-or-gtk-build-system.scm
b/guix/build/glib-or-gtk-build-system.scm
index c2f814e..763918d 100644
--- a/guix/build/glib-or-gtk-build-system.scm
+++ b/guix/build/glib-or-gtk-build-system.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -28,6 +29,8 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%standard-phases
+ %gdk-pixbuf-loaders-cache-file
+ generate-gdk-pixbuf-loaders-cache
glib-or-gtk-build))
;; Commentary:
@@ -183,8 +186,7 @@ add a dependency of that output on GLib and GTK+."
(apply wrap-program program #:sh (sh) env-vars))
bin-list))))))
- (for-each handle-output outputs)
- #t)
+ (for-each handle-output outputs))
(define* (compile-glib-schemas #:key outputs #:allow-other-keys)
"Implement phase \"glib-or-gtk-compile-schemas\": compile \"glib\" schemas
@@ -197,11 +199,56 @@ if needed."
(not (file-exists?
(string-append schemasdir
"/gschemas.compiled"))))
(invoke "glib-compile-schemas" schemasdir)))))
- outputs)
- #t)
+ outputs))
+
+(define %gdk-pixbuf-loaders-cache-file
+ "gdk-pixbuf-2.0/2.10.0/loaders.cache")
+
+(define (generate-gdk-pixbuf-loaders-cache directories outputs)
+ "Generate the loaders.cache file used by gdk-pixbuf to locate the available
+loaders among DIRECTORIES, and set the GDK_PIXBUF_MODULE_FILE environment
+variable. The cache file is installed under OUTPUTS. Return the first cache
+file name if one was created else #f."
+ (let* ((loaders (append-map
+ (cut find-files <> "^libpixbufloader-.*\\.so$")
+ directories))
+ (outputs* (map (cut string-append <> "/"
+ %gdk-pixbuf-loaders-cache-file)
+ outputs))
+ (loaders.cache (first outputs*))
+ (loaders.cache-copies (cdr outputs*)))
+ (if (not (null? loaders))
+ (begin
+ (mkdir-p (dirname loaders.cache))
+ (setenv "GDK_PIXBUF_MODULE_FILE" loaders.cache)
+ (apply invoke "gdk-pixbuf-query-loaders" "--update-cache" loaders)
+ (for-each (lambda (f)
+ (mkdir-p (dirname f))
+ (copy-file loaders.cache f))
+ loaders.cache-copies)
+ loaders.cache)
+ #f)))
+
+(define* (generate-gdk-pixbuf-loaders-cache-file #:key inputs outputs
+ #:allow-other-keys)
+ "Build phase that Wraps the GENERATE-GDK-PIXBUF-LOADERS-CACHE procedure."
+ ;; Conditionally compute the cache file if the gdk-pixbuf command is
+ ;; available on PATH (it comes with gdk-pixbuf).
+ (when (which "gdk-pixbuf-query-loaders")
+ (let ((loaders.cache (generate-gdk-pixbuf-loaders-cache
+ (map cdr inputs)
+ (filter-map identity
+ (list
+ (assoc-ref outputs "out")
+ (assoc-ref outputs "bin")
+ (assoc-ref outputs "lib"))))))
+ (when loaders.cache
+ (format #t "GDK_PIXBUF_MODULE_FILE set to `~a'~%" loaders.cache)))))
(define %standard-phases
(modify-phases gnu:%standard-phases
+ (add-after 'unpack 'generate-gdk-pixbuf-loaders-cache-file
+ generate-gdk-pixbuf-loaders-cache-file)
(add-after 'install 'glib-or-gtk-compile-schemas compile-glib-schemas)
(add-after 'install 'glib-or-gtk-wrap wrap-all-programs)))
- 94/136: gnu: fontconfig: Add a search path for XDG_DATA_DIRS., (continued)
- 94/136: gnu: fontconfig: Add a search path for XDG_DATA_DIRS., guix-commits, 2021/10/17
- 95/136: gnu: Move a few Python packages to (gnu packages python-build)., guix-commits, 2021/10/17
- 64/136: gnu: gst-plugins-ugly: Update to 1.18.5., guix-commits, 2021/10/17
- 70/136: gnu: python-keras: Enable parallel tests., guix-commits, 2021/10/17
- 98/136: gnu: Add python-tomli., guix-commits, 2021/10/17
- 111/136: gnu: colord-minimal: Introduce minimal variant., guix-commits, 2021/10/17
- 118/136: gnu: cmake-bootstrap: Update to 3.21.3., guix-commits, 2021/10/17
- 123/136: gnu: pango: Update to 1.48.10., guix-commits, 2021/10/17
- 125/136: gnu: glib: Update to 2.70, specify a bindir prefix and hide package., guix-commits, 2021/10/17
- 132/136: gnu: gtk: Add the generate-gdk-pixbuf-loaders-cache-file phase., guix-commits, 2021/10/17
- 133/136: build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file in a phase.,
guix-commits <=
- 134/136: profiles: Add a gdk-pixbuf-loaders-cache-file hook., guix-commits, 2021/10/17
- 37/136: gnu: python-sphinxcontrib-serializinghtml: Update to 1.1.5., guix-commits, 2021/10/17
- 53/136: gnu: googletest: Update to 1.11.0., guix-commits, 2021/10/17
- 56/136: gnu: mozjs-78: Update to 78.13.0., guix-commits, 2021/10/17
- 61/136: gnu: gst-plugins-base: Update to 1.18.5., guix-commits, 2021/10/17
- 69/136: gnu: tensorflow: Enable parallel build (at least partially)., guix-commits, 2021/10/17
- 90/136: gnu: glade3: Remove sitecustomize.py workaround., guix-commits, 2021/10/17
- 93/136: gnu: Build all Rust packages using the latest rustc., guix-commits, 2021/10/17
- 96/136: gnu: python-pypa-build: Update to 0.7.0., guix-commits, 2021/10/17
- 100/136: gnu: python-pytest-6: Fix version via setuptools-scm., guix-commits, 2021/10/17