1 use ExtUtils::MakeMaker;
2 use ExtUtils::Constant 0.23 'WriteConstants';
7 my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
11 $headerpath = File::Spec->catdir(File::Spec->updir, File::Spec->updir);
14 $headerpath = File::Spec->catdir($Config::Config{archlibexp}, "CORE");
17 my @names = ({ name => 'HEf_SVKEY', macro => 1, type => "IV" },
18 qw(SVTYPEMASK SVt_PVGV SVt_PVHV PAD_FAKELEX_ANON
19 PAD_FAKELEX_MULTI SVpad_STATE SVpad_TYPED SVpad_OUR));
23 # First element in each tuple is the file; second is a regex snippet
24 # giving the prefix to limit the names of symbols to define that come
25 # from that file. If none, all symbols will be defined whose values
26 # match the pattern below.
27 foreach my $tuple (['cop.h'],
32 ['op_reg_common.h','(?:(?:RXf_)?PMf_)'],
33 ['pad.h','PADNAMEf_'],
35 ['sv.h', 'SV(?:[fps]|pad)_'],
37 my $file = $tuple->[0];
38 my $pfx = $tuple->[1] || '';
39 my $path = File::Spec->catfile($headerpath, $file);
41 open my $fh, '<', $path or die "Cannot open $path: $!";
43 push @names, $1 if (/ ^ \s* \# \s* define \s+ ( $pfx \w+ ) \s+
44 ( [()|\dx]+ [UuLl]{0,2} # Parens, '|', digits, 'x',
45 # followed by optional long,
47 | 0x[0-9a-fA-F]+ # hex values
48 | \(? \d+ [UuLl]{0,2} \s* << .*? # digits left shifted by anything
49 # followed by optional
50 # long, unsigned qualifiers
51 ) \s* (?: $| \/ \* ) # ending at comment or $
59 VERSION_FROM => "B.pm",
60 realclean => {FILES=> 'const-c.inc const-xs.inc'},
61 depend => {'Makefile' => "@depend"},
64 # Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name
65 # should exist, so ensure that the C compile breaks if anything does not.
67 PROXYSUBS => {push => 'EXPORT_OK'},
69 NAMES => [map {ref $_ ? $_ : {name=>$_, macro=>1, type=>"UV"}} @names],