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