[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
122/130: build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file
From: |
guix-commits |
Subject: |
122/130: build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file in a phase. |
Date: |
Sat, 16 Oct 2021 02:36:48 -0400 (EDT) |
apteryx pushed a commit to branch core-updates-frozen-batched-changes
in repository guix.
commit 28909b8c211d418ccf3edab3a202729517cb3045
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)))
- 87/130: gnu: gdb: Normalize indentation., (continued)
- 87/130: gnu: gdb: Normalize indentation., guix-commits, 2021/10/16
- 97/130: gnu: Add python-flit-core., guix-commits, 2021/10/16
- 96/130: gnu: python-pypa-build: Update to 0.7.0., guix-commits, 2021/10/16
- 101/130: gnu: python-pathlib2: Update to 2.3.6., guix-commits, 2021/10/16
- 100/130: gnu: python-pytest-6: Fix version via setuptools-scm., guix-commits, 2021/10/16
- 103/130: build: glib-or-gtk-build-system: Simplify the wrap-all-programs phase., guix-commits, 2021/10/16
- 109/130: gnu: libcloudproviders-minimal: Introduce minimal variant., guix-commits, 2021/10/16
- 112/130: gnu: inkscape: Remove the legacy 0.92 version., guix-commits, 2021/10/16
- 111/130: gnu: rest: Use libsoup-minimal., guix-commits, 2021/10/16
- 119/130: gnu: mit-krb5: Absorb 1.19.2 graft., guix-commits, 2021/10/16
- 122/130: build: glib-or-gtk: Generate the gdk-pixbuf-loaders cache file in a phase.,
guix-commits <=
- 117/130: gnu: cmake-bootstrap: Update to 3.21.3., guix-commits, 2021/10/16
- 26/130: gnu: gst-plugins-bad: Add missing inputs to enable more features., guix-commits, 2021/10/16
- 48/130: gnu: python-gst: Update to 1.19.2., guix-commits, 2021/10/16
- 51/130: gnu: pulseaudio: Update to 15.0., guix-commits, 2021/10/16
- 55/130: gnu: abseil-cpp: Update to 20210324.2., guix-commits, 2021/10/16
- 56/130: gnu: mozjs-78: Update to 78.13.0., guix-commits, 2021/10/16
- 60/130: gnu: gstreamer: Update to 1.18.5., guix-commits, 2021/10/16
- 62/130: gnu: gst-plugins-good: Update to 1.18.5., guix-commits, 2021/10/16
- 71/130: gnu: dbus-c++: Fix build., guix-commits, 2021/10/16
- 72/130: gnu: libnice: Update to 0.1.18-0.47a9633., guix-commits, 2021/10/16