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