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