Merge branch 'current/for_cpan_index' into current/dq
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
fe650234 1use strict;
2use warnings;
3
55087b99 4use 5.008001;
6c96d73f 5use inc::Module::Install 1.06;
90706de1 6BEGIN { makemaker_args( NORECURS => 1 ) } # needs to happen early for old EUMM
ce4c07df 7
d1dc7a98 8##
c5ffac15 9## TEMPORARY (and non-portable)
10## Get the dq stuff
11##
e0937fe2 12my $target_libdir;
13BEGIN {
14 $target_libdir = 'lib/DBIx/Class/_TempExtlib';
15
16 if ($Module::Install::AUTHOR) {
17
18 `rm -rf $target_libdir`;
19 `mkdir $target_libdir`;
20 for (
21 [ 'Data-Query' => 'master' ],
22 [ 'SQL-Abstract' => 'dq' ],
23 ) {
1b40dff2 24 my $tdir = "/tmp/dqlib/$_->[0]/";
e0937fe2 25
26 `rm -rf $tdir`;
27
1b40dff2 28 `GIT_SSH=maint/careless_ssh.bash git clone --bare --quiet --branch=$_->[1] --depth=1 git://git.shadowcat.co.uk/dbsrgits/$_->[0] $tdir`;
e0937fe2 29 printf "\nIncluding %s git rev %s\n",
30 $_->[0],
1b40dff2 31 scalar `GIT_DIR=$tdir git rev-parse $_->[1]`,
e0937fe2 32 ;
1b40dff2 33 `git archive --format=tar --remote=file://$tdir $_->[1] lib/ | tar --strip-components=1 -xC $target_libdir`;
e0937fe2 34
1b40dff2 35 #`rm -rf $tdir`;
e0937fe2 36 }
c0eaf90f 37 }
c5ffac15 38}
c5ffac15 39
e0937fe2 40use lib $target_libdir;
c5ffac15 41
42##
d1dc7a98 43## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
44##
fc4b0448 45# get cpanX --installdeps . to behave in a checkout (most users do not expect
46# the deps for a full test suite run, and if they do - there's MI::AutoInstall
47# for that)
48BEGIN {
49 $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
50}
4b5544ad 51
47589465 52homepage 'http://www.dbix-class.org/';
53resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
54resources 'license' => 'http://dev.perl.org/licenses/';
55resources 'repository' => 'https://github.com/dbsrgits/DBIx-Class';
56resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
57resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
58
ce4c07df 59name 'DBIx-Class';
b50d0dd3 60perl_version '5.008001';
8e0f16f1 61all_from 'lib/DBIx/Class.pm';
294c1f51 62Meta->{values}{x_authority} = 'cpan:RIBASUSHI';
ce4c07df 63
5b0543d6 64# nothing determined at runtime, except for possibly SQLT dep, see
65# comment further down
66dynamic_config 0;
67
fc4b0448 68tests_recursive (qw|
69 t
70|);
8057ed01 71
fc4b0448 72install_script (qw|
73 script/dbicadmin
74|);
90cfe42b 75
fc4b0448 76###
77### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
78### All of them *MUST* go to DBIx::Class::Optional::Dependencies
79###
8057ed01 80my $runtime_requires = {
fc4b0448 81 # FIXME - temporary, needs throwing out for something more efficient
82 'Data::Compare' => '1.22',
83
84 # DBI itself should be capable of installation and execution in pure-perl
85 # mode. However it has never been tested yet, so consider XS for the time
86 # being
5342cd1a 87###
88### IMPORTANT - do not raise this dependency
89### even though many bugfixes are present in newer versions, the general DBIC
90### rule is to bend over backwards for available DBI versions (given upgrading
91### them is often *not* easy or even possible)
92###
fc4b0448 93 'DBI' => '1.57',
94
a08e7b00 95 # on older versions first() leaks
96 # for the time being make it a hard dep - when we get
97 # rid of Sub::Name will revisit this (possibility is
98 # to use Devel::HideXS to force the pure-perl version
99 # or something like that)
100 'List::Util' => '1.16',
101
fc4b0448 102 # XS (or XS-dependent) libs
103 'Sub::Name' => '0.04',
104
105 # pure-perl (FatPack-able) libs
f390d66d 106 'Class::Accessor::Grouped' => '0.10010',
9c1700e3 107 'Class::C3::Componentised' => '1.0009',
8057ed01 108 'Class::Inspector' => '1.24',
79680fc0 109 'Config::Any' => '0.20',
110 'Context::Preserve' => '0.01',
2b8cc2f2 111 'Data::Dumper::Concise' => '2.020',
8057ed01 112 'Data::Page' => '2.00',
90fb8e19 113 'Devel::GlobalDestruction' => '0.09',
b8d22f13 114 'Hash::Merge' => '0.12',
32e01bb6 115 'Moo' => '1.003000',
90fb8e19 116 'MRO::Compat' => '0.12',
117 'Module::Find' => '0.07',
118 'namespace::clean' => '0.24',
f4d7449c 119 'Path::Class' => '0.18',
b7b18f32 120 'Scope::Guard' => '0.03',
1d1ccc94 121 'SQL::Abstract' => '1.77',
90fb8e19 122 'Try::Tiny' => '0.07',
45150bc4 123
124 # Technically this is not a core dependency - it is only required
125 # by the MySQL codepath. However this particular version is bundled
126 # since 5.10.0 and is a pure-perl module anyway - let it slide
127 'Text::Balanced' => '2.00',
32e01bb6 128
129 # deps for Data::Query
130 'SQL::ReservedWords' => '0.8',
131 'Safe::Isa' => '1.000003',
fc4b0448 132};
cd122820 133
fc4b0448 134my $build_requires = {
7850f06e 135};
136
137my $test_requires = {
138 'File::Temp' => '0.22',
139 'Test::Deep' => '0.101',
140 'Test::Exception' => '0.31',
141 'Test::Warn' => '0.21',
142 'Test::More' => '0.94',
143
fc4b0448 144 # needed for testing only, not for operation
145 # we will move away from this dep eventually, perhaps to DBD::CSV or something
5342cd1a 146###
147### IMPORTANT - do not raise this dependency
148### even though many bugfixes are present in newer versions, the general DBIC
149### rule is to bend over backwards for available DBDs (given upgrading them is
150### often *not* easy or even possible)
151###
fc4b0448 152 'DBD::SQLite' => '1.29',
fc4b0448 153
154 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
155 # remove and do a manual glob-collection if n::c is no longer a dep
156 'Package::Stash' => '0.28',
157};
bb7950c0 158
20beaf5f 159# if the user has this env var set and no SQLT installed, tests will fail
5b0543d6 160# Note - this is added as test_requires *directly*, so it gets properly
161# excluded on META.yml cleansing (even though no dist can be created from this)
20beaf5f 162# we force this req regarless of author_deps, worst case scenario it will
163# be specified twice
5b0543d6 164#
165# also note that we *do* set dynamic_config => 0, as this is the only thing
166# that we determine dynamically, and in all fairness if someone sets the
167# envvar *and* is not running a full Makefile/make/maketest cycle - they get
168# to keep the pieces
20beaf5f 169if ($ENV{DBICTEST_SQLT_DEPLOY}) {
170 local @INC = ('lib', @INC);
171 require DBIx::Class::Optional::Dependencies;
172 my $dep_req = DBIx::Class::Optional::Dependencies->req_list_for('deploy');
173 for (keys %$dep_req) {
174 test_requires ($_ => $dep_req->{$_})
175 }
176}
177
8057ed01 178# this is so we can order requires alphabetically
fc4b0448 179# copies are needed for potential author requires injection
8057ed01 180my $reqs = {
181 build_requires => { %$build_requires },
182 requires => { %$runtime_requires },
183 test_requires => { %$test_requires },
184};
3a4251e2 185
c78f9f5b 186# only do author-includes if not part of a `make` run
187if ($Module::Install::AUTHOR and ! $ENV{MAKELEVEL}) {
ffc55e52 188 invoke_author_mode()
189}
190else {
191 # make sure this Makefile can not be used to make a dist
192 # (without the author includes there are no meta cleanup, no sanity checks, etc)
193 postamble <<EOP;
194create_distdir: nonauthor_stop_distdir_creation
195nonauthor_stop_distdir_creation:
196\t\$(NOECHO) \$(ECHO) Creation of dists in non-author mode is not allowed
197\t\$(NOECHO) \$(FALSE)
198EOP
199}
200
201# compose final req list, for alphabetical ordering
202my %final_req;
203for my $rtype (keys %$reqs) {
204 for my $mod (keys %{$reqs->{$rtype}} ) {
205
206 # sanity check req duplications
207 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n"
208 if $final_req{$mod};
209
210 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
211 }
212}
213
214# actual require
215for my $mod (sort keys %final_req) {
216 my ($rtype, $ver) = @{$final_req{$mod}};
217 no strict 'refs';
218 $rtype->($mod, $ver);
219}
220
221# author-mode or not - this is where we show a list of missing deps
222# IFF we are running interactively
223auto_install();
224
225WriteAll();
226
227exit 0;
228
229# needs to be here to keep 5.8 string eval happy
230# (the include of Makefile.PL.inc loop)
231my $mm_proto;
232
233sub invoke_author_mode {
fc4b0448 234 # get options here, make $args available to all snippets
235 require Getopt::Long;
236 my $getopt = Getopt::Long::Parser->new(
237 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
238 );
239 my $args = {
240 skip_author_deps => undef,
241 };
df65d4da 242 $getopt->getoptions($args, qw/
243 skip_author_deps|skip-author-deps
244 /);
fc4b0448 245 if (@ARGV) {
246 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
0424d17a 247 }
8057ed01 248
3ba58fe4 249 # We need the MM facilities to generate the pieces for the final MM run.
250 # Just instantiate a throaway object here
6b3e3947 251 #
252 # Also EUMM and MI disagree on what is the format of Meta->name, just
253 # punt here until a new M::I is shipped (if at all)
254 my $name = Meta->name || die 'The Module::Install metadata must be available at this point but is not - did you rearrange the Makefile.PL...?';
255 $name =~ s/\-/::/g;
ffc55e52 256 $mm_proto = ExtUtils::MakeMaker->new({
3054407e 257 NORECURS => 1,
6b3e3947 258 NAME => $name,
3ba58fe4 259 });
260
ffce4b65 261 # Crutch for DISTBUILDING_IN_HELL
262 # Spits back a working dos2unix snippet to be used on the supplied path(s)
263 # Ironically EUMM's dos2unix is broken on win32 itself - it does
264 # not take into account the CRLF layer present on win32
265 my $crlf_fixup = sub {
266 return '' unless ($^O eq 'MSWin32' or $^O eq 'cygwin');
267 my $targets = join ', ', map { "q($_)" } @_;
268 "\t" . $mm_proto->oneliner( qq(\$ENV{PERLIO}='unix' and system( \$^X, qw( -MExtUtils::Command -e dos2unix -- ), $targets ) ) );
269 };
270
e01862e4 271 # we are in the process of (re)writing the makefile - some things we
272 # call below very well may fail
273 local $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION} = 1;
274
fc4b0448 275 require File::Spec;
276 # string-eval, not do(), because we need to provide the
3ba58fe4 277 # $mm_proto, $reqs and $*_requires lexicals to the included file
fc4b0448 278 # (some includes *do* modify $reqs above)
8baa2122 279 for my $inc (sort glob ( File::Spec->catfile('maint', 'Makefile.PL.inc', '*') ) ) {
280 my $src = do { local (@ARGV, $/) = $inc; <> } or die $!;
281 eval "use warnings; use strict; $src" or die sprintf
282 "Failed execution of %s: %s\n",
283 $inc,
284 ($@ || $! || 'Unknown error'),
285 ;
0424d17a 286 }
8057ed01 287}