]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blob - Makefile.PL
fixup t/13-reap-ctl.t for 5.23.8
[perl/modules/Scope-Upper.git] / Makefile.PL
1 use 5.006_001;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 use Config;
8
9 my $pl   = $Config{perl_patchlevel};
10 my $desc = $Config{git_describe};
11 for ($pl, $desc) {
12  $_ = undef unless defined and length;
13 }
14
15 my @DEFINES;
16 my %macro;
17
18 print "Checking if this is an official release of perl... ";
19 my $is_release = ("$]" < 5.011) ? (defined($pl) || defined($desc) ? 0 : 1)
20                                 : (defined($desc)                 ? 0 : 1);
21 push @DEFINES, "-DSU_RELEASE=$is_release";
22 print $is_release  ? "yes\n" : "no\n";
23
24 my $is_gcc_34 = 0;
25 print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
26 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
27  my ($libperl, $gccversion) = map $_ || '', @Config{qw<libperl gccversion>};
28  if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
29   $is_gcc_34 = 1;
30   my ($lddlflags, $ldflags) = @Config{qw<lddlflags ldflags>};
31   $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
32   $libperl = "-l$libperl";
33   my $libdirs = join ' ',
34                  map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
35                   @Config{qw<bin sitebin>};
36   $macro{LDDLFLAGS}    = "$lddlflags $libdirs $libperl";
37   $macro{LDFLAGS}      = "$ldflags $libdirs $libperl";
38   eval <<'  MY_SECTION';
39    package MY;
40    sub dynamic_lib {
41     my $self = shift;
42     my $inherited = $self->SUPER::dynamic_lib(@_);
43     $inherited =~ s/"?\$\(PERL_ARCHIVE\)"?//g;
44     return $inherited;
45    }
46   MY_SECTION
47   die $@ if $@;
48  }
49 }
50 print $is_gcc_34 ? "yes\n" : "no\n";
51
52 # Threads, Windows and 5.8.x don't seem to be best friends
53 if ($^O eq 'MSWin32' && "$]" < 5.009) {
54  push @DEFINES, '-DXSH_MULTIPLICITY=0';
55 }
56
57 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
58 %macro   = (macro  => { %macro })         if %macro; # Beware of the cycle
59
60 my $dist = 'Scope-Upper';
61
62 (my $name = $dist) =~ s{-}{::}g;
63
64 (my $file = $dist) =~ s{-}{/}g;
65 $file = "lib/$file.pm";
66
67 my %PREREQ_PM = (
68  'Exporter' => 0,
69  'XSLoader' => 0,
70  'base'     => 0,
71 );
72
73 my %BUILD_REQUIRES = (
74  'ExtUtils::MakeMaker' => 0,
75  'Config'              => 0,
76  'POSIX'               => 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.006001',
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 );
119
120 package MY;
121
122 sub postamble {
123  return <<'POSTAMBLE';
124 testdeb: all
125         PERL_DL_NONLAZY=1 PERLDB_OPTS="NonStop=1" $(FULLPERLRUN) -MTAP::Harness -e 'TAP::Harness->new({verbosity => q{$(TEST_VERBOSE)}, lib => [ q{$(INST_LIB)}, q{$(INST_ARCHLIB)} ], switches => [ q{-d} ]})->runtests(@ARGV)' $(TEST_FILES)
126 POSTAMBLE
127 }