6
use ExtUtils::MakeMaker;
9
my $shared_dir = "../shared";
10
my $in_source_repo = -d "../../.git" and -d $shared_dir;
12
my $module = "Sereal::Encoder";
14
unshift @INC, '.', 'inc';
15
require inc::Sereal::BuildTools;
16
inc::Sereal::BuildTools::link_files($shared_dir) if $in_source_repo;
17
inc::Sereal::BuildTools::generate_constant_includes($module) if $in_source_repo;
21
my $defines = join " ", map "-D$_", grep exists $ENV{$_},
22
qw(NOINLINE DEBUG MEMDEBUG NDEBUG ENABLE_DANGEROUS_HACKS);
24
if ($Config{gccversion}) {
25
$OPTIMIZE = '-O3 -Wall -W';
26
} elsif ($Config{osname} eq 'MSWin32') {
27
$OPTIMIZE = '-O2 -W4';
29
$OPTIMIZE = $Config{optimize};
36
$defines .= " -DNDEBUG";
39
# from Compress::Snappy
40
require Devel::CheckLib;
41
my $ctz = Devel::CheckLib::check_lib(
43
function => 'return (__builtin_ctzll(0x100000000LL) != 32);'
44
) ? '-DHAVE_BUILTIN_CTZ' : '';
45
$defines .= " $ctz" if $ctz;
47
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
48
# the contents of the Makefile that is written.
50
MIN_PERL_VERSION => '5.008',
53
repository => 'git://github.com/Sereal/Sereal.git'
63
'ExtUtils::ParseXS' => '2.21',
64
'Test::LongString' => '0',
65
'Data::Dumper' => '0',
69
VERSION_FROM => 'lib/Sereal/Encoder.pm', # finds $VERSION
72
}, # e.g., Module::Name => 1.1
74
ABSTRACT_FROM => 'lib/Sereal/Encoder.pm',
75
AUTHOR => 'Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>',
76
LIBS => [''], # e.g., '-lm'
78
INC => '-I.', # e.g., '-I. -I/usr/include/other'
79
OPTIMIZE => $OPTIMIZE,
80
OBJECT => '$(O_FILES)',
82
$ENV{OPTIMIZE} = $OPTIMIZE;
84
sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.20. Added by eumm-upgrade.
86
my $eumm_version=$ExtUtils::MakeMaker::VERSION;
87
$eumm_version=eval $eumm_version;
88
die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
89
die "License not specified" if not exists $params{LICENSE};
90
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
91
#EUMM 6.5502 has problems with BUILD_REQUIRES
92
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
93
delete $params{BUILD_REQUIRES};
95
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
96
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
97
delete $params{META_MERGE} if $eumm_version < 6.46;
98
delete $params{META_ADD} if $eumm_version < 6.46;
99
delete $params{LICENSE} if $eumm_version < 6.31;
100
delete $params{AUTHOR} if $] < 5.005;
101
delete $params{ABSTRACT_FROM} if $] < 5.005;
102
delete $params{BINARY_LOCATION} if $] < 5.005;
103
delete $params{OPTIMIZE} if $^O eq 'MSWin32';
105
WriteMakefile(%params);