From patchwork Fri Feb 14 17:17:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ivan Kozlov X-Patchwork-Id: 20252 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CE0D827BBEA; Fri, 14 Feb 2020 17:18:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 60A1427BBE4 for ; Fri, 14 Feb 2020 17:18:21 +0000 (GMT) Received: from localhost ([::1]:42042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2ebc-0001uC-U7 for patchwork@mira.cbaines.net; Fri, 14 Feb 2020 12:18:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49255) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2ebL-0001OJ-A1 for guix-patches@gnu.org; Fri, 14 Feb 2020 12:18:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2ebK-00082k-55 for guix-patches@gnu.org; Fri, 14 Feb 2020 12:18:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2ebK-00082c-1y for guix-patches@gnu.org; Fri, 14 Feb 2020 12:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j2ebJ-0005Q3-TK for guix-patches@gnu.org; Fri, 14 Feb 2020 12:18:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39602] Generate font catalogues for the X server Resent-From: Ivan Kozlov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 14 Feb 2020 17:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39602 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 39602@debbugs.gnu.org X-Debbugs-Original-To: guix-patches Received: via spool by submit@debbugs.gnu.org id=B.158170063620758 (code B ref -1); Fri, 14 Feb 2020 17:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 14 Feb 2020 17:17:16 +0000 Received: from localhost ([127.0.0.1]:34634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2eaa-0005Ok-Dx for submit@debbugs.gnu.org; Fri, 14 Feb 2020 12:17:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:42817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j2eaY-0005Oc-55 for submit@debbugs.gnu.org; Fri, 14 Feb 2020 12:17:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49027) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2eaW-0000Tu-Jy for guix-patches@gnu.org; Fri, 14 Feb 2020 12:17:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2eaT-0006tf-Gr for guix-patches@gnu.org; Fri, 14 Feb 2020 12:17:11 -0500 Received: from forward101j.mail.yandex.net ([5.45.198.241]:60538) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j2eaS-0006nW-OE for guix-patches@gnu.org; Fri, 14 Feb 2020 12:17:09 -0500 Received: from mxback25o.mail.yandex.net (mxback25o.mail.yandex.net [37.140.190.105]) by forward101j.mail.yandex.net (Yandex) with ESMTP id D19E01BE1890 for ; Fri, 14 Feb 2020 20:17:05 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback25o.mail.yandex.net (mxback/Yandex) with ESMTP id tSxXywOvDK-H5Emtv9N; Fri, 14 Feb 2020 20:17:05 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1581700625; bh=x2P37CPtuu6kyVaa9H4pGBkmbDxyiHa4EqgWq9kuFik=; h=Message-Id:Date:Subject:To:From; b=Efzrg+Aq2Sj/YI3ZZNkxs1QCjGGFssm5f61AnUIeSKlBYXyDZvuAoNALPWZLHf5O+ EnlJJNXhKswm4PY0bSvwl5enu+zLZcr4gyKzyP32sSOLS4bPuVkMa0z61jOvbdPbFR gLzfmvVuH9+rHyEa2lP6mA0g7DaGY5Z9JO6dC7VQ= Authentication-Results: mxback25o.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by iva4-64850291ca1c.qloud-c.yandex.net with HTTP; Fri, 14 Feb 2020 20:17:05 +0300 From: Ivan Kozlov MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Fri, 14 Feb 2020 20:17:05 +0300 Message-Id: <2060961581700625@iva4-64850291ca1c.qloud-c.yandex.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Actually, I am sending this as a patch. This should produce a "share/fontpath.d" directory in the profile which is a font catalogue as described in Xserver(1). Then the X server font path can be set to include this catalogue and it will find the installed fonts. This concerns all legacy X11 applications using the core fonts system, and most importantly xterm. The hook ‘fonts-dir-file’ was originally added for this purpose as the comments can tell; you would include e. g. "share/fonts/X11/misc" from the profile in the font path, which is a union directory with symbolic links to fonts that want to install there and a fonts.dir file describing all of them. This has not been working for ages, since the X.org server stopped following symbolic links to font files for security reasons. It should be removed. --- a/guix/profiles.scm 2020-01-01 13:03:15.579056969 +0300 +++ b/guix/profiles.scm 2020-02-14 19:52:51.979902836 +0300 @@ -1293,6 +1293,37 @@ `((type . profile-hook) (hook . fonts-dir)))) +(define (fontpath-file manifest) + (define build + #~(begin + (use-modules (srfi srfi-1) (srfi srfi-26) (guix build utils)) + (let* ((top-font-dirs (filter file-exists? + (map (cut string-append <> + "/share/fonts") + '#$(manifest-inputs manifest)))) + (font-dirs (append-map (lambda (dir) + (find-files dir + (lambda (file stat) + (and (eq? 'directory (stat:type stat)) + (file-exists? (string-append file "/fonts.dir")))) + #:directories? #t)) top-font-dirs)) + (fonpath-dir (string-append #$output "/share/fontpath.d"))) + (mkdir-p fontpath-dir) + (chdir fontpath-dir) + (for-each (lambda (dir pri) + (symlink dir (string-append (basename dir) ":pri=" (number->string pri)))) + font-dirs + (iota (length font-dirs) 1))))) + (gexp->derivation "fontpath.d" build + #:modules '((guix build utils) + (srfi srfi-1) + (srfi srfi-26)) + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . fontpath-dir)))) + (define (manual-database manifest) "Return a derivation that builds the manual page database (\"mandb\") for the entries in MANIFEST." @@ -1430,6 +1461,7 @@ (list info-dir-file manual-database fonts-dir-file + fontpath-file ghc-package-cache-file ca-certificate-bundle glib-schemas