texlive[70088] use our own XE_* variables instead of system

commits+karl at tug.org commits+karl at tug.org
Fri Feb 23 17:44:25 CET 2024


Revision: 70088
          https://tug.org/svn/texlive?view=revision&revision=70088
Author:   karl
Date:     2024-02-23 17:44:23 +0100 (Fri, 23 Feb 2024)
Log Message:
-----------
use our own XE_* variables instead of system FONTCONFIG_PATH and FC_CACHEDIR

Modified Paths:
--------------
    trunk/Build/source/texk/kpathsea/ChangeLog
    trunk/Build/source/texk/kpathsea/texmf.cnf
    trunk/Master/texmf-dist/web2c/texmf.cnf
    trunk/Master/tlpkg/tlpostcode/xetex.pl

Property Changed:
----------------
    trunk/Master/tlpkg/tlpostcode/xetex.pl

Modified: trunk/Build/source/texk/kpathsea/ChangeLog
===================================================================
--- trunk/Build/source/texk/kpathsea/ChangeLog	2024-02-23 02:24:15 UTC (rev 70087)
+++ trunk/Build/source/texk/kpathsea/ChangeLog	2024-02-23 16:44:23 UTC (rev 70088)
@@ -1,3 +1,9 @@
+2024-02-23  Karl Berry  <karl at freefriends.org>
+
+	* texmf.cnf (XE_FONTCONFIG_PATH, XE_FC_CACHEDIR): rename from
+	FONTCONFIG_PATH resp. FC_CACHEDIR so we don't collide with
+	system directories specified by those paths, such as /etc/fonts.
+
 2024-02-22  Karl Berry  <karl at freefriends.org>
 
 	* tests/kpsereadlink.test: create and use our own test file and

Modified: trunk/Build/source/texk/kpathsea/texmf.cnf
===================================================================
--- trunk/Build/source/texk/kpathsea/texmf.cnf	2024-02-23 02:24:15 UTC (rev 70087)
+++ trunk/Build/source/texk/kpathsea/texmf.cnf	2024-02-23 16:44:23 UTC (rev 70088)
@@ -455,12 +455,12 @@
 MAILCAPLIBDIR = $TEXMFROOT/etc
 
 % Default settings for the fontconfig library as used by the Windows
-% versions of xetex/xdvipdfmx.  Not used by xetex on Unixish systems.
-% ConTeXT MkIV (all platforms) also use these values.
+% versions of xetex/xdvipdfmx.  Not used by xetex itself on Unixish systems,
+% but the postaction for xetex uses all of these on all systems.
 % 
 FONTCONFIG_FILE = fonts.conf
-FONTCONFIG_PATH = $TEXMFSYSVAR/fonts/conf
-FC_CACHEDIR = $TEXMFSYSVAR/fonts/cache
+XE_FONTCONFIG_PATH = $TEXMFSYSVAR/fonts/conf
+XE_FC_CACHEDIR = $TEXMFSYSVAR/fonts/cache
 
 % TeX documentation and source files, for use with texdoc and kpsewhich.
 TEXDOCS = $TEXMF/doc//

Modified: trunk/Master/texmf-dist/web2c/texmf.cnf
===================================================================
--- trunk/Master/texmf-dist/web2c/texmf.cnf	2024-02-23 02:24:15 UTC (rev 70087)
+++ trunk/Master/texmf-dist/web2c/texmf.cnf	2024-02-23 16:44:23 UTC (rev 70088)
@@ -455,12 +455,12 @@
 MAILCAPLIBDIR = $TEXMFROOT/etc
 
 % Default settings for the fontconfig library as used by the Windows
-% versions of xetex/xdvipdfmx.  Not used by xetex on Unixish systems.
-% ConTeXT MkIV (all platforms) also use these values.
+% versions of xetex/xdvipdfmx.  Not used by xetex itself on Unixish systems,
+% but the postaction for xetex uses all of these on all systems.
 % 
 FONTCONFIG_FILE = fonts.conf
