]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - Makefile.PL
Add support for copy magic on code prototype clone
[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   $macro{PERL_ARCHIVE} = '',
40  }
41 }
42 print $is_gcc_34 ? "yes\n" : "no\n";
43
44 # Threads, Windows and 5.8.x don't seem to be best friends
45 if ($^O eq 'MSWin32' && "$]" < 5.009) {
46  push @DEFINES, '-DVMG_MULTIPLICITY=0';
47  print "Thread safety disabled for perl 5.8.x on Windows.\n"
48 }
49
50 # Fork emulation got "fixed" in 5.10.1
51 if ($^O eq 'MSWin32' && "$]" < 5.010_001) {
52  push @DEFINES, '-DVMG_FORKSAFE=0';
53  print "Fork safety not ensured for perl 5.8.x and 5.10.0 on Windows.\n";
54 }
55
56 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
57 %macro   = (macro  => { %macro })         if %macro; # Beware of the circle
58
59 my $dist = 'Variable-Magic';
60
61 (my $name = $dist) =~ s{-}{::}g;
62
63 (my $file = $dist) =~ s{-}{/}g;
64 $file = "lib/$file.pm";
65
66 my %PREREQ_PM = (
67  'Carp'     => 0,
68  'Exporter' => 0,
69  'XSLoader' => 0,
70  'base'     => 0,
71 );
72
73 my %BUILD_REQUIRES = (
74  'Carp'                => 0,
75  'Config'              => 0,
76  'ExtUtils::MakeMaker' => 0,
77  'Test::More'          => 0,
78  %PREREQ_PM,
79 );
80
81 my %META = (
82  configure_requires => {
83   'Config'              => 0,
84   'ExtUtils::MakeMaker' => 0,
85  },
86  build_requires => {
87   %BUILD_REQUIRES,
88  },
89  dynamic_config => 1,
90  resources => {
91   bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
92   homepage   => "http://search.cpan.org/dist/$dist/",
93   license    => 'http://dev.perl.org/licenses/',
94   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
95  },
96 );
97
98 WriteMakefile(
99  NAME             => $name,
100  AUTHOR           => 'Vincent Pit <perl@profvince.com>',
101  LICENSE          => 'perl',
102  VERSION_FROM     => $file,
103  ABSTRACT_FROM    => $file,
104  PL_FILES         => {},
105  @DEFINES,
106  BUILD_REQUIRES   => \%BUILD_REQUIRES,
107  PREREQ_PM        => \%PREREQ_PM,
108  MIN_PERL_VERSION => '5.008',
109  META_MERGE       => \%META,
110  dist             => {
111   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
112   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
113  },
114  clean            => {
115   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
116  },
117  %macro,
118 );