]> git.vpit.fr Git - perl/modules/autovivification.git/blob - Makefile.PL
This is 0.18
[perl/modules/autovivification.git] / Makefile.PL
1 use 5.008_003;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 use Config;
8
9 if ($Config{d_cplusplus}) {
10  print STDERR <<'FAILPLUSPLUS';
11 Configuration aborted: C++ compilers are not supported
12
13     Your perl has been built with a C++ compiler, which is then handed to
14     XS extensions as if it were a proper C compiler. This extension is
15     written in C, and naturally only supports C compilers, so it cannot be
16     built with your perl.
17
18     Note that building perl with a C++ compiler is only supposed to be done
19     by core developers in order to check that the perl headers can be
20     included from C++ code. Its use in the wild is not supported by the
21     perl5 porters. If your vendor has built its perl binary with a C++
22     compiler, please consider reporting this issue to them.
23
24     This text will be displayed 10 seconds, and then the configuration
25     script will exit.
26 FAILPLUSPLUS
27  sleep 10;
28  exit 0;
29 }
30
31 my @DEFINES;
32 my %macro;
33
34 my $is_gcc_34 = 0;
35 print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
36 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
37  my ($libperl, $gccversion) = map $_ || '', @Config{qw<libperl gccversion>};
38  if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
39   $is_gcc_34 = 1;
40   my ($lddlflags, $ldflags) = @Config{qw<lddlflags ldflags>};
41   $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
42   $libperl = "-l$libperl";
43   my $libdirs = join ' ',
44                  map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
45                   @Config{qw<bin sitebin>};
46   $macro{LDDLFLAGS}    = "$lddlflags $libdirs $libperl";
47   $macro{LDFLAGS}      = "$ldflags $libdirs $libperl";
48   eval <<'  MY_SECTION';
49    package MY;
50    sub dynamic_lib {
51     my $self = shift;
52     my $inherited = $self->SUPER::dynamic_lib(@_);
53     $inherited =~ s/"?\$\(PERL_ARCHIVE\)"?//g;
54     return $inherited;
55    }
56   MY_SECTION
57   die $@ if $@;
58  }
59 }
60 print $is_gcc_34 ? "yes\n" : "no\n";
61
62 # Threads, Windows and 5.8.x don't seem to be best friends
63 if ($^O eq 'MSWin32' && "$]" < 5.009) {
64  push @DEFINES, '-DXSH_MULTIPLICITY=0';
65 }
66
67 # Fork emulation got "fixed" in 5.10.1
68 if ($^O eq 'MSWin32' && "$]" < 5.010_001) {
69  push @DEFINES, '-DXSH_FORKSAFE=0';
70 }
71
72 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
73 %macro   = (macro  => { %macro })         if %macro; # Beware of the circle
74
75 my $dist = 'autovivification';
76
77 (my $name = $dist) =~ s{-}{::}g;
78
79 (my $file = $dist) =~ s{-}{/}g;
80 $file = "lib/$file.pm";
81
82 my %PREREQ_PM = (
83  'XSLoader' => 0,
84 );
85
86 my %BUILD_REQUIRES = (
87  'Config'              => 0,
88  'Exporter'            => 0,
89  'ExtUtils::MakeMaker' => 0,
90  'POSIX'               => 0,
91  'Test::More'          => 0,
92  %PREREQ_PM,
93 );
94
95 my %META = (
96  configure_requires => {
97   'ExtUtils::MakeMaker' => 0,
98  },
99  build_requires => {
100   %BUILD_REQUIRES,
101  },
102  dynamic_config => 1,
103  resources => {
104   bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
105   homepage   => "http://search.cpan.org/dist/$dist/",
106   license    => 'http://dev.perl.org/licenses/',
107   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
108  },
109 );
110
111 WriteMakefile(
112  NAME             => $name,
113  AUTHOR           => 'Vincent Pit <perl@profvince.com>',
114  LICENSE          => 'perl',
115  VERSION_FROM     => $file,
116  ABSTRACT_FROM    => $file,
117  PL_FILES         => {},
118  @DEFINES,
119  BUILD_REQUIRES   => \%BUILD_REQUIRES,
120  PREREQ_PM        => \%PREREQ_PM,
121  MIN_PERL_VERSION => '5.008003',
122  META_MERGE       => \%META,
123  dist             => {
124   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
125   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
126  },
127  clean            => {
128   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
129  },
130  %macro,
131 );
132
133 package MY;
134
135 sub postamble {
136  return <<'POSTAMBLE';
137 testdeb: all
138         PERL_DL_NONLAZY=1 PERLDB_OPTS="NonStop=1" $(FULLPERLRUN) -MTAP::Harness -e 'TAP::Harness->new({verbosity => q{$(VERBOSE)}, lib => [ q{$(INST_LIB)}, q{$(INST_ARCHLIB)} ], switches => [ q{-d} ]})->runtests(@ARGV)' $(TEST_FILES)
139 POSTAMBLE
140 }