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 = ({ name => 'HEf_SVKEY', macro => 1, type => "IV" },
24 qw(SVTYPEMASK SVt_PVGV SVt_PVHV PAD_FAKELEX_ANON PAD_FAKELEX_MULTI));
27 # First element in each tuple is the file; second is a regex snippet
28 # giving the prefix to limit the names of symbols to define that come
29 # from that file. If none, all symbols will be defined whose values
30 # match the pattern below.
31 foreach my $tuple (['cop.h'],
35 ['op_reg_common.h','(?:(?:RXf_)?PMf_)'],
37 ['sv.h', 'SV(?:[fps]|pad)_'],
39 my $file = $tuple->[0];
40 my $pfx = $tuple->[1] || '';
41 my $path = File::Spec->catfile($headerpath, $file);
42 open my $fh, '<', $path or die "Cannot open $path: $!";
44 push @names, $1 if (/ \#define \s+ ( $pfx \w+ ) \s+
45 ( [()|\dx]+ # Parens, '|', digits, 'x'
46 | \(? \d+ \s* << .*? # digits left shifted by anything
47 ) \s* (?: $| \/ \* ) # ending at comment or $
53 # Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name
54 # should exist, so ensure that the C compile breaks if anything does not.
56 PROXYSUBS => {push => 'EXPORT_OK'},
58 NAMES => [map {ref $_ ? $_ : {name=>$_, macro=>1, type=>"UV"}} @names],