]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - Makefile.PL
Disable the Win32 AS Perl workaround for now, as it doesn't seem to be relevant for...
[perl/modules/Variable-Magic.git] / Makefile.PL
1 use 5.007003;
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
15 my $pl = $Config{perl_patchlevel};
16 print "Checking perl patchlevel... ";
17 if (defined $pl && length $pl) {
18  $pl = int $pl;
19  push @DEFINES, '-DVMG_PERL_PATCHLEVEL=' . $pl;
20  print $pl, "\n";
21 } else {
22  print "none\n";
23 }
24
25 my $is_as = 0;
26 print "Checking if this is Windows ActiveState 5.8.[78]... ";
27 if ($^O eq 'MSWin32' && $^V ge v5.8.7 && $^V lt v5.8.9) {
28  eval {
29   require Win32;
30   1;
31  } and do {
32   if (defined &Win32::BuildNumber) {
33    $is_as = 1;
34   }
35  }
36 }
37 print $is_as ? "yes\n" : "no\n";
38
39 # Threads, Windows and 5.8.x don't seem to be best friends
40 if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
41  push @DEFINES, '-DVMG_MULTIPLICITY=0';
42 }
43
44 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
45
46 my $BUILD_REQUIRES = {
47  'Config'              => 0,
48  'ExtUtils::MakeMaker' => 0,
49  'Test::More'          => 0,
50 };
51
52 sub build_req {
53  my $tometa = ' >> $(DISTVNAME)/META.yml;';
54  my $build_req = 'echo "build_requires:" ' . $tometa;
55  foreach my $mod ( sort { lc $a cmp lc $b } keys %$BUILD_REQUIRES ) {
56   my $ver = $BUILD_REQUIRES->{$mod};
57   $build_req .= sprintf 'echo "    %-30s %s" %s', "$mod:", $ver, $tometa;
58  }
59  return $build_req;
60 }
61
62 my $RESOURCES = {
63  'repository' => 'http://git.profvince.com/perl/modules/Variable-Magic.git',
64  'bugtracker' => 'http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Variable-Magic',
65 };
66
67 sub resources {
68  my $tometa = ' >> $(DISTVNAME)/META.yml;';
69  my $build_req = 'echo "resources:" ' . $tometa;
70  foreach my $res ( sort { lc $a cmp lc $b } keys %$RESOURCES ) {
71   my $val = $RESOURCES->{$res};
72   $build_req .= sprintf 'echo "    %-15s %s" %s', "$res:", $val, $tometa;
73  }
74  return $build_req;
75 }
76
77 WriteMakefile(
78     NAME          => 'Variable::Magic',
79     AUTHOR        => 'Vincent Pit <perl@profvince.com>',
80     LICENSE       => 'perl',
81     VERSION_FROM  => 'lib/Variable/Magic.pm',
82     ABSTRACT_FROM => 'lib/Variable/Magic.pm',
83     PL_FILES      => {},
84     @DEFINES,
85     PREREQ_PM     => {
86         'Carp'     => 0,
87         'Exporter' => 0,
88         'XSLoader' => 0
89     },
90     dist          => { 
91         PREOP      => 'pod2text lib/Variable/Magic.pm > $(DISTVNAME)/README; '
92                       . build_req . resources,
93         COMPRESS   => 'gzip -9f', SUFFIX => 'gz'
94     },
95     clean         => { FILES => 'Variable-Magic-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt' },
96 );