-FONTCONFIG_PATH = $TEXMFSYSVAR/fonts/conf
-FC_CACHEDIR = $TEXMFSYSVAR/fonts/cache
+XE_FONTCONFIG_PATH = $TEXMFSYSVAR/fonts/conf
+XE_FC_CACHEDIR = $TEXMFSYSVAR/fonts/cache
 
 % TeX documentation and source files, for use with texdoc and kpsewhich.
 TEXDOCS = $TEXMF/doc//

Modified: trunk/Master/tlpkg/tlpostcode/xetex.pl
===================================================================
--- trunk/Master/tlpkg/tlpostcode/xetex.pl	2024-02-23 02:24:15 UTC (rev 70087)
+++ trunk/Master/tlpkg/tlpostcode/xetex.pl	2024-02-23 16:44:23 UTC (rev 70088)
@@ -1,12 +1,12 @@
 # $Id$
 # post action for xetex to handle system font stuff.
-# Copyright 2008, 2009, 2011 Norbert Preining
+# Copyright 2008-2024 Norbert Preining
 # This file is licensed under the GNU General Public License version 2
 # or any later version.
 #
-# We create the fontconfig configuration file.  On Windows,
+# We create the fontconfig configuration file with all TL fonts.  On Windows,
 # we also run fc-cache to make the fonts available.
-# http://www.tug.org/texlive/doc/texlive-en/texlive-en.html#xetexfontconfig
+# https://tug.org/texlive/doc/texlive-en/texlive-en.html#xetexfontconfig
 
 my $texdir;
 my $mode;
