Remove all "magic number" DBI get_info calls from the codebase
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
fe650234 1use strict;
2use warnings;
3
55087b99 4use 5.008001;
fc4b0448 5use inc::Module::Install 1.00;
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
44 # DBI itself should be capable of installation and execution in pure-perl
45 # mode. However it has never been tested yet, so consider XS for the time
46 # being
47 'DBI' => '1.57',
48
49 # XS (or XS-dependent) libs
50 'Sub::Name' => '0.04',
51
52 # pure-perl (FatPack-able) libs
b8d22f13 53 'Class::Accessor::Grouped' => '0.10002',
9c1700e3 54 'Class::C3::Componentised' => '1.0009',
8057ed01 55 'Class::Inspector' => '1.24',
a4367b26 56 'Class::Method::Modifiers' => '1.06',
79680fc0 57 'Config::Any' => '0.20',
58 'Context::Preserve' => '0.01',
2b8cc2f2 59 'Data::Dumper::Concise' => '2.020',
8057ed01 60 'Data::Page' => '2.00',
b8d22f13 61 'Hash::Merge' => '0.12',
9345b14c 62 'Moo' => '0.009013',
8057ed01 63 'MRO::Compat' => '0.09',
64 'Module::Find' => '0.06',
cd122820 65 'namespace::clean' => '0.20',
f4d7449c 66 'Path::Class' => '0.18',
b7b18f32 67 'Scope::Guard' => '0.03',
bf51641f 68 'SQL::Abstract' => '1.72',
20674fcd 69 'Try::Tiny' => '0.04',
79680fc0 70
c7d50a7d 71 # dual-life corelibs needing a specific bugfixed version
79680fc0 72 'File::Path' => '2.07',
fc4b0448 73};
cd122820 74
fc4b0448 75my $build_requires = {
76 # needed for testing only, not for operation
77 # we will move away from this dep eventually, perhaps to DBD::CSV or something
78 'DBD::SQLite' => '1.29',
8057ed01 79};
80
fc4b0448 81my $test_requires = {
82 'File::Temp' => '0.22',
83 'Test::Exception' => '0.31',
84 'Test::Warn' => '0.21',
85 'Test::More' => '0.94',
86 # not sure if this is necessary at all, ask schwern some day
87 'Test::Builder' => '0.94',
88
89 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
90 # remove and do a manual glob-collection if n::c is no longer a dep
91 'Package::Stash' => '0.28',
92};
bb7950c0 93
9345b14c 94# make strictures.pm happy (DO NOT LIKE, TOO MUCH XS!)
95# (i.e. what if the .git/.svn is *not* because of DBIC?)
96#
97# Note - this is added as test_requires *directly*, so it gets properly
98# excluded on META.yml cleansing
99if (-e '.git' or -e '.svn') {
100 test_requires 'indirect' => '0.25';
101 test_requires 'multidimensional' => '0.008';
102 test_requires 'bareword::filehandles' => '0.003';
103}
104
bb7950c0 105# Bail out on parallel testing
106if (
107 ($ENV{HARNESS_OPTIONS}||'') =~ / (?: ^ | \: ) j(\d+) /x
108 and
109 $1 > 1
110) { die <<EOP }
111
112******************************************************************************
113******************************************************************************
114*** ***
115*** PARALLEL TESTING DETECTED ( \$ENV{HARNESS_OPTIONS} = 'j$1' ) ***
116*** ***
fc4b0448 117*** DBIC tests WILL FAIL. It is harder to make them parallel-friendly than ***
bb7950c0 118*** it should be (though work is underway). In the meantime you will have ***
119*** to adjust your environment and re-run the installation. Sorry! ***
120*** ***
121******************************************************************************
122******************************************************************************
123
124EOP
125
8057ed01 126# this is so we can order requires alphabetically
fc4b0448 127# copies are needed for potential author requires injection
8057ed01 128my $reqs = {
129 build_requires => { %$build_requires },
130 requires => { %$runtime_requires },
131 test_requires => { %$test_requires },
132};
3a4251e2 133
c78f9f5b 134# only do author-includes if not part of a `make` run
135if ($Module::Install::AUTHOR and ! $ENV{MAKELEVEL}) {
fc4b0448 136 # get options here, make $args available to all snippets
137 require Getopt::Long;
138 my $getopt = Getopt::Long::Parser->new(
139 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
140 );
141 my $args = {
142 skip_author_deps => undef,
143 };
df65d4da 144 $getopt->getoptions($args, qw/
145 skip_author_deps|skip-author-deps
146 /);
fc4b0448 147 if (@ARGV) {
148 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
0424d17a 149 }
8057ed01 150
fc4b0448 151 require File::Spec;
152 # string-eval, not do(), because we need to provide the
153 # $reqs and $*_requires lexicals to the included file
154 # (some includes *do* modify $reqs above)
155 for (sort glob ( File::Spec->catfile('maint', 'Makefile.PL.inc', '*') ) ) {
156 eval scalar do { local (@ARGV, $/) = $_; <> }
157 or die ($@ || $!);
0424d17a 158 }
8057ed01 159}
fc4b0448 160else {
161 # make sure this Makefile can not be used to make a dist
0e016219 162 # (without the author includes there are no meta cleanup, no sanity checks, etc)
fc4b0448 163 postamble <<EOP;
164.PHONY: nonauthor_stop_distdir_creation
165create_distdir: nonauthor_stop_distdir_creation
166nonauthor_stop_distdir_creation:
167\t\$(NOECHO) \$(ECHO) Creation of dists in non-author mode is not allowed
168\t\$(NOECHO) \$(FALSE)
169EOP
19b088d1 170
171 # if the user has this env var set and no SQLT installed, tests will fail
172 # same rationale for direct test_requires as the strictures stuff above
173 # (even though no dist will be created from this)
174 if ($ENV{DBICTEST_SQLT_DEPLOY}) {
175 local @INC = ('lib', @INC);
176 require DBIx::Class::Optional::Dependencies;
177 my $dep_req = DBIx::Class::Optional::Dependencies->req_list_for('deploy');
178 for (keys %$dep_req) {
179 test_requires ($_ => $dep_req->{$_})
180 }
181 }
fc4b0448 182}
8057ed01 183
184# compose final req list, for alphabetical ordering
185my %final_req;
186for my $rtype (keys %$reqs) {
187 for my $mod (keys %{$reqs->{$rtype}} ) {
188
189 # sanity check req duplications
190 if ($final_req{$mod}) {
b718fd0a 191 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
8057ed01 192 }
193
194 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
195 }
196}
197
198# actual require
199for my $mod (sort keys %final_req) {
200 my ($rtype, $ver) = @{$final_req{$mod}};
201 no strict 'refs';
202 $rtype->($mod, $ver);
203}
a410299d 204
fc4b0448 205# author-mode or not - this is where we show a list of missing deps
206# IFF we are running interactively
92f8f62a 207auto_install();
a410299d 208
713cc98e 209WriteAll();