blob: 19d294472aaa01226dbaa50b5c31daf44f5ade5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/usr/bin/perl -w
################################################################################
#
# scanprov -- scan Perl headers for provided macros
#
################################################################################
#
# $Revision: 9 $
# $Author: mhx $
# $Date: 2009/01/18 14:10:50 +0100 $
#
################################################################################
#
# Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
# Version 2.x, Copyright (C) 2001, Paul Marquess.
# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
################################################################################
use strict;
require 'parts/ppptools.pl';
die "Usage: $0 [check|write]\n" unless @ARGV && $ARGV[0] =~ /^(check|write)$/;
my $mode = $1;
my %embed = map { ( $_->{name} => 1 ) }
parse_embed(qw(parts/embed.fnc parts/apidoc.fnc parts/ppport.fnc ));
my @provided = grep { !exists $embed{$_} }
map { /^(\w+)/ ? $1 : () }
`$^X ppport.h --list-provided`;
my $install = '/tmp/perl/install/default';
my @perls = sort { $b->{version} <=> $a->{version} }
map { { version => `$_ -e 'printf "%.6f", \$]'`, path => $_ } }
('bleadperl', glob "$install/*/bin/perl5.*");
for (1 .. $#perls) {
$perls[$_]{todo} = $perls[$_-1]{version};
}
shift @perls;
my %v;
for my $p (@perls) {
print "checking perl $p->{version}...\n";
my $archlib = `$p->{path} -MConfig -l -e 'print \$Config{archlib}'`;
chomp $archlib;
local @ARGV = glob "$archlib/CORE/*.h";
my %sym;
while (<>) { $sym{$_}++ for /(\w+)/g; }
@provided = map { $sym{$_} or $v{$p->{todo}}{$_}++; $sym{$_} ? $_ : () } @provided;
}
my $out = 'parts/base';
my $todo = parse_todo($out);
for my $v (keys %v) {
my @new = sort grep { !exists $todo->{$_} } keys %{$v{$v}};
@new or next;
my $file = $v;
$file =~ s/\.//g;
$file = "$out/$file";
-e $file or die "non-existent: $file\n";
print "-- $file --\n";
$mode eq 'write' and (open F, ">>$file" or die "$file: $!\n");
for (@new) {
print "adding $_\n";
$mode eq 'write' and printf F "%-30s # added by $0\n", $_;
}
$mode eq 'write' and close F;
}
|