[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] profiles: Add fonts-dir-file hook.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 2/3] profiles: Add fonts-dir-file hook. |
Date: |
Sat, 02 Jul 2016 16:34:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Alex Kost <address@hidden> skribis:
> * guix/profiles.scm (fonts-dir-file): New procedure.
> (%default-profile-hooks): Add it.
[...]
> +(define (fonts-dir-file manifest)
> + "Return a derivation that builds the @file{fonts.dir} and
> @file{fonts.scale}
> +files for the truetype fonts of the @var{manifest} entries."
> + (define mkfontscale
> + (module-ref (resolve-interface '(gnu packages xorg)) 'mkfontscale))
> +
> + (define mkfontdir
> + (module-ref (resolve-interface '(gnu packages xorg)) 'mkfontdir))
> +
> + (define build
> + #~(begin
> + (use-modules (srfi srfi-26)
> + (guix build utils)
> + (guix build union))
> + (let ((ttf-dirs (filter file-exists?
> + (map (cut string-append <>
> + "/share/fonts/truetype")
> + '#$(manifest-inputs manifest)))))
> + (mkdir #$output)
> + (if (null? ttf-dirs)
> + (exit #t)
> + (let* ((fonts-dir (string-append #$output "/share/fonts"))
> + (ttf-dir (string-append fonts-dir "/truetype"))
> + (mkfontscale (string-append #+mkfontscale
> + "/bin/mkfontscale"))
> + (mkfontdir (string-append #+mkfontdir
> + "/bin/mkfontdir")))
> + (mkdir-p fonts-dir)
> + (union-build ttf-dir ttf-dirs
> + #:log-port (%make-void-port "w"))
> + (with-directory-excursion ttf-dir
> + (exit (and (zero? (system* mkfontscale))
> + (zero? (system* mkfontdir))))))))))
> +
> + (gexp->derivation "fonts-dir-file" build
> + #:modules '((guix build utils)
> + (guix build union))
> + #:local-build? #t
> + #:substitutable? #f))
A potential problem with this hook is that it pulls mkfontscale and
mkfontdir regardless of whether they are needed; I can’t really think of
a way to avoid it though.
Also, how does it relate to this:
commit bf9655f57d2442d56661594b80f6d0031ca0ae73
Author: Eric Bavier <address@hidden>
Date: Mon Oct 19 06:44:23 2015 -0500
font-alias: Install dummy fonts.dir files.
* gnu/packages/xorg.scm (font-alias)[arguments]: New 'install-fonts-dir'
phase.
?
Thanks,
Ludo’.
- [PATCH 0/3] Generate "<profile>/share/fonts/truetype/fonts.dir" file, Alex Kost, 2016/07/01
- [PATCH 1/3] gnu: mkfontdir: Do not propagate 'mkfontscale'., Alex Kost, 2016/07/01
- [PATCH 2/3] profiles: Add fonts-dir-file hook., Alex Kost, 2016/07/01
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook.,
Ludovic Courtès <=
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook., Alex Kost, 2016/07/02
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook., Ludovic Courtès, 2016/07/05
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook., Alex Kost, 2016/07/06
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook., Alex Kost, 2016/07/22
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook., Ludovic Courtès, 2016/07/24
- Re: [PATCH 2/3] profiles: Add fonts-dir-file hook., Alex Kost, 2016/07/25
[PATCH 3/3] doc: Describe how to make X server find TrueType fonts., Alex Kost, 2016/07/01