~ubuntu-branches/ubuntu/trusty/libsereal-encoder-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to Makefile.PL

  • Committer: Package Import Robot
  • Author(s): Alexandre Mestiashvili
  • Date: 2013-02-20 08:29:14 UTC
  • Revision ID: package-import@ubuntu.com-20130220082914-dljb6eixvtj2m1v2
Tags: upstream-0.31
ImportĀ upstreamĀ versionĀ 0.31

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use 5.008;
 
2
 
 
3
use strict;
 
4
use warnings;
 
5
 
 
6
use ExtUtils::MakeMaker;
 
7
use Config;
 
8
 
 
9
my $shared_dir = "../shared";
 
10
my $in_source_repo = -d "../../.git" and -d $shared_dir;
 
11
 
 
12
my $module = "Sereal::Encoder";
 
13
 
 
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;
 
18
 
 
19
our $OPTIMIZE;
 
20
 
 
21
my $defines = join " ", map "-D$_", grep exists $ENV{$_},
 
22
              qw(NOINLINE DEBUG MEMDEBUG NDEBUG ENABLE_DANGEROUS_HACKS);
 
23
 
 
24
if ($Config{gccversion}) {
 
25
    $OPTIMIZE = '-O3 -Wall -W';
 
26
} elsif ($Config{osname} eq 'MSWin32') {
 
27
    $OPTIMIZE = '-O2 -W4';
 
28
} else {
 
29
    $OPTIMIZE = $Config{optimize};
 
30
}
 
31
 
 
32
if ($ENV{DEBUG}) {
 
33
  $OPTIMIZE .= ' -g';
 
34
}
 
35
else {
 
36
  $defines .= " -DNDEBUG";
 
37
}
 
38
 
 
39
# from Compress::Snappy
 
40
require Devel::CheckLib;
 
41
my $ctz = Devel::CheckLib::check_lib(
 
42
    lib      => 'c',
 
43
    function => 'return (__builtin_ctzll(0x100000000LL) != 32);'
 
44
) ? '-DHAVE_BUILTIN_CTZ' : '';
 
45
$defines .= " $ctz" if $ctz;
 
46
 
 
47
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
 
48
# the contents of the Makefile that is written.
 
49
WriteMakefile1(
 
50
    MIN_PERL_VERSION => '5.008',
 
51
    META_MERGE => {
 
52
        resources => {
 
53
            repository => 'git://github.com/Sereal/Sereal.git'
 
54
        },
 
55
    },
 
56
    BUILD_REQUIRES => {
 
57
        'Test::More' => 0.88,
 
58
        'Scalar::Util' => 0,
 
59
        'File::Find' => 0,
 
60
        'File::Spec' => 0,
 
61
        'Scalar::Util' => 0,
 
62
        'File::Path' => 0,
 
63
        'ExtUtils::ParseXS' => '2.21',
 
64
        'Test::LongString' => '0',
 
65
        'Data::Dumper' => '0',
 
66
        'Test::Warn' => '0',
 
67
    },
 
68
    NAME              => $module,
 
69
    VERSION_FROM      => 'lib/Sereal/Encoder.pm', # finds $VERSION
 
70
    PREREQ_PM         => {
 
71
        'XSLoader' => 0,
 
72
    }, # e.g., Module::Name => 1.1
 
73
    LICENSE => 'perl',
 
74
    ABSTRACT_FROM => 'lib/Sereal/Encoder.pm',
 
75
    AUTHOR => 'Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>',
 
76
    LIBS              => [''], # e.g., '-lm'
 
77
    DEFINE            => $defines,
 
78
    INC               => '-I.', # e.g., '-I. -I/usr/include/other'
 
79
    OPTIMIZE          => $OPTIMIZE,
 
80
    OBJECT            => '$(O_FILES)',
 
81
);
 
82
$ENV{OPTIMIZE} = $OPTIMIZE;
 
83
 
 
84
sub WriteMakefile1 {  #Written by Alexandr Ciornii, version 0.20. Added by eumm-upgrade.
 
85
    my %params=@_;
 
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};
 
94
    }
 
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';
 
104
 
 
105
    WriteMakefile(%params);
 
106
}