#!@PERL@

# Make the installation of LaTeX PostScript fonts easy.
#
# Example:
#    install zmtt
#
# rcpt@urc.tue.nl / Jan. 1995

die "Usage: install directory set ...\n" unless @ARGV > 1;

$subdir = $ARGV[0]; shift(@ARGV);

$dvipsdir = "dvips";
$tfmdir   = "fonts/tfm";
$vfdir    = "fonts/vf";
$fddir    = "macros/latex/psnfss";

@texhier = ($dvipsdir, $tfmdir, $vfdir, $fddir);

# Create subdir and its hierarchy
system("mkdir $subdir") unless -d $subdir;
foreach $dir (@texhier) {
   (@subdirs) = split(/\//, $dir);
   $subsubdir = "$subdir";
   foreach (@subdirs) {
      $subsubdir .= "/$_";
      system("mkdir $subsubdir") unless -d "$subsubdir";
   }
}

# Don't hassle output
select(STDOUT); $| = 1;

# Install all stuff in the appropriate directories
system("mv *.tfm $subdir/$tfmdir");
system("mv *.vf  $subdir/$vfdir");
system("mv *.fd  $subdir/$fddir");

open(PSFONTS, ">$subdir/$dvipsdir/$subdir.map");
foreach $set (@ARGV) {
   open(MAP, "<mapfiles/$set.map");
   while (<MAP>) {
      next if /^[*#]/;
      print PSFONTS;
   }
   close(MAP);
}
close(PSFONTS);




