Re: [PATCH] Abstract "utility" information from installman
[p5sagit/p5-mst-13.2.git] / installperl
index c35482d..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; }
 
@@ -396,7 +404,7 @@ if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
 sub script_alias {
     my ($installscript, $orig, $alias, $scr_ext) = @_;
 
-    safe_unlink("$installscript/pstruct$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"); 
@@ -417,11 +425,12 @@ if (! $versiononly) {
        chmod(0755, "$installscript/$base");
     }
 
-    # pstruct should be a link to c2ph
-    script_alias('c2ph', 'pstruct');
-
-    # psed should be a link to s2p
-    script_alias('s2p', 'psed');
+    for (@tolink) { 
+        my ($from, $to)= @$_;
+        (my $frbase = $from) =~ s#.*/##;
+        (my $tobase = $to) =~ s#.*/##;
+        script_alias($installscript, $frbase, $tobase, $scr_ext);
+    }
 }
 
 # Install pod pages.  Where? I guess in $installprivlib/pod