@@ -14,8 +14,8 @@
 
 BEGIN {
   $^W = 1;
-  $mode = lc($ARGV[0]);
-  $texdir = $ARGV[1];
+  $mode = lc(@ARGV ? $ARGV[0] : "no-argv0??");
+  $texdir = $ARGV[1] || "no-argv1??";
   $skip_gen = (defined $ARGV[2]) ? 1 : 0; # not used with normal installs
   # make Perl find our packages first:
   unshift (@INC, "$texdir/tlpkg");
@@ -36,14 +36,24 @@
 
 sub do_install {
   # fontconfig-related stuff.
-  chomp( my $fcache = `kpsewhich -var-value=FC_CACHEDIR` ) ;
-  chomp( my $fconf = `kpsewhich -var-value=FONTCONFIG_PATH` ) ;
+  # use these TL-specific variables, supported by TL's XeTeX on Windows,
+  # so we don't touch a true system directory such as /etc/fonts on Unix,
+  # as we would do if we used FC_CACHEDIR and FONTCONFIG_PATH.
+  chomp( my $fcachedir = `kpsewhich -var-value=XE_FC_CACHEDIR` ) ;
+  chomp( my $fconfdir = `kpsewhich -var-value=XE_FONTCONFIG_PATH` ) ;
+  chomp( my $fconffile = `kpsewhich -var-value=FONTCONFIG_FILE` ) ;
   if (-r "$texdir/bin/windows/xetex.exe") {
-    # we have installed w32, so put it into texmfsysvar.
-    mkdirhier($fcache);
-    mkdirhier($fconf);
-    TeXLive::TLUtils::rmtree($fcache);
-    TeXLive::TLUtils::rmtree($fconf);
+    # Windows binaries are installed, so copy the tlpostcode/xetex/*
+    # subdirs into the TL dirs above.
+    # 
+    # We (weirdly) create the directories and then remove them to ensure
+    # that any intervening subdirs are created, but the actual dir we
+    # copy into is non-existent.
+    mkdirhier($fcachedir);
+    mkdirhier($fconfdir);
+    TeXLive::TLUtils::rmtree($fcachedir);
+    TeXLive::TLUtils::rmtree($fconfdir);
+    
     my @cpycmd = ();
     if (wndws()) {
       push @cpycmd, "xcopy", "/e", "/i", "/q", "/y";
@@ -55,15 +65,15 @@
     my $postxetex = "$texdir/tlpkg/tlpostcode/xetex";
     system(@cpycmd,
          (wndws() ? conv_to_w32_path("$postxetex/conf") : "$postxetex/conf"),
-         (wndws() ? conv_to_w32_path($fconf) : $fconf));
+         (wndws() ? conv_to_w32_path($fconfdir) : $fconfdir));
     system(@cpycmd,
          (wndws() ? conv_to_w32_path("$postxetex/cache") : "$postxetex/cache"),
-         (wndws() ? conv_to_w32_path($fcache) : $fcache));
+         (wndws() ? conv_to_w32_path($fcachedir) : $fcachedir));
  
-    if (open(FONTSCONF, "<$texdir/tlpkg/tlpostcode/xetex/conf/fonts.conf")) {
+    if (open(FONTSCONF, "<$postxetex/conf/fonts.conf")) {
       my @lines = <FONTSCONF>;
       close(FONTSCONF);
-      if (open(FONTSCONF, ">$fconf/fonts.conf")) {
+      if (open(FONTSCONF, ">$fconfdir/$fconffile")) {
         my $winfontdir;
         if (wndws()) {
           $winfontdir = $ENV{'SystemRoot'}.'/fonts';
@@ -74,24 +84,30 @@
           $_ =~ s!c:/windows/fonts!$winfontdir! if wndws();
           print FONTSCONF;
         }
-        close(FONTSCONF);
+        close(FONTSCONF)
+        || tlwarn("close($postxetex/conf/fonts.conf) failed: $!");
       } else {
-        warn("open(>$fconf/fonts.conf) failed: $!");
+        tlwarn("open(>$fconfdir/$fconffile) failed: $!");
       }
     } else {
-      warn("open($texdir/tlpkg/tlpostcode/xetex/conf/fonts.conf) failed: $!");
+      tlwarn("open($postxetex/conf/fonts.conf) failed: $!");
     }
   }
-  if (wndws() && !$skip_gen) {
-    # call fc-cache but only when we install on w32!
-    info("Running fc-cache -v -r\n");
-    log( `fc-cache -v -r 2>&1` );  # run it, log output
 
+  if (wndws()) {
+    if (!$skip_gen) {
+      # call fc-cache -- but only if we're actually running under Windows,
+      # not merely installing its binaries.
+      info("Running fc-cache -v -r\n");
+      log( `fc-cache -v -r 2>&1` );  # run it, log output
+    }
+
   } else {
-    # non-Windows: create texlive-fontconfig.conf file in $texmfsysvar.
-    mkdirhier("$fconf/conf");
-    if (!open(FONTSCONF, ">$fconf/texlive-fontconfig.conf")) {
-      warn("open(>$fconf/texlive-fontconfig.conf): $!");
+    # non-Windows: merely create a texlive-fontconfig.conf file,
+    # in (the TL directory) XE_FONTCONFIG_PATH.
+    mkdirhier("$fconfdir");
+    if (!open(FONTSCONF, ">$fconfdir/texlive-fontconfig.conf")) {
+      tlwarn("open(>$fconfdir/texlive-fontconfig.conf) failed: $!");
     } else {
       print FONTSCONF '<?xml version="1.0"?>
 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
@@ -102,15 +118,15 @@
       }
       print FONTSCONF "</fontconfig>\n";
       close(FONTSCONF)
-      || tlwarn("close($fconf/texlive-fontconfig.conf) failed: $!");
+      || tlwarn("close($fconfdir/texlive-fontconfig.conf) failed: $!");
     }
 
-    # cygwin specific warning
+    # cygwin-specific warning
     # we don't have our platform name available ...
     chomp(my $un = `uname`);
     if ($un =~ m/cygwin/i) {
       if (! -r "/usr/bin/cygfontconfig-1.dll") {
-        printf STDERR <<CYGWIN_XETEX;
+        print STDERR <<CYGWIN_XETEX;
 
 XeTeX on Cygwin requires fontconfig.
 Please run cygwin's setup program and install the fontconfig package.


Property changes on: trunk/Master/tlpkg/tlpostcode/xetex.pl
___________________________________________________________________
Modified: svn:keywords
## -1 +1 ##
-Date Author Id
\ No newline at end of property
+Date Author Id Revision
\ No newline at end of property


More information about the tex-live-commits mailing list.