1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
use v5;
use strict;
use warnings;
use Module::Build;
use XS::Parse::Keyword::Builder;
use XS::Parse::Sublike::Builder;
my @extra_compiler_flags = qw( -Ishare/include -Iinclude -Ihax );
# Perl 5.36 made -std=c99 standard; before then we'll have to request it specially
push @extra_compiler_flags, qw( -std=c99 ) if $^V lt v5.36.0;
push @extra_compiler_flags, qw( -DDEBUGGING=-ggdb3 ) if $^X =~ m|/debugperl|;
use Config;
if( $Config{ccname} eq "gcc" ) {
# Enable some extra gcc warnings, largely just for author interest
push @extra_compiler_flags, qw( -Wall -Wno-unused-function );
}
my $build = Module::Build->new(
module_name => 'Object::Pad',
requires => {
# On perl 5.31.9 onwards we use core's no feature 'indirect',
( $] >= 5.031009 ?
() :
( 'indirect' => 0 ) ),
'perl' => '5.018', # pad_add_name_pvn, pad_add_name_pvs, gv_init_pvn
# Technically probably would work on 5.16 but doesn't:
# https://rt.cpan.org/Ticket/Display.html?id=132930
'XS::Parse::Keyword' => '0.47',
'XS::Parse::Sublike' => '0.35',
},
test_requires => {
'Test2::V0' => '0.000148',
},
configure_requires => {
'Module::Build' => '0.4004', # test_requires
'XS::Parse::Keyword::Builder' => '0.48',
'XS::Parse::Sublike::Builder' => '0.35',
},
share_dir => {
module => { 'Object::Pad' => [ 'share' ] },
},
license => 'perl',
create_license => 1,
create_readme => 1,
extra_compiler_flags => \@extra_compiler_flags,
c_source => [ "src/" ],
);
XS::Parse::Keyword::Builder->extend_module_build( $build );
XS::Parse::Sublike::Builder->extend_module_build( $build );
if( eval { require Devel::MAT::Dumper::Helper and
Devel::MAT::Dumper::Helper->VERSION( '0.45' ) } ) {
Devel::MAT::Dumper::Helper->extend_module_build( $build );
}
if( $^X =~ m|/debugperl| ) {
# We need to tell gcc not to optimise away lots of things we want to see in
# the debugger. It'd be nice if M::B had a nicer way to do this...
$build->add_property( 'optimize' );
$build->config( optimize => '-ggdb3' );
}
$build->create_build_script;
|