]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - Makefile.PL
Encode the README file in UTF-8
[perl/modules/Variable-Magic.git] / Makefile.PL
1 use 5.008;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 BEGIN {
8  eval { require Config };
9  die 'OS unsupported' if $@;
10  Config->import(qw<%Config>);
11 }
12
13 my @DEFINES;
14 my %macro;
15
16 my $as_perl = eval {
17  require ActivePerl;
18  defined &ActivePerl::BUILD ? ActivePerl::BUILD() : undef
19 };
20
21 my $is_as_822 = 0;
22 print "Checking if this is ActiveState Perl 5.8.8 build 822 or higher... ";
23 if ("$]" == 5.008008 and defined $as_perl and $as_perl >= 822) {
24  $is_as_822 = 1;
25  push @DEFINES, '-DVMG_COMPAT_ARRAY_PUSH_NOLEN=1';
26 }
27 print $is_as_822 ? "yes\n" : "no\n";
28
29 my $is_gcc_34 = 0;
30 print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
31 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
32  my ($libperl, $gccversion) = map $_ || '', @Config{qw<libperl gccversion>};
33  if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
34   $is_gcc_34 = 1;
35   my ($lddlflags, $ldflags) = @Config{qw<lddlflags ldflags>};
36   $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
37   $libperl = "-l$libperl";
38   my $libdirs = join ' ',
39                  map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
40                   @Config{qw<bin sitebin>};
41   $macro{LDDLFLAGS}    = "$lddlflags $libdirs $libperl";
42   $macro{LDFLAGS}      = "$ldflags $libdirs $libperl";
43   $macro{PERL_ARCHIVE} = '',
44  }
45 }
46 print $is_gcc_34 ? "yes\n" : "no\n";
47
48 # Threads, Windows and 5.8.x don't seem to be best friends
49 if ($^O eq 'MSWin32' && "$]" < 5.009) {
50  push @DEFINES, '-DVMG_MULTIPLICITY=0';
51  print "Thread safety disabled for perl 5.8.x on Windows.\n"
52 }
53
54 # Fork emulation got "fixed" in 5.10.1
55 if ($^O eq 'MSWin32' && "$]" < 5.010001) {
56  push @DEFINES, '-DVMG_FORKSAFE=0';
57  print "Fork safety not ensured for perl 5.8.x and 5.10.0 on Windows.\n";
58 }
59
60 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
61 %macro   = (macro  => { %macro })         if %macro; # Beware of the circle
62
63 my $dist = 'Variable-Magic';
64
65 (my $name = $dist) =~ s{-}{::}g;
66
67 (my $file = $dist) =~ s{-}{/}g;
68 $file = "lib/$file.pm";
69
70 my %PREREQ_PM = (
71  'Carp'     => 0,
72  'Exporter' => 0,
73  'XSLoader' => 0,
74  'base'     => 0,
75 );
76
77 my %META = (
78  configure_requires => {
79   'Config'              => 0,
80   'ExtUtils::MakeMaker' => 0,
81  },
82  build_requires => {
83   'Carp'                => 0,
84   'Config'              => 0,
85   'ExtUtils::MakeMaker' => 0,
86   'Test::More'          => 0,
87   %PREREQ_PM,
88  },
89  dynamic_config => 1,
90  resources => {
91   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$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  PREREQ_PM        => \%PREREQ_PM,
107  MIN_PERL_VERSION => 5.008,
108  META_MERGE       => \%META,
109  dist             => {
110   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
111   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
112  },
113  clean            => {
114   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
115  },
116  %macro,
117 );