summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-02-23 16:44:23 +0000
committerKarl Berry <karl@freefriends.org>2024-02-23 16:44:23 +0000
commitd60b32ec021c0ee2615e52e864ee6285b6512ff5 (patch)
tree4fed1aa4c1009bfa42d819623b8cc228b55df406
parent0bbec338ca5052207d77885687820bc6d19d73c2 (diff)
use our own XE_* variables instead of system FONTCONFIG_PATH and FC_CACHEDIR
git-svn-id: svn://tug.org/texlive/trunk@70088 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/kpathsea/ChangeLog6
-rw-r--r--Build/source/texk/kpathsea/texmf.cnf8
-rw-r--r--Master/texmf-dist/web2c/texmf.cnf8
-rw-r--r--Master/tlpkg/tlpostcode/xetex.pl76
4 files changed, 60 insertions, 38 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 452890b9efa..3bdb457c7bf 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,9 @@
+2024-02-23 Karl Berry <karl@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@freefriends.org>
* tests/kpsereadlink.test: create and use our own test file and
diff --git a/Build/source/texk/kpathsea/texmf.cnf b/Build/source/texk/kpathsea/texmf.cnf
index 83faca77dae..4cb01e45b15 100644
--- a/Build/source/texk/kpathsea/texmf.cnf
+++ b/Build/source/texk/kpathsea/texmf.cnf
@@ -455,12 +455,12 @@ MIMELIBDIR = $TEXMFROOT/etc
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//
diff --git a/Master/texmf-dist/web2c/texmf.cnf b/Master/texmf-dist/web2c/texmf.cnf
index 83faca77dae..4cb01e45b15 100644
--- a/Master/texmf-dist/web2c/texmf.cnf
+++ b/Master/texmf-dist/web2c/texmf.cnf
@@ -455,12 +455,12 @@ MIMELIBDIR = $TEXMFROOT/etc
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//
diff --git a/Master/tlpkg/tlpostcode/xetex.pl b/Master/tlpkg/tlpostcode/xetex.pl
index 7b691425175..80e70fb236e 100644
--- a/Master/tlpkg/tlpostcode/xetex.pl
+++ b/Master/tlpkg/tlpostcode/xetex.pl
@@ -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 @@ my $skip_gen; # not used for (un)install
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_remove {
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 @@ sub do_install {
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 @@ sub do_install {
$_ =~ 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 @@ sub do_install {
}
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.