3 use ExtUtils::MakeMaker;
4 use File::Spec::Functions 'catfile';
8 (unpack "B*", pack "N", $Config{ptrsize}) =~ /^0+1(0+)$/
9 or die "Your pointer size of $Config{ptrsize} is very confusing";
10 my $ptr_bits = length $1;
14 extract_refcounted_he(catfile($Config{archlib}, 'CORE', 'hv.h'))
19 NAME => 'Devel::Memory',
20 VERSION_FROM => 'lib/Devel/Memory.pm',
21 DEFINE => "-DALIGN_BITS=$ptr_bits",
25 'HTML::Entities' => 0,
26 'Mojolicious::Lite' => 0,
31 EXE_FILES => [ 'bin/dmemtree.pl' ],
33 FILES => 'refcounted_he.h',
35 (eval $ExtUtils::MakeMaker::VERSION >= 6.47 ? (MIN_PERL_VERSION => '5.005') : ()),
36 (eval $ExtUtils::MakeMaker::VERSION >= 6.31 ? (LICENSE => 'perl') : ()),
39 sub extract_refcounted_he {
41 open my $fh, '<', $header or die $!;
45 next unless /struct refcounted_he \{/ .. /\};/;
54 my ($filename, $contents) = @_;
55 my $guard_name = uc $filename;
56 $guard_name =~ tr/./_/;
58 open my $fh, '>', $filename or die $!;
59 print { $fh } "#ifndef ${guard_name}\n";
60 print { $fh } "#define ${guard_name}\n";
61 print { $fh } $contents or die $!;
62 print { $fh } "#endif /* ${guard_name} */\n";