summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPackageConfigurations.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPackageConfigurations.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPackageConfigurations.pm157
1 files changed, 157 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLPackageConfigurations.pm b/Master/tlpkg/TeXLive/TLPackageConfigurations.pm
new file mode 100644
index 00000000000..6b6903b5a56
--- /dev/null
+++ b/Master/tlpkg/TeXLive/TLPackageConfigurations.pm
@@ -0,0 +1,157 @@
+# $Id$
+# TeXLive::TLPackageConfigurations.pm
+# Copyright 2008 Norbert Preining
+# This file is licensed under the GNU General Public License version 2
+# or any later version.
+
+package TeXLive::TLPackageConfigurations;
+
+BEGIN {
+ use Exporter ();
+ use vars qw( @ISA @EXPORT_OK @EXPORT );
+ @ISA = qw(Exporter);
+ @EXPORT_OK = qw(
+ %PackageConfigInstall
+ %PackageConfigRemove
+ );
+ @EXPORT = @EXPORT_OK;
+}
+
+use TeXLive::TLUtils qw(win32 mkdirhier copy conv_to_w32_path log debug info
+ touch tlwarn);
+use TeXLive::TLWinGoo;
+use TeXLive::TLConfig;
+
+my $mainmenu = $TeXLive::TLConfig::WindowsMainMenuName;
+
+our %PackageConfigInstall;
+our %PackageConfigRemove;
+
+# xetex
+#
+sub do_install_xetex {
+ my ($texdir, $texdirw, $texmfsysvar) = @_;
+ #
+ # bin-installs font-config related stuff
+ #
+ # new version according to Staszek
+ if (!defined($texmfsysvar)) {
+ $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($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;
+ #mkdirhier("$texmfsysvar/fonts/cache");
+
+ # fc-cache breaks often on w32 in some strange way
+ # there are claims that touching a font file in $winfontdir
+ # would solve that problem. So lets touch some of them
+ if (opendir (WINFONT, $winfontdir)) {
+ my @dirents = readdir (WINFONT);
+ closedir (WINFONT) || warn "closedir($winfontdir) failed: $!";
+ # do not actually touch anything by now, maybe already the
+ # opendir is enough ...
+
+ # for my $dirent (@dirents) {
+ # if ($dirent =~ m/\.(ttf|otf)$/i) {
+ # touch("$winfontdir/$dirent");
+ # tlwarn("touching $dirent in $winfontdir to make fc-cache work\n");
+ # # one file touched should be enough
+ # last;
+ # }
+ # }
+ }
+ }
+ foreach (@lines) {
+ $_ =~ s!c:/Program Files/texlive/$TeXLive::TLConfig::ReleaseYear!$texdir!;
+ $_ =~ s!c:/windows/fonts!$winfontdir! if win32();
+ # hack around fc-cache problem in from_dvd case:
+ #if (win32() and (uc($texdir) ne uc($texdirw)) and
+ # ($_ =~ m!^<dir>.*texmf-dist.*</dir>!)) { $_ = '<!-- '.$_.' -->'; }
+ 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");
+ }
+}
+$PackageConfigInstall{"xetex"} = \&do_install_xetex;
+
+
+1;
+
+
+=head1 NAME
+
+C<TeXLive::TLPackageConfigurations> -- Special Configuration function for TeX Live packages
+
+=head1 SYNOPSIS
+
+ use TeXLive::TLPackageConfigurations;
+
+=head1 DESCRIPTION
+
+The L<TeXLive::TLPackageConfigurations> module exports the
+C<%PackageConfigInstall> and the C<%PackageConfigRemove> hashes indexed by
+package names providing code references.
+
+These code references are called with the root of the installation as
+argument (C<$SELFAUTOPARENT>). Additional arguments, but not necessarily
+present, are the value of C<TEXMFSYSVAR> and C<TEXMFLOCAL>.
+
+=head1 SEE ALSO
+
+The modules L<TeXLive::TLUtils>, L<TeXLive::TLPSRC>,
+L<TeXLive::TLPDB>, L<TeXLive::TLTREE>, L<TeXLive::TeXCatalogue>.
+
+=head1 AUTHORS AND COPYRIGHT
+
+This script and its documentation were written for the TeX Live
+distribution (L<http://tug.org/texlive>) and both are licensed under the
+GNU General Public License Version 2 or later.
+
+=cut
+
+### Local Variables:
+### perl-indent-level: 2
+### tab-width: 2
+### indent-tabs-mode: nil
+### End:
+# vim:set tabstop=2 expandtab: #