From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIZP3-0000Dz-8f for guix-patches@gnu.org; Tue, 15 May 2018 08:50:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIZP0-00076H-5k for guix-patches@gnu.org; Tue, 15 May 2018 08:50:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIZP0-00075u-0h for guix-patches@gnu.org; Tue, 15 May 2018 08:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fIZOz-0000mI-Mz for guix-patches@gnu.org; Tue, 15 May 2018 08:50:01 -0400 Subject: [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled". Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIZOQ-00007J-Uv for guix-patches@gnu.org; Tue, 15 May 2018 08:49:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIZON-00060D-MF for guix-patches@gnu.org; Tue, 15 May 2018 08:49:27 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:53744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fIZON-0005wq-E0 for guix-patches@gnu.org; Tue, 15 May 2018 08:49:23 -0400 From: Danny Milosavljevic Date: Tue, 15 May 2018 14:49:17 +0200 Message-Id: <20180515124917.1751-1-dannym@scratchpost.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31462@debbugs.gnu.org * guix/profiles.scm (glib-schemas): New procedure. (%default-profile-hooks): Add it. --- guix/profiles.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/guix/profiles.scm b/guix/profiles.scm index dca247976..300324362 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -843,6 +843,57 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx." #:local-build? #t #:substitutable? #f)) +(define (glib-schemas manifest) + "Return a derivation that unions all schemas from manifest entries and +creates the Glib 'gschemas.compiled' file." + (define glib ; lazy reference + (module-ref (resolve-interface '(gnu packages glib)) 'glib)) + + (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib")) + ;; XXX: Can't use glib-compile-schemas corresponding + ;; to the glib referenced by 'manifest'. Because + ;; '%glib' can be either a package or store path, and + ;; there's no way to get the "bin" output for the later. + (glib-compile-schemas + -> #~(string-append #+glib:bin + "/bin/glib-compile-schemas"))) + + (define build + (with-imported-modules '((guix build utils) + (guix build union) + (guix build profiles) + (guix search-paths) + (guix records)) + #~(begin + (use-modules (guix build utils) + (guix build union) + (guix build profiles) + (srfi srfi-26)) + + (let* ((destdir (string-append #$output "/share/glib-2.0/schemas")) + (schemadirs (filter file-exists? + (map (cut string-append <> "/share/glib-2.0/schemas") + '#$(manifest-inputs manifest))))) + + ;; Union all the schemas. + (mkdir-p (string-append #$output "/share/glib-2.0")) + (union-build destdir schemadirs + #:log-port (%make-void-port "w")) + + (let ((dir destdir)) + (when (file-is-directory? dir) + (ensure-writable-directory dir) + (invoke #+glib-compile-schemas + (string-append "--targetdir=" dir) + dir))))))) + + ;; Don't run the hook when there's nothing to do. + (if %glib + (gexp->derivation "glib-schemas" build + #:local-build? #t + #:substitutable? #f) + (return #f)))) + (define (gtk-icon-themes manifest) "Return a derivation that unions all icon themes from manifest entries and creates the GTK+ 'icon-theme.cache' file for each theme." @@ -1198,6 +1249,7 @@ the entries in MANIFEST." fonts-dir-file ghc-package-cache-file ca-certificate-bundle + glib-schemas gtk-icon-themes gtk-im-modules xdg-desktop-database