Add a Pg limit test (just to extend coverage)
[dbsrgits/DBIx-Class-Historic.git] / Makefile.PL
CommitLineData
47a4aa51 1use inc::Module::Install 1.00;
fe650234 2use strict;
3use warnings;
4
55087b99 5use 5.008001;
ce4c07df 6
8057ed01 7use FindBin;
8use lib "$FindBin::Bin/lib";
93c50889 9
97f9f16e 10# adjust ENV for $AUTHOR system() calls
11use Config;
12$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
13
347275d1 14use Getopt::Long ();
15
16my $getopt = Getopt::Long::Parser->new(
17 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
18);
0424d17a 19my $args = {
20 skip_author_deps => undef,
21};
347275d1 22$getopt->getoptions($args, 'skip_author_deps');
0424d17a 23if (@ARGV) {
24 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
25}
97f9f16e 26
4b5544ad 27###
28### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
29### All of them should go to DBIx::Class::Optional::Dependencies
30###
31
ce4c07df 32name 'DBIx-Class';
b50d0dd3 33perl_version '5.008001';
8e0f16f1 34all_from 'lib/DBIx/Class.pm';
ce4c07df 35
8057ed01 36my $build_requires = {
b9df8e39 37 'DBD::SQLite' => '1.29',
8057ed01 38};
39
40my $test_requires = {
30da8374 41 'File::Temp' => '0.22',
42 'Test::Builder' => '0.33',
30da8374 43 'Test::Exception' => '0',
44 'Test::More' => '0.92',
45 'Test::Warn' => '0.21',
8057ed01 46};
47
48my $runtime_requires = {
8057ed01 49 'Carp::Clan' => '6.0',
7653fdac 50 'Class::Accessor::Grouped' => '0.09004',
8057ed01 51 'Class::C3::Componentised' => '1.0005',
52 'Class::Inspector' => '1.24',
53 'Data::Page' => '2.00',
54 'DBI' => '1.609',
c1fdb460 55 'File::Path' => '2.07',
8057ed01 56 'MRO::Compat' => '0.09',
57 'Module::Find' => '0.06',
f4d7449c 58 'Path::Class' => '0.18',
887d8da0 59 'SQL::Abstract' => '1.67',
8057ed01 60 'SQL::Abstract::Limit' => '0.13',
61 'Sub::Name' => '0.04',
62 'Data::Dumper::Concise' => '1.000',
b7b18f32 63 'Scope::Guard' => '0.03',
64 'Context::Preserve' => '0.01',
20674fcd 65 'Try::Tiny' => '0.04',
ecb68746 66 'namespace::clean' => '0.14',
3b5c273e 67 'Math::BigInt' => '1.89',
63ca94e1 68 'Math::Base36' => '0.07',
8057ed01 69};
70
71# this is so we can order requires alphabetically
72# copies are needed for author requires injection
73my $reqs = {
74 build_requires => { %$build_requires },
75 requires => { %$runtime_requires },
76 test_requires => { %$test_requires },
77};
3a4251e2 78
8057ed01 79
92f8f62a 80# require extra modules for testing if we're in a checkout
0424d17a 81my $optdep_msg;
92f8f62a 82if ($Module::Install::AUTHOR) {
0424d17a 83 if ($args->{skip_author_deps}) {
84 $optdep_msg = <<'EOW';
85
86******************************************************************************
87******************************************************************************
88*** ***
89*** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
90*** ***
91*** If you are using this checkout with the intention of submitting a DBIC ***
92*** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
93*** that every possible unit-test will run. ***
94*** ***
95******************************************************************************
96******************************************************************************
97
98EOW
99 }
100 else {
101 $optdep_msg = <<'EOW';
102
8057ed01 103******************************************************************************
104******************************************************************************
105*** ***
106*** AUTHOR MODE: all optional test dependencies converted to hard requires ***
7adae31a 107*** ( to disable re-run Makefile.PL with --skip_author_deps ) ***
8057ed01 108*** ***
109******************************************************************************
110******************************************************************************
111
112EOW
113
0424d17a 114 require DBIx::Class::Optional::Dependencies;
115 $reqs->{test_requires} = {
116 %{$reqs->{test_requires}},
117 map { %$_ } (values %{DBIx::Class::Optional::Dependencies->req_group_list}),
118 };
119 }
8057ed01 120}
121
122# compose final req list, for alphabetical ordering
123my %final_req;
124for my $rtype (keys %$reqs) {
125 for my $mod (keys %{$reqs->{$rtype}} ) {
126
127 # sanity check req duplications
128 if ($final_req{$mod}) {
b718fd0a 129 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
8057ed01 130 }
131
132 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
133 }
134}
135
136# actual require
137for my $mod (sort keys %final_req) {
138 my ($rtype, $ver) = @{$final_req{$mod}};
139 no strict 'refs';
140 $rtype->($mod, $ver);
141}
a410299d 142
0424d17a 143# output twice since the deplist is > 70 lines
f90896ae 144warn $optdep_msg if $Module::Install::AUTHOR;
92f8f62a 145auto_install();
f90896ae 146warn $optdep_msg if $Module::Install::AUTHOR;
92f8f62a 147
148# re-create various autogenerated documentation bits
149if ($Module::Install::AUTHOR) {
150
151 print "Regenerating README\n";
152 system('pod2text lib/DBIx/Class.pm > README');
153
154 if (-f 'MANIFEST') {
155 print "Removing MANIFEST\n";
156 unlink 'MANIFEST';
157 }
158
92f8f62a 159 print "Regenerating Optional/Dependencies.pod\n";
160 require DBIx::Class::Optional::Dependencies;
161 DBIx::Class::Optional::Dependencies->_gen_pod;
162
163 # FIXME Disabled due to unsolved issues, ask theorbtwo
164 # require Module::Install::Pod::Inherit;
165 # PodInherit();
166}
167
f90896ae 168
7eaae8db 169tests_recursive (qw|
170 t
171|);
172
f90896ae 173# temporary(?) until I get around to fix M::I wrt xt/
174# needs Module::Install::AuthorTests
c1fdb460 175eval {
7f2c37b8 176 recursive_author_tests (qw/xt/);
177 1;
178} || do {
22a2062e 179 unless ($args->{skip_author_deps}) {
180 my $err = $@;
181 eval { require Module::Install::AuthorTests }
eeaf8701 182 || die "\nYou need Module::Install::AuthorTests installed to run this Makefile.PL in author mode (or supply --skip_author_deps):\n\n$@\n";
22a2062e 183 die $@;
184 }
7f2c37b8 185};
f90896ae 186
187
a410299d 188install_script (qw|
189 script/dbicadmin
190|);
191
7eaae8db 192
193### Mangle makefile - read the comments for more info
194#
195postamble <<"EOP";
196
197# This will add an extra dep-spec for the distdir target,
198# which `make` will fold together in a first-come first-serve
199# fashion. What we do here is essentially adding extra
200# commands to execute once the distdir is assembled (via
201# create_distdir), but before control is returned to a higher
202# calling rule.
203distdir : dbicadmin_pod_inject
204
205# The pod self-injection code is in fact a hidden option in
206# dbicadmin itself
207dbicadmin_pod_inject :
208\tcd \$(DISTVNAME) && \$(ABSPERL) -Ilib script/dbicadmin --selfinject-pod
209
210# Regenerate manifest before running create_distdir.
211create_distdir : manifest
212
213EOP
214
f90896ae 215homepage 'http://www.dbix-class.org/';
a410299d 216resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
217resources 'license' => 'http://dev.perl.org/licenses/';
aeb669b8 218resources 'repository' => 'git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git';
a410299d 219resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
70fbb0b8 220resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
a410299d 221
974fe5e8 222# Deprecated/internal modules need no exposure
223no_index directory => $_ for (qw|
bc6f129c 224 lib/DBIx/Class/Admin
974fe5e8 225 lib/DBIx/Class/SQLAHacks
281738a4 226 lib/DBIx/Class/PK/Auto
bc6f129c 227 lib/DBIx/Class/CDBICompat
974fe5e8 228|);
229no_index package => $_ for (qw/
974fe5e8 230 DBIx::Class::SQLAHacks DBIx::Class::Storage::DBIHacks
231/);
a410299d 232
269228af 233
713cc98e 234WriteAll();
09d46657 235
80ff5ae0 236# Re-write META.yml to _exclude_ all forced requires (we do not want to ship this)
1278e5f0 237# We are also not using M::I::AuthorRequires as this will be an extra dep, and
238# deps in Makefile.PL suck (no autoinstall)
0424d17a 239if ($Module::Install::AUTHOR && ! $args->{skip_author_deps} ) {
713cc98e 240
8057ed01 241 # FIXME test_requires is not yet part of META
242 my %original_build_requires = ( %$build_requires, %$test_requires );
1278e5f0 243 my @all_build_requires = @{delete Meta->{values}{build_requires}};
244 my %removed_build_requires;
8057ed01 245
1278e5f0 246 for (@all_build_requires) {
247 if ($original_build_requires{$_->[0]}) {
248 push @{Meta->{values}{build_requires}}, $_;
249 }
250 else {
251 $removed_build_requires{$_->[0]} = $_->[1]
252 unless $_->[0] eq 'ExtUtils::MakeMaker';
253 }
254 }
713cc98e 255
1278e5f0 256 print "Regenerating META with author requires excluded\n";
713cc98e 257 Meta->write;
1278e5f0 258
259 # test that we really took things away (just in case)
260 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
261 for (keys %removed_build_requires) {
262 delete $removed_build_requires{$_}
263 unless $meta =~ /^ \s+ $_: \s+ $removed_build_requires{$_} \s* $/mx
264 }
265
266 if (keys %removed_build_requires) {
3ac9a26c 267 die join ("\n",
268 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:",
269 "(most likely a broken Module::Install)\n",
1278e5f0 270 map { "\t$_" } (keys %removed_build_requires)
271 ) . "\n\n";
272 }
09d46657 273}