This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Generate a valid config.h even if stdarg.h and varargs.h are both missing.
[metaconfig.git] / U / mkgloss.pl
CommitLineData
83110c7a
MB
1#!/pro/bin/perl
2
86b74a81 3# (c)'11 H.Merijn Brand [ 26 Aug 2011 ]
83110c7a
MB
4
5# This script combines the output of mkglossary, with the suggested
6# patches (see README), and sorts the list
7
8use strict;
9use warnings;
10
da978234
MB
11my $Pcsh = "Porting/config.sh";
12@ARGV = "config.sh";
13my @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
83110c7a
MB
30@ARGV = ("U/mkglossary |");
31$/ = undef;
32my @g = split m{(?<=\n\n)(?=\S)}, <>, -1;
33
34print splice @g, 0, 2;
35for (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 }
da978234 50 s/[ \t]+\n/\n/g;
83110c7a
MB
51 print;
52 }