]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - Makefile.PL
Add BUILD_REQUIRES to WriteMakefile()
[perl/modules/Variable-Magic.git] / Makefile.PL
1 use 5.008;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 BEGIN {
8  eval { require Config };
9  die 'OS unsupported' if $@;
10  Config->import(qw<%Config>);
11 }
12
13 my @DEFINES;
14 my %macro;
15
16 my $as_perl = eval {
17  require ActivePerl;
18  defined &ActivePerl::BUILD ? ActivePerl::BUILD() : undef
19 };
20
21 my $is_as_822 = 0;
22 print "Checking if this is ActiveState Perl 5.8.8 build 822 or higher... ";
23 if ("$]" == 5.008_008 and defined $as_perl and $as_perl >= 822) {
24  $is_as_822 = 1;
25  push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=1';
26 }
27 print $is_as_822 ? "yes\n" : "no\n";
28
29 my $is_gcc_34 = 0;
30 print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
31 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
32  my ($libperl, $gccversion) = map $_ || '', @Config{qw<libperl gccversion>};
33  if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
34   $is_gcc_34 = 1;
35   my ($lddlflags, $ldflags) = @Config{qw<lddlflags ldflags>};
36   $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
37   $libperl = "-l$libperl";
38   my $libdirs = join ' ',
39                  map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
40                   @Config{qw<bin sitebin>};
41   $macro{LDDLFLAGS}    = "$lddlflags $libdirs $libperl";
42   $macro{LDFLAGS}      = "$ldflags $libdirs $libperl";
43   $macro{PERL_ARCHIVE} = '',
44  }
45 }
46 print $is_gcc_34 ? "yes\n" : "no\n";
47
48 # Threads, Windows and 5.8.x don't seem to be best friends
49 if ($^O eq 'MSWin32' && "$]" < 5.009) {
50  push @DEFINES, '-DVMG_MULTIPLICITY=0';
51  print "Thread safety disabled for perl 5.8.x on Windows.\n"
52 }
53
54 # Fork emulation got "fixed" in 5.10.1
55 if ($^O eq 'MSWin32' && "$]" < 5.010_001) {
56  push @DEFINES, '-DVMG_FORKSAFE=0';
57  print "Fork safety not ensured for perl 5.8.x and 5.10.0 on Windows.\n";
58 }
59
60 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
61 %macro   = (macro  => { %macro })         if %macro; # Beware of the circle
62
63 my $dist = 'Variable-Magic';
64
65 (my $name = $dist) =~ s{-}{::}g;
66
67 (my $file = $dist) =~ s{-}{/}g;
68 $file = "lib/$file.pm";
69
70 my %PREREQ_PM = (
71  'Carp'     => 0,
72  'Exporter' => 0,
73  'XSLoader' => 0,
74  'base'     => 0,
75 );
76
77 my %BUILD_REQUIRES = (
78  'Carp'                => 0,
79  'Config'              => 0,
80  'ExtUtils::MakeMaker' => 0,
81  'Test::More'          => 0,
82  %PREREQ_PM,
83 );
84
85 my %META = (
86  configure_requires => {
87   'Config'              => 0,
88   'ExtUtils::MakeMaker' => 0,
89  },
90  build_requires => {
91   %BUILD_REQUIRES,
92  },
93  dynamic_config => 1,
94  resources => {
95   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
96   homepage   => "http://search.cpan.org/dist/$dist/",
97   license    => 'http://dev.perl.org/licenses/',
98   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
99  },
100 );
101
102 WriteMakefile(
103  NAME             => $name,
104  AUTHOR           => 'Vincent Pit <perl@profvince.com>',
105  LICENSE          => 'perl',
106  VERSION_FROM     => $file,
107  ABSTRACT_FROM    => $file,
108  PL_FILES         => {},
109  @DEFINES,
110  BUILD_REQUIRES   => \%BUILD_REQUIRES,
111  PREREQ_PM        => \%PREREQ_PM,
112  MIN_PERL_VERSION => '5.008',
113  META_MERGE       => \%META,
114  dist             => {
115   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
116   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
117  },
118  clean            => {
119   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
120  },
121  %macro,
122 );