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