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