summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Strzelczyk <piotr@eps.gda.pl>2009-07-23 21:31:54 +0000
committerPiotr Strzelczyk <piotr@eps.gda.pl>2009-07-23 21:31:54 +0000
commit3f336d66b0cbda22155bc21add0f24e6a47a35ea (patch)
tree29455a1f8a3f42432b106046b36e9373a4a14b34
parent7cdfc67818cda29db14cc1f6994dfbe1946f3438 (diff)
do nothing in postaction code on xetex removal
git-svn-id: svn://tug.org/texlive/trunk@14412 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/tlpostcode/xetex.pl150
1 files changed, 81 insertions, 69 deletions
diff --git a/Master/tlpkg/tlpostcode/xetex.pl b/Master/tlpkg/tlpostcode/xetex.pl
index 4a2d8b72611..626dbc8158e 100644
--- a/Master/tlpkg/tlpostcode/xetex.pl
+++ b/Master/tlpkg/tlpostcode/xetex.pl
@@ -16,87 +16,99 @@ my $mode;
BEGIN {
$^W = 1;
- $mode = $ARGV[0];
+ $mode = lc($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
-chomp( my $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR` ) ;
-if (-r "$texdir/bin/win32/xetex.exe") {
- # 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/tlpkg/tlpostcode/xetex/conf") :
- "$texdir/tlpkg/tlpostcode/xetex/conf"),
- (win32() ? conv_to_w32_path("$texmfsysvar/fonts/conf") :
- "$texmfsysvar/fonts/conf"));
- system(@cpycmd,
- (win32() ? conv_to_w32_path("$texdir/tlpkg/tlpostcode/xetex/cache") :
- "$texdir/tlpkg/tlpostcode/xetex/cache"),
- (win32() ? conv_to_w32_path("$texmfsysvar/fonts/cache") :
- "$texmfsysvar/fonts/cache"));
- if (open(FONTSCONF, "<$texdir/tlpkg/tlpostcode/xetex/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/YYYY!$texdir!;
- $_ =~ s!c:/windows/fonts!$winfontdir! if win32();
- print FONTSCONF;
- }
+if ($mode eq 'install') {
+ return do_install();
+} elsif ($mode eq 'remove') {
+ return do_remove();
+} else {
+ die("unknown mode: $mode\n");
+}
+
+sub do_remove {
+ # do nothing
+}
+
+sub do_install {
+ # bin-installs font-config related stuff
+ chomp( my $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR` ) ;
+ if (-r "$texdir/bin/win32/xetex.exe") {
+ # 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/tlpkg/tlpostcode/xetex/conf") :
+ "$texdir/tlpkg/tlpostcode/xetex/conf"),
+ (win32() ? conv_to_w32_path("$texmfsysvar/fonts/conf") :
+ "$texmfsysvar/fonts/conf"));
+ system(@cpycmd,
+ (win32() ? conv_to_w32_path("$texdir/tlpkg/tlpostcode/xetex/cache") :
+ "$texdir/tlpkg/tlpostcode/xetex/cache"),
+ (win32() ? conv_to_w32_path("$texmfsysvar/fonts/cache") :
+ "$texmfsysvar/fonts/cache"));
+ if (open(FONTSCONF, "<$texdir/tlpkg/tlpostcode/xetex/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/YYYY!$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 $texmfsysvar/fonts/conf/fonts.conf for writing\n");
+ warn("Cannot open $texdir/tlpkg/tlpostcode/xetex/conf/fonts.conf\n");
}
- } else {
- warn("Cannot open $texdir/tlpkg/tlpostcode/xetex/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 {
- # create a texlive-fontconfig.conf file in $texmfsysvar
- mkdirhier("$texmfsysvar/fonts/conf");
- if (!open(FONTSCONF, ">$texmfsysvar/fonts/conf/texlive-fontconfig.conf")) {
- warn("Cannot open $texmfsysvar/fonts/conf/texlive-fontconfig.conf for writing\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 {
- print FONTSCONF '<?xml version="1.0"?>
-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
-<fontconfig>
-';
- for my $t (qw/opentype truetype type1/) {
- print FONTSCONF "<dir>$texdir/texmf-dist/fonts/$t</dir>\n";
+ # create a texlive-fontconfig.conf file in $texmfsysvar
+ mkdirhier("$texmfsysvar/fonts/conf");
+ if (!open(FONTSCONF, ">$texmfsysvar/fonts/conf/texlive-fontconfig.conf")) {
+ warn("Cannot open $texmfsysvar/fonts/conf/texlive-fontconfig.conf for writing\n");
+ } else {
+ print FONTSCONF '<?xml version="1.0"?>
+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+ <fontconfig>
+ ';
+ for my $t (qw/opentype truetype type1/) {
+ print FONTSCONF "<dir>$texdir/texmf-dist/fonts/$t</dir>\n";
+ }
+ print FONTSCONF "</fontconfig>\n";
+ close(FONTSCONF) || tlwarn("Cannot close filehandle for texmfsysvar/fonts/conf/texlive-fontconfig.conf\n");
}
- print FONTSCONF "</fontconfig>\n";
- close(FONTSCONF) || tlwarn("Cannot close filehandle for texmfsysvar/fonts/conf/texlive-fontconfig.conf\n");
- }
- # 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";
+ # 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";
+ }
}
}
}