]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blob - Makefile.PL
6064175be3536ce232a2127ba489bf761ac6969e
[perl/modules/Lexical-Types.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, '-DLT_MULTIPLICITY=0';
39 }
40
41 # Fork emulation got "fixed" in 5.10.1
42 if ($^O eq 'MSWin32' && "$]" < 5.010001) {
43  push @DEFINES, '-DLT_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 = 'Lexical-Types';
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  'Carp'     => 0,
58  'XSLoader' => 0,
59 );
60
61 my %META = (
62  configure_requires => {
63   'ExtUtils::MakeMaker' => 0,
64  },
65  build_requires => {
66   'ExtUtils::MakeMaker' => 0,
67   'Test::More'          => 0,
68   'constant'            => 0,
69   %PREREQ_PM,
70  },
71  dynamic_config => 1,
72  resources => {
73   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
74   homepage   => "http://search.cpan.org/dist/$dist/",
75   license    => 'http://dev.perl.org/licenses/',
76   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
77  },
78 );
79
80 WriteMakefile(
81  NAME             => $name,
82  AUTHOR           => 'Vincent Pit <perl@profvince.com>',
83  LICENSE          => 'perl',
84  VERSION_FROM     => $file,
85  ABSTRACT_FROM    => $file,
86  PL_FILES         => {},
87  @DEFINES,
88  PREREQ_PM        => \%PREREQ_PM,
89  MIN_PERL_VERSION => 5.008003,
90  META_MERGE       => \%META,
91  dist             => {
92   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
93   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
94  },
95  clean            => {
96   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
97  },
98  %macro,
99 );