summaryrefslogtreecommitdiff
path: root/fonts/psfonts/tools/installtree
blob: 2ae77a95dd03f02b42038da51acd376393dae515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/tool/bin/perl
# copy PSNFSS tools CTAN output tree to a TDS tree
use English;
use Getopt::Long;
use File::Basename;
use Cwd;

$filedate="1998/05/12";
$fileversion="1.0";

$opt_debug=0;

if (&IsWin32) {
open(SH,"kpsewhich -separator=; -expand-path \$TEXMF |") 
    || die "cannot run kpsewhich to read TEXMF"; 
    $opt_texdir=<SH>;
    chop $opt_texdir;
    @dirs=split(/;/,$opt_texdir);
 } 
else 
{ 
open(SH,"kpsewhich -separator=: -expand-path '\$TEXMF' |") 
    || die "cannot run kpsewhich to read TEXMF"; 
    $opt_texdir=<SH>;
    chop $opt_texdir;
    @dirs=split(/:/,$opt_texdir);
}
close(SH); 
$opt_texdir=$dirs[0];

$result = GetOptions (
"debug!",   
"texdir=s", # TeX tree
    );

if ($result eq 0 ) {  die ("OPTION FAILURE"); }
die "[installtree] Usage: installtree [options] fontdir \n" 
    unless @ARGV > 0;

$fontdir=$ARGV[0];

chdir("$fontdir") || die ("cannot change directory to $fontdir");
$base = getcwd();
@d=split(/\//,$base); 
$l=scalar(@d);
$VENDOR=$d[$l-2];
$FAMILY=$d[$l-1];
open(README,"README");
    while(<README>) {
	if (/ \+ a file /) {
	    ($FAMCODE) = /^ \+ a file ([a-z0-9]*)\.map.*/;
            print "family code is $FAMCODE\n";
	}
}
close README;
print "install $fontdir in $opt_texdir, $VENDOR, $FAMILY\n";
mkdir ("$opt_texdir/fonts",0777);
mkdir ("$opt_texdir/fonts/vf",0777);
mkdir ("$opt_texdir/fonts/tfm",0777);
mkdir ("$opt_texdir/fonts/tfm/$VENDOR",0777);
mkdir ("$opt_texdir/fonts/vf/$VENDOR",0777);
mkdir ("$opt_texdir/fonts/tfm/$VENDOR/$FAMILY",0777);
mkdir ("$opt_texdir/fonts/vf/$VENDOR/$FAMILY",0777);
mkdir ("$opt_texdir/tex",0777);
mkdir ("$opt_texdir/tex/latex",0777);
mkdir ("$opt_texdir/tex/latex/psnfss",0777);
mkdir ("$opt_texdir/tex/latex/psnfss/$FAMCODE",0777);
mkdir ("$opt_texdir/dvips",0777);
mkdir ("$opt_texdir/dvips/psnfss",0777);
mkdir ("$opt_texdir/dvips/psnfss/$FAMCODE",0777);

system("cp $base/vf/* $opt_texdir/fonts/vf/$VENDOR/$FAMILY");
system("cp $base/tfm/* $opt_texdir/fonts/tfm/$VENDOR/$FAMILY");
system("cp $base/tex/* $opt_texdir/tex/latex/psnfss/$FAMCODE");
system("cp $base/dvips/* $opt_texdir/dvips/psnfss/$FAMCODE");

sub IsWin32 {
    return $^O =~ 'MSWin32';
}

1;