sysklogd: fix build on musl
[buildroot-gz.git] / package / libldns / 0003-let-doxyparse-output-manpage-generation-issues.patch
blob223ebe98b33bbabc2ad2ca439bf3f039a8cdaa8a
1 From d8a3da12be085fbc92e3d4d4d084c328fc37485a Mon Sep 17 00:00:00 2001
2 From: Willem Toorop <willem@nlnetlabs.nl>
3 Date: Thu, 27 Nov 2014 16:21:54 +0100
4 Subject: [PATCH] let doxyparse output manpage generation issues
6 [Backport from upstream commit
7 168ee09a4bf184947798c3ee3ac99b6651470d64, fixes the build with Perl
8 5.22.]
9 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
10 ---
11 doc/doxyparse.pl | 45 ++++++++++++++++++++++++++++++++++++++-------
12 1 file changed, 38 insertions(+), 7 deletions(-)
14 diff --git a/doc/doxyparse.pl b/doc/doxyparse.pl
15 index 96a1732..a09b2e8 100755
16 --- a/doc/doxyparse.pl
17 +++ b/doc/doxyparse.pl
18 @@ -57,10 +57,15 @@ This manpage was automaticly generated from the ldns source code by
19 use of Doxygen and some perl.
22 -getopts("m:",\%options);
23 +getopts("em:",\%options);
24 # if -m manpage file is given process that file
25 # parse the file which tells us what manpages go together
26 my $functions, $see_also;
27 +my $i = -1;
28 +my $report_errors = defined $options{'e'};
29 +my $errors = 0;
30 +my %unique;
32 if (defined $options{'m'}) {
33 # process
34 open(MAN, "<$options{'m'}") or die "Cannot open $options{'m'}";
35 @@ -68,18 +73,35 @@ if (defined $options{'m'}) {
36 # func1, func2, .. | see_also1, see_also2, ...
37 while(<MAN>) {
38 chomp;
39 + $i += 1;
40 if (/^#/) { next; }
41 if (/^$/) { next; }
42 - ($functions, $see_also) = split /[\t ]*\|[\t ]*/, $_;
43 - #print "{$functions}\n";
44 - #print "{$see_also}\n";
45 + my @parts = split /[\t ]*\|[\t ]*/, $_;
46 + $functions = shift @parts;
47 + $see_also = join ', ', @parts;
48 + print "{$functions}\n";
49 + print "{$see_also}\n";
50 my @funcs = split /[\t ]*,[\t ]*/, $functions;
51 my @also = split /[\t ]*,[\t ]*/, $see_also;
52 $manpages{$funcs[0]} = \@funcs;
53 $see_also{$funcs[0]} = \@also;
54 + foreach (@funcs) {
55 + if ($unique{$_}) {
56 + push $unique{$_}, ($i,);
57 + } else {
58 + $unique{$_} = [$i];
59 + }
60 + }
61 #print "[", $funcs[0], "]\n";
63 close(MAN);
64 + while (($func, $lines) = each %unique ) {
65 + if (scalar @$lines > 1) {
66 + print STDERR "$func in function_manpages on lines: "
67 + . join(", ",@$lines) . "\n" if $report_errors;
68 + $errors += 1;
69 + }
70 + }
71 } else {
72 print "Need -m file to process the .h files\n";
73 exit 1;
74 @@ -95,7 +117,7 @@ mkdir "doc/man";
75 mkdir "doc/man/man$MAN_SECTION";
77 $state = 0;
78 -my $i;
79 +$i = 0;
80 my @lines = <STDIN>;
81 my $max = @lines;
83 @@ -273,7 +295,7 @@ foreach (keys %manpages) {
85 print MAN $MAN_MIDDLE;
87 - if (defined(@$also)) {
88 + if (@$also) {
89 print MAN "\n.SH SEE ALSO\n\\fI";
90 print MAN join "\\fR, \\fI", @$also;
91 print MAN "\\fR.\nAnd ";
92 @@ -290,7 +312,7 @@ foreach (keys %manpages) {
93 # create symlinks
94 chdir("$BASE/man$MAN_SECTION");
95 foreach (@$name) {
96 - print STDERR $_,"\n";
97 + print STDOUT $_,"\n";
98 my $new_file = $_ . "." . $MAN_SECTION;
99 if ($new_file eq $symlink_file) {
100 next;
101 @@ -301,3 +323,12 @@ foreach (keys %manpages) {
102 chdir("../../.."); # and back, tricky and fragile...
103 close(MAN);
105 +foreach (keys %api) {
106 + next if (/ / || /^$/);
107 + if (not $unique{$_}) {
108 + print STDERR "no man page for $_\n" if $report_errors;
109 + $errors += 1;
113 +exit ($report_errors and $errors != 0);
115 2.6.4