1 use inc::Module::Install 1.00;
8 use lib "$FindBin::Bin/lib";
9 use DBIx::Class::Optional::Dependencies;
11 # adjust ENV for $AUTHOR system() calls
13 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
17 my $getopt = Getopt::Long::Parser->new(
18 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
21 skip_author_deps => undef,
23 $getopt->getoptions($args, 'skip_author_deps');
25 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
28 # get cpanX --installdeps . to behave in a checkout (most users do not need
29 # the deps for a full test suite run, and if they do - there's MI::AutoInstall
32 ## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
34 $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
37 ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
38 ### All of them should go to DBIx::Class::Optional::Dependencies
42 perl_version '5.008001';
43 all_from 'lib/DBIx/Class.pm';
45 my $build_requires = {
46 # needed for testing only, not for operation
47 'DBD::SQLite' => '1.29',
51 'File::Temp' => '0.22',
52 'Test::Builder' => '0.33',
53 'Test::Exception' => '0.31',
54 'Test::More' => '0.92',
55 'Test::Warn' => '0.21',
57 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
58 # remove and do a manual glob-collection if n::c is no longer a dep
59 'Package::Stash' => '0.28',
62 my $runtime_requires = {
63 'Class::Accessor::Grouped' => '0.10002',
64 'Class::C3::Componentised' => '1.0009',
65 'Class::Inspector' => '1.24',
66 'Config::Any' => '0.20',
67 'Context::Preserve' => '0.01',
68 'Data::Dumper::Concise' => '2.020',
69 'Data::Page' => '2.00',
70 'Hash::Merge' => '0.12',
71 'MRO::Compat' => '0.09',
72 'Module::Find' => '0.06',
73 'Path::Class' => '0.18',
74 'Scope::Guard' => '0.03',
75 'SQL::Abstract' => '1.72',
76 'Try::Tiny' => '0.04',
78 # XS (or XS-dependent) libs
80 'namespace::clean' => '0.20',
81 'Sub::Name' => '0.04',
82 'Variable::Magic' => '0.44',
84 # dual-life corelibs needing a specific bugfixed version
85 'File::Path' => '2.07',
88 # this is so we can order requires alphabetically
89 # copies are needed for author requires injection
91 build_requires => { %$build_requires },
92 requires => { %$runtime_requires },
93 test_requires => { %$test_requires },
96 my %reqs_for_group = %{DBIx::Class::Optional::Dependencies->req_group_list};
98 # exclude the rdbms_* groups which are for DBIC users
100 map { %{$reqs_for_group{$_}} } grep { !/^rdbms_/ } keys %reqs_for_group
103 # require extra modules for testing if we're in a checkout
105 if ($Module::Install::AUTHOR) {
106 if ($args->{skip_author_deps}) {
107 $optdep_msg = <<'EOW';
109 ******************************************************************************
110 ******************************************************************************
112 *** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
114 *** If you are using this checkout with the intention of submitting a DBIC ***
115 *** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
116 *** that every possible unit-test will run. ***
118 ******************************************************************************
119 ******************************************************************************
124 $optdep_msg = <<'EOW';
126 ******************************************************************************
127 ******************************************************************************
129 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
130 *** ( to disable re-run Makefile.PL with --skip_author_deps ) ***
132 ******************************************************************************
133 ******************************************************************************
137 $reqs->{test_requires} = {
138 %{$reqs->{test_requires}},
144 # compose final req list, for alphabetical ordering
146 for my $rtype (keys %$reqs) {
147 for my $mod (keys %{$reqs->{$rtype}} ) {
149 # sanity check req duplications
150 if ($final_req{$mod}) {
151 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
154 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
159 for my $mod (sort keys %final_req) {
160 my ($rtype, $ver) = @{$final_req{$mod}};
162 $rtype->($mod, $ver);
165 # output twice since the deplist is > 70 lines
166 warn $optdep_msg if $Module::Install::AUTHOR;
168 warn $optdep_msg if $Module::Install::AUTHOR;
171 # re-create various autogenerated documentation bits
172 if ($Module::Install::AUTHOR) {
174 print "Regenerating README\n";
175 system('pod2text lib/DBIx/Class.pm > README');
178 print "Removing MANIFEST\n";
182 print "Regenerating Optional/Dependencies.pod\n";
183 require DBIx::Class::Optional::Dependencies;
184 DBIx::Class::Optional::Dependencies->_gen_pod (Meta->version);
186 # FIXME Disabled due to unsolved issues, ask theorbtwo
187 # require Module::Install::Pod::Inherit;
196 # temporary(?) until I get around to fix M::I wrt xt/
197 # needs Module::Install::AuthorTests
199 # this should not be necessary since the autoloader is supposed
200 # to work, but there were reports of it failing
201 require Module::Install::AuthorTests;
202 recursive_author_tests (qw/xt/);
205 if ($Module::Install::AUTHOR && ! $args->{skip_author_deps}) {
208 # better error message in case of missing dep
209 eval { require Module::Install::AuthorTests }
210 || die "\nYou need Module::Install::AuthorTests installed to run this Makefile.PL in author mode (or supply --skip_author_deps):\n\n$@\n";
222 ### Mangle makefile - read the comments for more info
226 # This will add an extra dep-spec for the distdir target,
227 # which `make` will fold together in a first-come first-serve
228 # fashion. What we do here is essentially adding extra
229 # commands to execute once the distdir is assembled (via
230 # create_distdir), but before control is returned to a higher
232 distdir : dbicadmin_pod_inject
234 # The pod self-injection code is in fact a hidden option in
236 dbicadmin_pod_inject :
237 \tcd \$(DISTVNAME) && \$(ABSPERL) -Ilib script/dbicadmin --selfinject-pod
239 # Regenerate manifest before running create_distdir.
240 create_distdir : manifest
244 homepage 'http://www.dbix-class.org/';
245 resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
246 resources 'license' => 'http://dev.perl.org/licenses/';
247 resources 'repository' => 'git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git';
248 resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
249 resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
251 # Deprecated/internal modules need no exposure
252 no_index directory => $_ for (qw|
254 lib/DBIx/Class/PK/Auto
255 lib/DBIx/Class/CDBICompat
257 no_index package => $_ for (qw/
258 DBIx::Class::Storage::DBIHacks
264 # Re-write META.yml to _exclude_ all forced build-requires (we do not want to ship
265 # this) We are also not using M::I::AuthorRequires as this will be an extra dep,
266 # and deps in Makefile.PL still suck
267 # Also always test the result so we stop shipping borked dependency lists to CPAN
269 # FIXME test_requires is not yet part of META
270 my %original_build_requires = ( %$build_requires, %$test_requires );
271 my @all_build_requires = @{delete Meta->{values}{build_requires}};
272 my %removed_build_requires;
274 for (@all_build_requires) {
275 if ($original_build_requires{$_->[0]}) {
276 push @{Meta->{values}{build_requires}}, $_;
279 $removed_build_requires{$_->[0]} = $_->[1]
280 unless $_->[0] eq 'ExtUtils::MakeMaker';
284 # Rewrite only in author mode, the original META should not contain anything anyway
285 # if we executed as non-author
286 if ($Module::Install::AUTHOR && keys %removed_build_requires) {
287 print "Regenerating META with author requires excluded\n";
291 # test that we really took things away (just in case, happened twice somehow)
292 if (! -f 'META.yml') {
293 warn "No META.yml generated?! aborting...\n";
296 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
298 # this is safe as there is a fatal check earlier to make sure $opt_testdeps does
299 # not contain any real dependencies
300 my @illegal_leftovers = grep
301 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
302 ( sort keys %$opt_testdeps )
305 if (@illegal_leftovers) {
307 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
308 map { "\t$_" } @illegal_leftovers