]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blob - Makefile.PL
This is 0.34
[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 if ($Config{d_cplusplus}) {
10  print STDERR <<'FAILPLUSPLUS';
11 Configuration aborted: C++ compilers are not supported
12
13     Your perl has been built with a C++ compiler, which is then handed to
14     XS extensions as if it were a proper C compiler. This extension is
15     written in C, and naturally only supports C compilers, so it cannot be
16     built with your perl.
17
18     Note that building perl with a C++ compiler is only supposed to be done
19     by core developers in order to check that the perl headers can be
20     included from C++ code. Its use in the wild is not supported by the
21     perl5 porters. If your vendor has built its perl binary with a C++
22     compiler, please consider reporting this issue to them.
23
24     This text will be displayed 10 seconds, and then the configuration
25     script will exit.
26 FAILPLUSPLUS
27  sleep 10;
28  exit 0;
29 }
30
31 my $pl   = $Config{perl_patchlevel};
32 my $desc = $Config{git_describe};
33 for ($pl, $desc) {
34  $_ = undef unless defined and length;
35 }
36
37 my @DEFINES;
38 my %macro;
39
40 print "Checking if this is an official release of perl... ";
41 my $is_release = ("$]" < 5.011) ? (defined($pl) || defined($desc) ? 0 : 1)
42                                 : (defined($desc)                 ? 0 : 1);
43 push @DEFINES, "-DSU_RELEASE=$is_release";
44 print $is_release  ? "yes\n" : "no\n";
45
46 my $is_gcc_34 = 0;
47 print "Checking if this is gcc 3.4 on Windows trying to link against an import library... ";
48 if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) {
49  my ($libperl, $gccversion) = map $_ || '', @Config{qw<libperl gccversion>};
50  if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) {
51   $is_gcc_34 = 1;
52   my ($lddlflags, $ldflags) = @Config{qw<lddlflags ldflags>};
53   $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags;
54   $libperl = "-l$libperl";
55   my $libdirs = join ' ',
56                  map { s/(?<!\\)((?:\\\\)*")/\\$1/g; qq[-L"$_"] }
57                   @Config{qw<bin sitebin>};
58   $macro{LDDLFLAGS}    = "$lddlflags $libdirs $libperl";
59   $macro{LDFLAGS}      = "$ldflags $libdirs $libperl";
60   eval <<'  MY_SECTION';
61    package MY;
62    sub dynamic_lib {
63     my $self = shift;
64     my $inherited = $self->SUPER::dynamic_lib(@_);
65     $inherited =~ s/"?\$\(PERL_ARCHIVE\)"?//g;
66     return $inherited;
67    }
68   MY_SECTION
69   die $@ if $@;
70  }
71 }
72 print $is_gcc_34 ? "yes\n" : "no\n";
73
74 # Threads, Windows and 5.8.x don't seem to be best friends
75 if ($^O eq 'MSWin32' && "$]" < 5.009) {
76  push @DEFINES, '-DXSH_MULTIPLICITY=0';
77 }
78
79 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
80 %macro   = (macro  => { %macro })         if %macro; # Beware of the cycle
81
82 my $dist = 'Scope-Upper';
83
84 (my $name = $dist) =~ s{-}{::}g;
85
86 (my $file = $dist) =~ s{-}{/}g;
87 $file = "lib/$file.pm";
88
89 my $bug_web    = "http://rt.cpan.org/Dist/Display.html?Name=$dist",
90 my $bug_mailto = 'bug-' . lc($dist) . '@rt.cpan.org';
91
92 my $repo_host = 'git.vpit.fr';
93 my @repo_path = ('perl', 'modules', "$dist.git");
94 my $repo_url  = join '/', 'http:', '', $repo_host, @repo_path, '';
95 my $repo_web  = "http://$repo_host/?p=" . join('%2F', @repo_path);
96
97 my %PREREQ_PM = (
98  'Exporter' => 0,
99  'XSLoader' => 0,
100  'base'     => 0,
101 );
102
103 my %BUILD_REQUIRES = (
104  'ExtUtils::MakeMaker' => 0,
105  'Config'              => 0,
106  'POSIX'               => 0,
107  'Test::More'          => 0,
108  %PREREQ_PM,
109 );
110
111 my %META = (
112  'meta-spec' => {
113   version => '2',
114   url     => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
115  },
116  configure_requires => {
117   'Config'              => 0,
118   'ExtUtils::MakeMaker' => 0,
119  },
120  build_requires => {
121   %BUILD_REQUIRES,
122  },
123  dynamic_config => 1,
124  resources => {
125   bugtracker => {
126    web    => $bug_web,
127    mailto => $bug_mailto,
128   },
129   homepage   => "http://search.cpan.org/dist/$dist/",
130   license    => 'http://dev.perl.org/licenses/',
131   repository => {
132    type => 'git',
133    url  => $repo_url,
134    web  => $repo_web,
135   },
136  },
137 );
138
139 WriteMakefile(
140  NAME             => $name,
141  AUTHOR           => 'Vincent Pit <vpit@cpan.org>',
142  LICENSE          => 'perl',
143  VERSION_FROM     => $file,
144  ABSTRACT_FROM    => $file,
145  PL_FILES         => {},
146  @DEFINES,
147  BUILD_REQUIRES   => \%BUILD_REQUIRES,
148  PREREQ_PM        => \%PREREQ_PM,
149  MIN_PERL_VERSION => '5.006001',
150  META_MERGE       => \%META,
151  dist             => {
152   PREOP    => "pod2text -u $file > \$(DISTVNAME)/README",
153   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
154  },
155  clean            => {
156   FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"
157  },
158  %macro,
159 );
160
161 package MY;
162
163 sub postamble {
164  return <<'POSTAMBLE';
165 testdeb: all
166         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)
167 POSTAMBLE
168 }