fix for RT#77241
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
fe650234 1use strict;
2use warnings;
3
55087b99 4use 5.008001;
6c96d73f 5use inc::Module::Install 1.06;
ce4c07df 6
d1dc7a98 7##
8## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
9##
fc4b0448 10# get cpanX --installdeps . to behave in a checkout (most users do not expect
11# the deps for a full test suite run, and if they do - there's MI::AutoInstall
12# for that)
13BEGIN {
14 $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
15}
4b5544ad 16
ce4c07df 17name 'DBIx-Class';
b50d0dd3 18perl_version '5.008001';
8e0f16f1 19all_from 'lib/DBIx/Class.pm';
ce4c07df 20
fc4b0448 21tests_recursive (qw|
22 t
23|);
8057ed01 24
fc4b0448 25install_script (qw|
26 script/dbicadmin
27|);
90cfe42b 28
fc4b0448 29homepage 'http://www.dbix-class.org/';
30resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
31resources 'license' => 'http://dev.perl.org/licenses/';
32resources 'repository' => 'git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git';
33resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
34resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
8057ed01 35
fc4b0448 36###
37### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
38### All of them *MUST* go to DBIx::Class::Optional::Dependencies
39###
8057ed01 40my $runtime_requires = {
fc4b0448 41 # FIXME - temporary, needs throwing out for something more efficient
42 'Data::Compare' => '1.22',
43
d4a39575 44 # Moo does not yet depend on this higher version
45 'strictures' => '1.003001',
46
fc4b0448 47 # DBI itself should be capable of installation and execution in pure-perl
48 # mode. However it has never been tested yet, so consider XS for the time
49 # being
50 'DBI' => '1.57',
51
52 # XS (or XS-dependent) libs
53 'Sub::Name' => '0.04',
54
55 # pure-perl (FatPack-able) libs
b8d22f13 56 'Class::Accessor::Grouped' => '0.10002',
9c1700e3 57 'Class::C3::Componentised' => '1.0009',
8057ed01 58 'Class::Inspector' => '1.24',
a4367b26 59 'Class::Method::Modifiers' => '1.06',
79680fc0 60 'Config::Any' => '0.20',
61 'Context::Preserve' => '0.01',
2b8cc2f2 62 'Data::Dumper::Concise' => '2.020',
8057ed01 63 'Data::Page' => '2.00',
d6b39e46 64 'Devel::GlobalDestruction' => '0',
b8d22f13 65 'Hash::Merge' => '0.12',
e6ff3658 66 'Moo' => '0.009100',
8057ed01 67 'MRO::Compat' => '0.09',
68 'Module::Find' => '0.06',
cd122820 69 'namespace::clean' => '0.20',
f4d7449c 70 'Path::Class' => '0.18',
b7b18f32 71 'Scope::Guard' => '0.03',
bf51641f 72 'SQL::Abstract' => '1.72',
20674fcd 73 'Try::Tiny' => '0.04',
79680fc0 74
c7d50a7d 75 # dual-life corelibs needing a specific bugfixed version
79680fc0 76 'File::Path' => '2.07',
fc4b0448 77};
cd122820 78
fc4b0448 79my $build_requires = {
80 # needed for testing only, not for operation
81 # we will move away from this dep eventually, perhaps to DBD::CSV or something
82 'DBD::SQLite' => '1.29',
8057ed01 83};
84
fc4b0448 85my $test_requires = {
86 'File::Temp' => '0.22',
87 'Test::Exception' => '0.31',
88 'Test::Warn' => '0.21',
89 'Test::More' => '0.94',
90 # not sure if this is necessary at all, ask schwern some day
91 'Test::Builder' => '0.94',
92
93 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
94 # remove and do a manual glob-collection if n::c is no longer a dep
95 'Package::Stash' => '0.28',
96};
bb7950c0 97
9345b14c 98# make strictures.pm happy (DO NOT LIKE, TOO MUCH XS!)
99# (i.e. what if the .git/.svn is *not* because of DBIC?)
100#
101# Note - this is added as test_requires *directly*, so it gets properly
102# excluded on META.yml cleansing
103if (-e '.git' or -e '.svn') {
104 test_requires 'indirect' => '0.25';
105 test_requires 'multidimensional' => '0.008';
106 test_requires 'bareword::filehandles' => '0.003';
107}
108
20beaf5f 109# if the user has this env var set and no SQLT installed, tests will fail
110# same rationale for direct test_requires as the strictures stuff above
111# (even though no dist will be created from this)
112# we force this req regarless of author_deps, worst case scenario it will
113# be specified twice
114if ($ENV{DBICTEST_SQLT_DEPLOY}) {
115 local @INC = ('lib', @INC);
116 require DBIx::Class::Optional::Dependencies;
117 my $dep_req = DBIx::Class::Optional::Dependencies->req_list_for('deploy');
118 for (keys %$dep_req) {
119 test_requires ($_ => $dep_req->{$_})
120 }
121}
122
8057ed01 123# this is so we can order requires alphabetically
fc4b0448 124# copies are needed for potential author requires injection
8057ed01 125my $reqs = {
126 build_requires => { %$build_requires },
127 requires => { %$runtime_requires },
128 test_requires => { %$test_requires },
129};
3a4251e2 130
c78f9f5b 131# only do author-includes if not part of a `make` run
132if ($Module::Install::AUTHOR and ! $ENV{MAKELEVEL}) {
fc4b0448 133 # get options here, make $args available to all snippets
134 require Getopt::Long;
135 my $getopt = Getopt::Long::Parser->new(
136 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
137 );
138 my $args = {
139 skip_author_deps => undef,
140 };
df65d4da 141 $getopt->getoptions($args, qw/
142 skip_author_deps|skip-author-deps
143 /);
fc4b0448 144 if (@ARGV) {
145 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
0424d17a 146 }
8057ed01 147
fc4b0448 148 require File::Spec;
149 # string-eval, not do(), because we need to provide the
150 # $reqs and $*_requires lexicals to the included file
151 # (some includes *do* modify $reqs above)
8baa2122 152 for my $inc (sort glob ( File::Spec->catfile('maint', 'Makefile.PL.inc', '*') ) ) {
153 my $src = do { local (@ARGV, $/) = $inc; <> } or die $!;
154 eval "use warnings; use strict; $src" or die sprintf
155 "Failed execution of %s: %s\n",
156 $inc,
157 ($@ || $! || 'Unknown error'),
158 ;
0424d17a 159 }
8057ed01 160}
fc4b0448 161else {
162 # make sure this Makefile can not be used to make a dist
0e016219 163 # (without the author includes there are no meta cleanup, no sanity checks, etc)
fc4b0448 164 postamble <<EOP;
165.PHONY: nonauthor_stop_distdir_creation
166create_distdir: nonauthor_stop_distdir_creation
167nonauthor_stop_distdir_creation:
168\t\$(NOECHO) \$(ECHO) Creation of dists in non-author mode is not allowed
169\t\$(NOECHO) \$(FALSE)
170EOP
171}
8057ed01 172
173# compose final req list, for alphabetical ordering
174my %final_req;
175for my $rtype (keys %$reqs) {
176 for my $mod (keys %{$reqs->{$rtype}} ) {
177
178 # sanity check req duplications
179 if ($final_req{$mod}) {
b718fd0a 180 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
8057ed01 181 }
182
183 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
184 }
185}
186
187# actual require
188for my $mod (sort keys %final_req) {
189 my ($rtype, $ver) = @{$final_req{$mod}};
190 no strict 'refs';
191 $rtype->($mod, $ver);
192}
a410299d 193
fc4b0448 194# author-mode or not - this is where we show a list of missing deps
195# IFF we are running interactively
92f8f62a 196auto_install();
a410299d 197
713cc98e 198WriteAll();