1 use inc::Module::Install 1.00;
8 use lib "$FindBin::Bin/lib";
9 use DBIx::Class::Optional::Dependencies;
11 # get cpanX --installdeps . to behave in a checkout (most users do not need
12 # the deps for a full test suite run, and if they do - there's MI::AutoInstall
15 ## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
17 $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
20 ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
21 ### All of them should go to DBIx::Class::Optional::Dependencies
25 perl_version '5.008001';
26 all_from 'lib/DBIx/Class.pm';
28 my $build_requires = {
29 # needed for testing only, not for operation
30 'DBD::SQLite' => '1.29',
34 'File::Temp' => '0.22',
35 'Test::Exception' => '0.31',
36 'Test::Warn' => '0.21',
37 'Test::More' => '0.94',
38 # not sure if this is necessary at all, ask schwern some day
39 'Test::Builder' => '0.94',
41 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
42 # remove and do a manual glob-collection if n::c is no longer a dep
43 'Package::Stash' => '0.28',
46 my $runtime_requires = {
47 'Class::Accessor::Grouped' => '0.10002',
48 'Class::C3::Componentised' => '1.0009',
49 'Class::Inspector' => '1.24',
50 'Config::Any' => '0.20',
51 'Context::Preserve' => '0.01',
52 'Data::Dumper::Concise' => '2.020',
53 'Data::Page' => '2.00',
54 'Hash::Merge' => '0.12',
55 'MRO::Compat' => '0.09',
56 'Module::Find' => '0.06',
57 'namespace::clean' => '0.20',
58 'Path::Class' => '0.18',
59 'Scope::Guard' => '0.03',
60 'SQL::Abstract' => '1.72',
61 'Try::Tiny' => '0.04',
63 # XS (or XS-dependent) libs
65 'Sub::Name' => '0.04',
67 # dual-life corelibs needing a specific bugfixed version
68 'File::Path' => '2.07',
70 # FIXME - temporary, needs throwing out for something more efficient
71 'Data::Compare' => '1.22',
75 # Bail out on parallel testing
77 ($ENV{HARNESS_OPTIONS}||'') =~ / (?: ^ | \: ) j(\d+) /x
82 ******************************************************************************
83 ******************************************************************************
85 *** PARALLEL TESTING DETECTED ( \$ENV{HARNESS_OPTIONS} = 'j$1' ) ***
87 *** DBIC tests will fail. It is harder to make them parallel-friendly than ***
88 *** it should be (though work is underway). In the meantime you will have ***
89 *** to adjust your environment and re-run the installation. Sorry! ***
91 ******************************************************************************
92 ******************************************************************************
97 my $getopt = Getopt::Long::Parser->new(
98 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
101 skip_author_deps => undef,
103 $getopt->getoptions($args, 'skip_author_deps');
105 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
108 # this is so we can order requires alphabetically
109 # copies are needed for author requires injection
111 build_requires => { %$build_requires },
112 requires => { %$runtime_requires },
113 test_requires => { %$test_requires },
116 my %reqs_for_group = %{DBIx::Class::Optional::Dependencies->req_group_list};
118 # exclude the rdbms_* groups which are for DBIC users
120 map { %{$reqs_for_group{$_}} } grep { !/^rdbms_/ } keys %reqs_for_group
123 # require extra modules for testing if we're in a checkout
125 if ($Module::Install::AUTHOR) {
126 if ($args->{skip_author_deps}) {
127 $optdep_msg = <<'EOW';
129 ******************************************************************************
130 ******************************************************************************
132 *** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
134 *** If you are using this checkout with the intention of submitting a DBIC ***
135 *** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
136 *** that every possible unit-test will run. ***
138 ******************************************************************************
139 ******************************************************************************
144 $optdep_msg = <<'EOW';
146 ******************************************************************************
147 ******************************************************************************
149 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
150 *** ( to disable re-run Makefile.PL with --skip_author_deps ) ***
152 ******************************************************************************
153 ******************************************************************************
157 $reqs->{test_requires} = {
158 %{$reqs->{test_requires}},
164 # compose final req list, for alphabetical ordering
166 for my $rtype (keys %$reqs) {
167 for my $mod (keys %{$reqs->{$rtype}} ) {
169 # sanity check req duplications
170 if ($final_req{$mod}) {
171 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
174 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
179 for my $mod (sort keys %final_req) {
180 my ($rtype, $ver) = @{$final_req{$mod}};
182 $rtype->($mod, $ver);
185 # output twice since the deplist is > 70 lines
186 warn $optdep_msg if $Module::Install::AUTHOR;
188 warn $optdep_msg if $Module::Install::AUTHOR;
191 # re-create various autogenerated documentation bits
192 if ($Module::Install::AUTHOR) {
194 # adjust ENV for $AUTHOR system() calls
196 $ENV{PERL5LIB} = join ($Config::Config{path_sep}, @INC);
198 print "Regenerating README\n";
199 system('pod2text lib/DBIx/Class.pm > README');
202 print "Removing MANIFEST\n";
206 print "Regenerating Optional/Dependencies.pod\n";
207 require DBIx::Class::Optional::Dependencies;
208 DBIx::Class::Optional::Dependencies->_gen_pod (Meta->version);
210 # FIXME Disabled due to unsolved issues, ask theorbtwo
211 # require Module::Install::Pod::Inherit;
220 # temporary(?) until I get around to fix M::I wrt xt/
221 # needs Module::Install::AuthorTests
223 # this should not be necessary since the autoloader is supposed
224 # to work, but there were reports of it failing
225 require Module::Install::AuthorTests;
226 recursive_author_tests (qw/xt/);
229 if ($Module::Install::AUTHOR && ! $args->{skip_author_deps}) {
232 # better error message in case of missing dep
233 eval { require Module::Install::AuthorTests }
234 || die "\nYou need Module::Install::AuthorTests installed to run this Makefile.PL in author mode (or supply --skip_author_deps):\n\n$@\n";
246 ### Mangle makefile - read the comments for more info
250 # This will add an extra dep-spec for the distdir target,
251 # which `make` will fold together in a first-come first-serve
252 # fashion. What we do here is essentially adding extra
253 # commands to execute once the distdir is assembled (via
254 # create_distdir), but before control is returned to a higher
256 distdir : dbicadmin_pod_inject
258 # The pod self-injection code is in fact a hidden option in
260 dbicadmin_pod_inject :
261 \tcd \$(DISTVNAME) && \$(ABSPERL) -Ilib script/dbicadmin --selfinject-pod
263 # Regenerate manifest before running create_distdir.
264 create_distdir : manifest
268 homepage 'http://www.dbix-class.org/';
269 resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
270 resources 'license' => 'http://dev.perl.org/licenses/';
271 resources 'repository' => 'git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git';
272 resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
273 resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
275 # Deprecated/internal modules need no exposure
276 no_index directory => $_ for (qw|
278 lib/DBIx/Class/PK/Auto
279 lib/DBIx/Class/CDBICompat
281 no_index package => $_ for (qw/
282 DBIx::Class::Storage::DBIHacks
284 DBIx::Class::ResultSet::Pager
289 # Re-write META.yml to _exclude_ all forced build-requires (we do not want to ship
290 # this) We are also not using M::I::AuthorRequires as this will be an extra dep,
291 # and deps in Makefile.PL still suck
292 # Also always test the result so we stop shipping borked dependency lists to CPAN
294 # FIXME test_requires is not yet part of META
295 my %original_build_requires = ( %$build_requires, %$test_requires );
296 my @all_build_requires = @{delete Meta->{values}{build_requires}};
297 my %removed_build_requires;
299 for (@all_build_requires) {
300 if ($original_build_requires{$_->[0]}) {
301 push @{Meta->{values}{build_requires}}, $_;
304 $removed_build_requires{$_->[0]} = $_->[1]
305 unless $_->[0] eq 'ExtUtils::MakeMaker';
309 # Rewrite only in author mode, the original META should not contain anything anyway
310 # if we executed as non-author
311 if ($Module::Install::AUTHOR && keys %removed_build_requires) {
312 print "Regenerating META with author requires excluded\n";
316 # test that we really took things away (just in case, happened twice somehow)
317 if (! -f 'META.yml') {
318 warn "No META.yml generated?! aborting...\n";
321 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
323 # this is safe as there is a fatal check earlier to make sure $opt_testdeps does
324 # not contain any real dependencies
325 my @illegal_leftovers = grep
326 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
327 ( sort keys %$opt_testdeps )
330 if (@illegal_leftovers) {
332 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
333 map { "\t$_" } @illegal_leftovers