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