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(CVf_ANON CVf_CLONE CVf_CLONED CVf_CONST CVf_LVALUE CVf_METHOD
24 CVf_NODEBUG CVf_UNIQUE CVf_WEAKOUTSIDE
25 GVf_IMPORTED_AV GVf_IMPORTED_CV GVf_IMPORTED_HV GVf_IMPORTED_SV
27 SVTYPEMASK SVt_PVGV SVt_PVHV
28 SVf_FAKE SVf_IOK SVf_IVisUV SVf_NOK SVf_POK SVf_READONLY
29 SVf_ROK SVp_IOK SVp_NOK SVp_POK SVpad_OUR SVs_RMG SVs_SMG
30 PAD_FAKELEX_ANON PAD_FAKELEX_MULTI);
33 push @names, 'CVf_ISXSUB';
35 # Constant not present after 5.8.x
36 push @names, 'AVf_REAL';
37 # This is only present in 5.10, but it's useful to B::Deparse to be able
38 # to import a dummy value from B
39 push @names, 'OPpPAD_STATE';
43 # Constant not present after 5.10.x
44 push @names, 'CVf_LOCKED';
47 # First element in each tuple is the file; second is a regex snippet
48 # giving the prefix to limit the names of symbols to define that come
49 # from that file. If none, all symbols will be defined whose values
50 # match the pattern below.
51 foreach my $tuple (['op_reg_common.h','(?:(?:RXf_)?PMf_)'],
54 ['regexp.h','RXf_']) {
55 my $file = $tuple->[0];
56 my $pfx = $tuple->[1] || '';
57 my $path = File::Spec->catfile($headerpath, $file);
58 open my $fh, '<', $path or die "Cannot open $path: $!";
60 push @names, $1 if (/ \#define \s+ ( $pfx \w+ ) \s+
61 ( [()|\dx]+ # Parens, '|', digits, 'x'
62 | \(? \d+ \s* << .*? # digits left shifted by anything
63 ) \s* (?: $| \/ \* ) # ending at comment or $
69 # Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name
70 # should exist, so ensure that the C compile breaks if anything does not.
72 PROXYSUBS => {push => 'EXPORT_OK'},
74 NAMES => [map {{name=>$_, macro=>1}} @names],