This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
README: stop recommending the mconfig "-X" option
[metaconfig.git] / U / mkgloss.pl
1 #!/usr/bin/perl
2
3 # (c)'11 H.Merijn Brand [ 26 Aug 2011 ]
4
5 # This script combines the output of mkglossary, with the suggested
6 # patches (see README), and sorts the list
7
8 use strict;
9 use warnings;
10
11 my $Pcsh = "Porting/config.sh";
12 @ARGV = "config.sh";
13 my @config = <> or die
14     "mkgloss uses $Pcsh.sh. You didn't run Configure (yet)\n".
15     "so I cannot make a temporary version of it to generate a reliable\n".
16     "Glossary!\n";
17 {   my $drop = 0;
18     for (@config) {
19         s{\bh.m.brand\@\w+\.nl\b}{hmbrand\@cpan.org};
20         s{\b\.xs4all.nl\b}{.cpan.org};
21         m/^# Variables propagated from previous config/ and $drop++;
22         $drop and $_ = '';
23         }
24     unlink $Pcsh;
25     open my $config, ">", $Pcsh or die "$Pcsh: $!\n";
26     print   $config @config;
27     close   $config;
28     }
29
30 @ARGV = ("U/mkglossary |");
31 $/ = undef;
32 my @g = split m{(?<=\n\n)(?=\S)}, <>, -1;
33
34 print splice @g, 0, 2;
35 for (sort { lc $a cmp lc $b } @g) {
36     if (m/^make_set_make /) {
37         s/Configure -D option/Configure '-D' option/;
38         }
39     if (m/^n /) {
40         s/contains the -n flag/contains the '-n' flag/;
41         }
42     if (m/^sh /) {
43         s/set sh with a -D$/set sh with a '-D'/m;
44         s{with -O -Dsh=/bin/whatever -Dstartsh=whatever}
45          {with '-O -Dsh=/bin/whatever -Dstartsh=whatever'};
46         }
47     if (m/^spitshell /) {
48         s/cat or a grep -v for # comments/cat or a grep '-v' for # comments/;
49         }
50     s/[ \t]+\n/\n/g;
51     print;
52     }