1 use ExtUtils::MakeMaker;
2 use ExtUtils::Constant 0.23 'WriteConstants';
7 my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
11 VERSION_FROM => "B.pm",
12 realclean => {FILES=> 'const-c.inc const-xs.inc'},
17 $headerpath = File::Spec->catdir(File::Spec->updir, File::Spec->updir);
20 $headerpath = File::Spec->catdir($Config::Config{archlibexp}, "CORE");
23 my @names = qw(HEf_SVKEY
24 SVTYPEMASK SVt_PVGV SVt_PVHV
25 PAD_FAKELEX_ANON PAD_FAKELEX_MULTI);
28 # Constant not present after 5.8.x
29 push @names, 'AVf_REAL';
30 # This is only present in 5.10, but it's useful to B::Deparse to be able
31 # to import a dummy value from B
32 push @names, {name=>"OPpPAD_STATE", default=>["IV", "0"]};
35 # First element in each tuple is the file; second is a regex snippet
36 # giving the prefix to limit the names of symbols to define that come
37 # from that file. If none, all symbols will be defined whose values
38 # match the pattern below.
39 foreach my $tuple (['cop.h'],
43 ['op_reg_common.h','(?:(?:RXf_)?PMf_)'],
45 ['sv.h', 'SV(?:[fps]|pad)_'],
47 my $file = $tuple->[0];
48 my $pfx = $tuple->[1] || '';
49 my $path = File::Spec->catfile($headerpath, $file);
50 open my $fh, '<', $path or die "Cannot open $path: $!";
52 push @names, $1 if (/ \#define \s+ ( $pfx \w+ ) \s+
53 ( [()|\dx]+ # Parens, '|', digits, 'x'
54 | \(? \d+ \s* << .*? # digits left shifted by anything
55 ) \s* (?: $| \/ \* ) # ending at comment or $
61 # Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name
62 # should exist, so ensure that the C compile breaks if anything does not.
64 PROXYSUBS => {push => 'EXPORT_OK'},
66 NAMES => [map {ref $_ ? $_ : {name=>$_, macro=>1}} @names],