summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLPostInstall.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPostInstall.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLPostInstall.pm214
1 files changed, 214 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLPostInstall.pm b/Master/tlpkg/TeXLive/TLPostInstall.pm
new file mode 100644
index 00000000000..4342715f13b
--- /dev/null
+++ b/Master/tlpkg/TeXLive/TLPostInstall.pm
@@ -0,0 +1,214 @@
+# $Id$
+# TeXLive::TLPostInstall.pm - collection post install stuff for installation
+# Copyright 2008 Norbert Preining
+# This file is licensed under the GNU General Public License version 2
+# or any later version.
+
+package TeXLive::TLPostInstall;
+
+BEGIN {
+ use Exporter ();
+ use vars qw( @ISA @EXPORT_OK @EXPORT );
+ @ISA = qw(Exporter);
+ @EXPORT_OK = qw(
+ %PostInstall
+ );
+ @EXPORT = @EXPORT_OK;
+}
+
+use TeXLive::TLUtils qw(win32 mkdirhier copy);
+
+our %PostInstall;
+
+
+sub do_bin_xetex {
+ my ($texdir) = @_;
+ #
+ # bin-xetex installs font-config related stuff
+ # we have to
+ # - updated the installation path in bin/win32/conf/fonts.conf
+ # - call fc-cache -v
+ if (-r "$texdir/bin/win32/conf/fonts.conf") {
+ open(FONTSCONF, "<$texdir/bin/win32/conf/fonts.conf")
+ or die("Cannot open $texdir/bin/win32/conf/fonts.conf");
+ my @lines = <FONTSCONF>;
+ close(FONTSCONF);
+ open(FONTSCONF, ">$texdir/bin/win32/conf/fonts.conf")
+ or die("Cannot open $texdir/bin/win32/conf/fonts.conf for writing");
+ foreach (@lines) {
+ $_ =~ s!c:/Program Files/texlive/2008!$texdir!;
+ print FONTSCONF;
+ }
+ close(FONTSCONF);
+ }
+ # call fc-cache but only when we install on win32!
+ if (win32()) {
+ system("fc-cache","-v");
+ }
+}
+$PostInstall{"bin-xetex"} = \&do_bin_xetex;
+
+
+sub do_bin_xdvi {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ copy ("$TEXDIR/texmf/xdvi/XDvi", "$TEXMFSYSVAR/xdvi");
+}
+$PostInstall{"bin-xdvi"} = \&do_bin_xdvi;
+
+
+sub do_plain {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ # install some copies from texmf(-dist) into texmf-var
+ copy ("$TEXDIR/texmf-dist/tex/plain/config/language.def",
+ "$TEXMFSYSVAR/tex/plain/config");
+}
+$PostInstall{"plain"} = \&do_plain;
+
+
+sub do_bin_dvipsk {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ # those files must exist
+ copy ("$TEXDIR/texmf/dvips/config/config.ps",
+ "$TEXMFSYSVAR/dvips/config");
+}
+$PostInstall{"bin-dvipsk"} = \&do_bin_dvipsk;
+
+
+sub do_bin_dvipdfm {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ # fix up dvipdfm config file to contain the right # piping command
+ mkdirhier("$TEXMFSYSVAR/dvipdfm/config");
+ open(DVIPDFMCONFIGDIST, "<$TEXDIR/texmf/dvipdfm/config/config")
+ or die("Cannot open $TEXDIR/texmf/dvipdfm/config/config");
+ open(DVIPDFMCONFIGINST, ">$TEXMFSYSVAR/dvipdfm/config/config")
+ or die("Cannot open $TEXMFSYSVAR/dvipdfm/config/config");
+ while (<DVIPDFMCONFIGDIST>) {
+ if (m/^D /) {
+ print DVIPDFMCONFIGINST 'D "epstopdf --outfile=%o --nocompress %i"', "\n";
+ } else {
+ print DVIPDFMCONFIGINST;
+ }
+ }
+ close(DVIPDFMCONFIGDIST);
+ close(DVIPDFMCONFIGINST);
+}
+$PostInstall{"bin-dvipdfm"} = \&do_bin_dvipdfm;
+
+sub do_bin_dvipdfmx {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ # dvipdfmx.cfg
+ open(DVIPDFMCONFIGDIST, "<$TEXDIR/texmf/dvipdfm/dvipdfmx.cfg")
+ or die("Cannot open $TEXDIR/texmf/dvipdfm/dvipdfmx.cfg");
+ open(DVIPDFMCONFIGINST, ">$TEXMFSYSVAR/dvipdfm/dvipdfmx.cfg")
+ or die("Cannot open $TEXMFSYSVAR/dvipdfm/dvipdfmx.cfg");
+ while (<DVIPDFMCONFIGDIST>) {
+ if (m/^D /) {
+ print DVIPDFMCONFIGINST "%$_";
+ print DVIPDFMCONFIGINST "\n%% GhostScript (TeX Live (Unix and Win32)):\n";
+ print DVIPDFMCONFIGINST 'D "rungs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dUseFlateCompression=true -sOutputFile=%o %i -c quit"', "\n\n";
+ } else {
+ print DVIPDFMCONFIGINST;
+ }
+ }
+ close(DVIPDFMCONFIGDIST);
+ close(DVIPDFMCONFIGINST);
+}
+$PostInstall{"bin-dvipdfmx"} = \&do_bin_dvipdfmx;
+
+
+sub do_bin_kpathsea {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ copy ("$TEXDIR/texmf/web2c/mktex.cnf",
+ "$TEXMFSYSVAR/web2c");
+}
+$PostInstall{"bin-kpathsea"} = \&do_bin_kpathsea;
+
+sub do_bin_pdftex {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ # the old installer copied from CDDIR, but shouldn't this be installed
+ # in ANY case since it is in bin-pdftex???
+ copy ("$TEXDIR/texmf/tex/generic/config/pdftexconfig.tex",
+ "$TEXMFSYSVAR/tex/generic/config");
+}
+$PostInstall{"bin-pdftex"} = \&do_bin_pdftex;
+
+sub do_context {
+ my ($TEXDIR, $TEXMFSYSVAR) = @_;
+ if (!defined($TEXMFSYSVAR)) {
+ $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`;
+ chomp($TEXMFSYSVAR);
+ }
+ # old installer did this, should we do this, TOO????
+ copy ("$TEXDIR/texmf-dist/tex/context/config/cont-usr.tex",
+ "$TEXMFSYSVAR/tex/context/config");
+}
+$PostInstall{"context"} = \&do_context;
+
+
+1;
+
+
+=head1 NAME
+
+C<TeXLive::TLPostInstall> -- TeX Live Post Installation Routines
+
+=head1 SYNOPSIS
+
+ use TeXLive::TLPostInstall;
+
+=head1 DESCRIPTION
+
+The L<TeXLive::TLPostInstall> module exports the C<%PostInstall> hash 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: #