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