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