diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 88 |
1 files changed, 41 insertions, 47 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index f766f812109..6f4ee1ef320 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -51,7 +51,8 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::make_local_skeleton($path); TeXLive::TLUtils::create_fmtutil($tlpdb,$dest,$localconf); TeXLive::TLUtils::create_updmap($tlpdb,$dest,$localconf); - TeXLive::TLUtils::create_language($tlpdb,$dest,$localconf); + TeXLive::TLUtils::create_language_dat($tlpdb,$dest,$localconf); + TeXLive::TLUtils::create_language_def($tlpdb,$dest,$localconf); TeXLive::TLUtils::install_packages($from_tlpdb,$to_tlpdb,$what,$opt_src, $opt_doc)>); TeXLive::TLUtils::install_package($what, $filelistref, $target, $platform); @@ -94,10 +95,11 @@ BEGIN { &media &initialize_installer &make_var_skeleton - &sub make_local_skeleton + &make_local_skeleton &create_fmtutil &create_updmap - &create_language + &create_language_dat + &create_language_def &sort_uniq &push_uniq &texdir_check @@ -790,7 +792,7 @@ sub setup_programs { =pod -=item C<download_file( $path, $destination [, $progs ] )> +=item C<download_file( $relpath, $destination [, $progs ] )> Try to download the file given in C<$relpath> from either C<$TeXLiveURL> or C<TeXLiveAlternativeURL> into C<$destination>, which can be either @@ -1045,10 +1047,12 @@ sub make_local_skeleton { =item C<create_updmap($tlpdb, $dest, $localconf)> -=item C<create_language($tlpdb, $dest, $localconf)> +=item C<create_language_dat($tlpdb, $dest, $localconf)> -These three functions create C<fmtutil.cnf>, C<updmap.cfg>, and -C<language.dat>, respectively, in C<$dest> (which by default is below +=item C<create_language_def($tlpdb, $dest, $localconf)> + +These four functions create C<fmtutil.cnf>, C<updmap.cfg>, C<language.dat>, +and C<language.def> respectively, in C<$dest> (which by default is below C<$TEXMFSYSVAR>). These functions merge the information present in the TLPDB C<$tlpdb> (formats, maps, hyphenations) with local configuration additions: C<$localconf>. @@ -1061,54 +1065,39 @@ improved (checking for duplicates). sub create_fmtutil { my ($tlpdb,$dest,$localconf) = @_; - my $root = $tlpdb->root; my @lines = $tlpdb->fmtutil_cnf_lines; - if (-r "$localconf") { - # - # this should be done more intelligently, but for now only add those - # lines without any duplication check ... - open FOO, "<$localconf" - or die "strange, -r ok but cannot open $localconf: $!"; - my @tmp = <FOO>; - push @lines, @tmp; - } - if ($#lines >= 0) { - open(OUTFILE,">$dest") - or die("Cannot open $dest for writing: $!"); - - printf OUTFILE "# Generated by %s on %s\n", "$0", scalar localtime; - print OUTFILE @lines; - close(OUTFILE) || warn "close(>$dest) failed: $!"; - } + _create_config_files ($tlpdb, "texmf/fmtutil/fmtutil-hdr.cnf", $dest, $localconf, 0, '#', \@lines); } - + sub create_updmap { my ($tlpdb,$dest,$localconf) = @_; - my $root = $tlpdb->root; my @lines = $tlpdb->updmap_cfg_lines; - if (-r "$localconf") { - # - # this should be done more intelligently, but for now only add those - # lines without any duplication check ... - open FOO, "<$localconf" - or die "strange, -r ok but cannot open $localconf: $!"; - my @tmp = <FOO>; - push @lines, @tmp; - } - if ($#lines >= 0) { - open(OUTFILE,">$dest") - or die("Cannot open $dest for writing: $!"); + _create_config_files ($tlpdb, "texmf/web2c/updmap-hdr.cfg", $dest, $localconf, 0, '#', \@lines); +} - printf OUTFILE "# Generated by %s on %s\n", "$0", scalar localtime; - print OUTFILE @lines; - close(OUTFILE) || warn "close(>$dest) failed: $!"; - } +sub create_language_dat { + my ($tlpdb,$dest,$localconf) = @_; + my @lines = $tlpdb->language_dat_lines; + _create_config_files ($tlpdb, "texmf/tex/generic/config/language.us", $dest, $localconf, 0, '%', \@lines); } -sub create_language { +sub create_language_def { my ($tlpdb,$dest,$localconf) = @_; + my @lines = $tlpdb->language_def_lines; + my @postlines; + push @postlines, "%%% No changes may be made beyond this point.\n"; + push @postlines, "\n"; + push @postlines, "\\uselanguage {USenglish} %%% This MUST be the last line of the file.\n"; + _create_config_files ($tlpdb, "texmf/tex/plain/config/language.us.def", $dest, $localconf, 1, '%', \@lines, @postlines); +} + +sub _create_config_files { + my ($tlpdb, $headfile, $dest,$localconf, $keepfirstline, $cc, $tlpdblinesref, @postlines) = @_; my $root = $tlpdb->root; - my @lines = $tlpdb->language_dat_lines; + open(INFILE,"<$root/$headfile") or die("Cannot open $root/$headfile"); + my @lines = <INFILE>; + push @lines, @$tlpdblinesref; + close (INFILE); if (-r "$localconf") { # # this should be done more intelligently, but for now only add those @@ -1118,17 +1107,22 @@ sub create_language { my @tmp = <FOO>; push @lines, @tmp; } + if (@postlines) { + push @lines, @postlines; + } if ($#lines >= 0) { open(OUTFILE,">$dest") or die("Cannot open $dest for writing: $!"); - printf OUTFILE "%% Generated by %s on %s\n", "$0", scalar localtime; + if (!$keepfirstline) { + print OUTFILE $cc; + printf OUTFILE " Generated by %s on %s\n", "$0", scalar localtime; + } print OUTFILE @lines; close(OUTFILE) || warn "close(>$dest) failed: $!"; } } - =pod =back |