]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blob - Makefile.PL
Simplify Config loading in Makefile.PL
[perl/modules/Lexical-Types.git] / Makefile.PL
1 use 5.008003;
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   $macro{PERL_ARCHIVE} = '',
27  }
28 }
29 print $is_gcc_34 ? "yes\n" : "no\n";
30
31 # Threads, Windows and 5.8.x don't seem to be best friends
32 if ($^O eq 'MSWin32' && "$]" < 5.009) {
33  push @DEFINES, '-DLT_MULTIPLICITY=0';
34 }
35
36 # Fork emulation got "fixed" in 5.10.1
37 if ($^O eq 'MSWin32' && "$]" < 5.010001) {
38  push @DEFINES, '-DLT_FORKSAFE=0';
39 }
40
41 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
42 %macro   = (macro  => { %macro })         if %macro; # Beware of the circle
43
44 my $dist = 'Lexical-Types';
45
46 (my $name = $dist) =~ s{-}{::}g;
47
48 (my $file = $dist) =~ s{-}{/}g;
49 $file = "lib/$file.pm";
50
51 my %PREREQ_PM = (
52  'Carp'     => 0,
53  'XSLoader' => 0,
54 );
55
56 my %META = (
57  configure_requires => {
58   'Config'              => 0,
59   'ExtUtils::MakeMaker' => 0,
60  },
61  build_requires => {
62   'Config'              => 0,
63   'ExtUtils::MakeMaker' => 0,
64   'Test::More'          => 0,
65   'constant'            => 0,
66   %PREREQ_PM,
67  },
68  dynamic_config => 1,
69  resources => {
70   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
71   homepage   => "http://search.cpan.org/dist/$dist/",
72   license    => 'http://dev.perl.org/licenses/',
73   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
74  },
75 );
76
77 WriteMakefile(
78  NAME             => $name,
79  AUTHOR           => 'Vincent Pit <perl@profvince.com>',
80  LICENSE          => 'perl',
81  VERSION_FROM     => $file,
82  ABSTRACT_FROM    => $file,
83  PL_FILES         => {},
84  @DEFINES,
85  PREREQ_PM        => \%PREREQ_PM,
86  MIN_PERL_VERSION => 5.008003,
87  META_MERGE       => \%META,
88  dist             => {
89   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
90   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
91  },
92  clean            => {
93   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
94  },
95  %macro,
96 );