Use the new use vars feature.
[p5sagit/p5-mst-13.2.git] / installperl
index 4a77415..6bfbdc9 100755 (executable)
@@ -63,12 +63,20 @@ while (@ARGV) {
 }
 
 $versiononly = 1 if $Config{versiononly} && !defined $versiononly;
-
-my @scripts = qw(utils/c2ph utils/h2ph utils/h2xs utils/perlbug utils/perldoc
-               utils/pl2pm utils/splain utils/perlcc utils/dprofpp
-               x2p/s2p x2p/find2perl 
-               pod/pod2man pod/pod2html pod/pod2latex pod/pod2text
-               pod/pod2usage pod/podchecker pod/podselect);
+my (@scripts, @tolink);
+open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
+while (<SCRIPTS>) {
+    next if /^#/;
+    next if /#\s*pod\s*=/; # Binary programs need separate treatment
+    chomp;
+    if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) {
+        push @scripts, $1;
+        push @tolink, [$1, $2];
+    } else {
+        push @scripts, $_;
+    }
+}
+close SCRIPTS;
 
 if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
 
@@ -393,6 +401,19 @@ if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
     chmod(0755, "$installbin/cppstdin");
 }
 
+sub script_alias {
+    my ($installscript, $orig, $alias, $scr_ext) = @_;
+
+    safe_unlink("$installscript/$alias$scr_ext");
+    if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
+       copy("$installscript/$orig$scr_ext",
+            "$installscript/$alias$scr_ext"); 
+    } else {
+       link("$installscript/$orig$scr_ext",
+            "$installscript/$alias$scr_ext");
+    }
+}
+
 if (! $versiononly) {
     # Install scripts.
 
@@ -404,14 +425,11 @@ if (! $versiononly) {
        chmod(0755, "$installscript/$base");
     }
 
-    # pstruct should be a link to c2ph
-    safe_unlink("$installscript/pstruct$scr_ext");
-    if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
-       copy("$installscript/c2ph$scr_ext",
-            "$installscript/pstruct$scr_ext"); 
-    } else {
-       link("$installscript/c2ph$scr_ext",
-            "$installscript/pstruct$scr_ext");
+    for (@tolink) { 
+        my ($from, $to)= @$_;
+        (my $frbase = $from) =~ s#.*/##;
+        (my $tobase = $to) =~ s#.*/##;
+        script_alias($installscript, $frbase, $tobase, $scr_ext);
     }
 }