1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# $Id$
# post action for xetex
# Copyright 2008, 2009 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
# TODO TODO TODO
# only on install (also on update???) we should copy all the fontconf files
# from tlpkg/installer/fontconfig (?? final position ??) to TEXMFSYSVAR for
# win32, and unix create a fonts.conf file and tell users to install it
# either as .fonts.conf or drop it into /etc/fonts/conf.d/texlive.conf or so
my $texdir;
my $mode;
BEGIN {
$^W = 1;
$mode = $ARGV[0];
$texdir = $ARGV[1];
# make Perl find our packages first:
unshift (@INC, "$texdir/tlpkg");
}
use TeXLive::TLUtils qw(win32 mkdirhier conv_to_w32_path log info);
#
# bin-installs font-config related stuff
my $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`;
if (-r "$texdir/bin/win32/conf/fonts.conf") {
# we have installed w32, so put it into texmfsysvar
mkdirhier("$texmfsysvar/fonts");
TeXLive::TLUtils::rmtree("$texmfsysvar/fonts/conf");
TeXLive::TLUtils::rmtree("$texmfsysvar/fonts/cache");
my @cpycmd;
if (win32()) {
push @cpycmd, "xcopy", "/e", "/i", "/q", "/y";
} else {
push @cpycmd, "cp", "-R";
}
system(@cpycmd,
(win32() ? conv_to_w32_path("$texdir/bin/win32/conf") :
"$texdir/bin/win32/conf"),
(win32() ? conv_to_w32_path("$texmfsysvar/fonts/conf") :
"$texmfsysvar/fonts/conf"));
system(@cpycmd,
(win32() ? conv_to_w32_path("$texdir/bin/win32/cache") :
"$texdir/bin/win32/cache"),
(win32() ? conv_to_w32_path("$texmfsysvar/fonts/cache") :
"$texmfsysvar/fonts/cache"));
if (open(FONTSCONF, "<$texdir/bin/win32/conf/fonts.conf")) {
my @lines = <FONTSCONF>;
close(FONTSCONF);
if (open(FONTSCONF, ">$texmfsysvar/fonts/conf/fonts.conf")) {
my $winfontdir;
if (win32()) {
$winfontdir = $ENV{'SystemRoot'}.'/fonts';
$winfontdir =~ s!\\!/!g;
}
foreach (@lines) {
$_ =~ s!c:/Program Files/texlive/$TeXLive::TLConfig::ReleaseYear!$texdir!;
$_ =~ s!c:/windows/fonts!$winfontdir! if win32();
print FONTSCONF;
}
close(FONTSCONF);
} else {
warn("Cannot open $texmfsysvar/fonts/conf/fonts.conf for writing\n");
}
} else {
warn("Cannot open $texdir/bin/win32/conf/fonts.conf\n");
}
}
# call fc-cache but only when we install on w32!
if (win32()) {
info("Running fc-cache -v -r\n");
log(`fc-cache -v -r 2>&1`);
#system("fc-cache","-v", "-r");
} else {
# cygwin specific warning
# we don't have platform available ...
chomp(my $un = `uname`);
if ($un =~ m/cygwin/i) {
if (! -r "/usr/bin/cygfontconfig-1.dll") {
printf STDERR "\nXeTeX on Cygwin requires fontconfig.\nPlease run cygwin's setup program and install the fontconfig package.\n";
}
}
}
### Local Variables:
### perl-indent-level: 2
### tab-width: 2
### indent-tabs-mode: nil
### End:
# vim:set tabstop=2 expandtab: #
|