unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: iyzsong@member.fsf.org (宋文武)
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 2/2] profiles: Build GTK+ input module cache.
Date: Sun, 25 Sep 2016 19:25:44 +0800	[thread overview]
Message-ID: <87lgygusp3.fsf@member.fsf.org> (raw)
In-Reply-To: <20160922202827.22039-2-rekado@elephly.net> (Ricardo Wurmus's message of "Thu, 22 Sep 2016 22:28:27 +0200")

Ricardo Wurmus <rekado@elephly.net> writes:

> * guix/profiles.scm (gtk-im-modules): New procedure.
> (%default-profile-hooks): Add it.
> ---
>  guix/profiles.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index 78deeb7..1a522ae 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -723,6 +723,68 @@ creates the GTK+ 'icon-theme.cache' file for each theme."
>                            #:substitutable? #f)
>          (return #f))))
>  
> +(define (gtk-im-modules manifest)
> +  "Return a derivation that builds the cache files for input method modules
> +for both major versions of GTK+."
> +
> +  (mlet %store-monad ((gtk+   (manifest-lookup-package manifest "gtk+" "3"))
> +                      (gtk+-2 (manifest-lookup-package manifest "gtk+" "2")))
> +
> +    (define (build gtk gtk-version)
> +      (let ((major (string-take gtk-version 1)))
> +        (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)
> +                           (ice-9 popen)
> +                           (srfi srfi-26))
> +
> +              (let* ((prefix  (string-append "/lib/gtk-" #$major ".0/"
> +                                             #$gtk-version))
> +                     (query   (string-append #$gtk "/bin/gtk-query-immodules-"
> +                                             #$major ".0"))
> +                     (destdir (string-append #$output prefix))
> +                     (moddirs (cons (string-append #$gtk prefix "/immodules")
> +                                    (filter file-exists?
> +                                            (map (cut string-append <> prefix "/immodules")
> +                                                 '#$(manifest-inputs manifest))))))
> +
> +                ;; Union all the gtk immodules directories.
> +                (mkdir-p (string-append #$output "/lib/gtk-" #$major ".0"))
> +                (union-build destdir moddirs #:log-port
> (%make-void-port "w"))

I think there is no need to run `union-build'.  Other hooks use it
because they (eg: update-icon-cache, update-mime-databes) require input
and output files in a single directory.

> +
> +                ;; Generate a new 'immodules.cache' file.
> +                (let ((pipe    (apply open-pipe*
> +                                      OPEN_READ query
> +                                      (map readlink (find-files
> destdir "\\.so$"))))
and use 'moddirs' here should work.

  reply	other threads:[~2016-09-25 11:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 20:28 [PATCH 1/2] profiles: manifest-lookup-package: Optionally match version prefix Ricardo Wurmus
2016-09-22 20:28 ` [PATCH 2/2] profiles: Build GTK+ input module cache Ricardo Wurmus
2016-09-25 11:25   ` 宋文武 [this message]
2016-09-26  5:56     ` Ricardo Wurmus
2016-09-26 11:04   ` Ludovic Courtès
2016-10-30  7:05     ` Ricardo Wurmus
2016-09-26 10:41 ` [PATCH 1/2] profiles: manifest-lookup-package: Optionally match version prefix Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgygusp3.fsf@member.fsf.org \
    --to=iyzsong@member.fsf.org \
    --cc=guix-devel@gnu.org \
    --cc=rekado@elephly.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).