From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 2/3] profiles: Add fonts-dir-file hook. Date: Sat, 02 Jul 2016 16:34:44 +0200 Message-ID: <87fursf6rf.fsf@gnu.org> References: <20160701092730.2265-1-alezost@gmail.com> <20160701092730.2265-3-alezost@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJM0U-0001dr-9k for guix-devel@gnu.org; Sat, 02 Jul 2016 10:34:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJM0P-0005IG-8q for guix-devel@gnu.org; Sat, 02 Jul 2016 10:34:53 -0400 In-Reply-To: <20160701092730.2265-3-alezost@gmail.com> (Alex Kost's message of "Fri, 1 Jul 2016 12:27:29 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Alex Kost Cc: guix-devel@gnu.org Alex Kost 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=E2=80=99t really thi= nk of a way to avoid it though. Also, how does it relate to this: commit bf9655f57d2442d56661594b80f6d0031ca0ae73 Author: Eric Bavier 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-d= ir' phase. ? Thanks, Ludo=E2=80=99.