1 use inc::Module::Install 1.00;
8 use lib "$FindBin::Bin/lib";
10 # adjust ENV for $AUTHOR system() calls
12 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
16 my $getopt = Getopt::Long::Parser->new(
17 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
20 skip_author_deps => undef,
22 $getopt->getoptions($args, 'skip_author_deps');
24 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
28 ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
29 ### All of them should go to DBIx::Class::Optional::Dependencies
33 perl_version '5.008001';
34 all_from 'lib/DBIx/Class.pm';
36 my $build_requires = {
37 'DBD::SQLite' => '1.29',
41 'File::Temp' => '0.22',
42 'Test::Builder' => '0.33',
43 'Test::Exception' => '0',
44 'Test::More' => '0.92',
45 'Test::Warn' => '0.21',
48 my $runtime_requires = {
49 'Carp::Clan' => '6.0',
50 'Class::Accessor::Grouped' => '0.09004',
51 'Class::C3::Componentised' => '1.0005',
52 'Class::Inspector' => '1.24',
53 'Data::Page' => '2.00',
55 'File::Path' => '2.07',
56 'MRO::Compat' => '0.09',
57 'Module::Find' => '0.06',
58 'Path::Class' => '0.18',
59 'SQL::Abstract' => '1.67',
60 'Sub::Name' => '0.04',
61 'Data::Dumper::Concise' => '1.000',
62 'Scope::Guard' => '0.03',
63 'Context::Preserve' => '0.01',
64 'Try::Tiny' => '0.04',
65 'namespace::clean' => '0.14',
66 'Math::BigInt' => '1.89',
67 'Math::Base36' => '0.07',
70 # this is so we can order requires alphabetically
71 # copies are needed for author requires injection
73 build_requires => { %$build_requires },
74 requires => { %$runtime_requires },
75 test_requires => { %$test_requires },
79 # require extra modules for testing if we're in a checkout
81 if ($Module::Install::AUTHOR) {
82 if ($args->{skip_author_deps}) {
83 $optdep_msg = <<'EOW';
85 ******************************************************************************
86 ******************************************************************************
88 *** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
90 *** If you are using this checkout with the intention of submitting a DBIC ***
91 *** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
92 *** that every possible unit-test will run. ***
94 ******************************************************************************
95 ******************************************************************************
100 $optdep_msg = <<'EOW';
102 ******************************************************************************
103 ******************************************************************************
105 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
106 *** ( to disable re-run Makefile.PL with --skip_author_deps ) ***
108 ******************************************************************************
109 ******************************************************************************
113 require DBIx::Class::Optional::Dependencies;
114 $reqs->{test_requires} = {
115 %{$reqs->{test_requires}},
116 map { %$_ } (values %{DBIx::Class::Optional::Dependencies->req_group_list}),
121 # compose final req list, for alphabetical ordering
123 for my $rtype (keys %$reqs) {
124 for my $mod (keys %{$reqs->{$rtype}} ) {
126 # sanity check req duplications
127 if ($final_req{$mod}) {
128 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
131 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
136 for my $mod (sort keys %final_req) {
137 my ($rtype, $ver) = @{$final_req{$mod}};
139 $rtype->($mod, $ver);
142 # output twice since the deplist is > 70 lines
143 warn $optdep_msg if $Module::Install::AUTHOR;
145 warn $optdep_msg if $Module::Install::AUTHOR;
147 # re-create various autogenerated documentation bits
148 if ($Module::Install::AUTHOR) {
150 print "Regenerating README\n";
151 system('pod2text lib/DBIx/Class.pm > README');
154 print "Removing MANIFEST\n";
158 print "Regenerating Optional/Dependencies.pod\n";
159 require DBIx::Class::Optional::Dependencies;
160 DBIx::Class::Optional::Dependencies->_gen_pod;
162 # FIXME Disabled due to unsolved issues, ask theorbtwo
163 # require Module::Install::Pod::Inherit;
172 # temporary(?) until I get around to fix M::I wrt xt/
173 # needs Module::Install::AuthorTests
175 recursive_author_tests (qw/xt/);
178 unless ($args->{skip_author_deps}) {
180 eval { require Module::Install::AuthorTests }
181 || die "\nYou need Module::Install::AuthorTests installed to run this Makefile.PL in author mode (or supply --skip_author_deps):\n\n$@\n";
192 ### Mangle makefile - read the comments for more info
196 # This will add an extra dep-spec for the distdir target,
197 # which `make` will fold together in a first-come first-serve
198 # fashion. What we do here is essentially adding extra
199 # commands to execute once the distdir is assembled (via
200 # create_distdir), but before control is returned to a higher
202 distdir : dbicadmin_pod_inject
204 # The pod self-injection code is in fact a hidden option in
206 dbicadmin_pod_inject :
207 \tcd \$(DISTVNAME) && \$(ABSPERL) -Ilib script/dbicadmin --selfinject-pod
209 # Regenerate manifest before running create_distdir.
210 create_distdir : manifest
214 homepage 'http://www.dbix-class.org/';
215 resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
216 resources 'license' => 'http://dev.perl.org/licenses/';
217 resources 'repository' => 'git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git';
218 resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
219 resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
221 # Deprecated/internal modules need no exposure
222 no_index directory => $_ for (qw|
224 lib/DBIx/Class/PK/Auto
225 lib/DBIx/Class/CDBICompat
227 no_index package => $_ for (qw/
228 DBIx::Class::Storage::DBIHacks
233 # Re-write META.yml to _exclude_ all forced requires (we do not want to ship this)
234 # We are also not using M::I::AuthorRequires as this will be an extra dep, and
235 # deps in Makefile.PL suck (no autoinstall)
236 if ($Module::Install::AUTHOR && ! $args->{skip_author_deps} ) {
238 # FIXME test_requires is not yet part of META
239 my %original_build_requires = ( %$build_requires, %$test_requires );
240 my @all_build_requires = @{delete Meta->{values}{build_requires}};
241 my %removed_build_requires;
243 for (@all_build_requires) {
244 if ($original_build_requires{$_->[0]}) {
245 push @{Meta->{values}{build_requires}}, $_;
248 $removed_build_requires{$_->[0]} = $_->[1]
249 unless $_->[0] eq 'ExtUtils::MakeMaker';
253 print "Regenerating META with author requires excluded\n";
256 # test that we really took things away (just in case)
257 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
258 for (keys %removed_build_requires) {
259 delete $removed_build_requires{$_}
260 unless $meta =~ /^ \s+ $_: \s+ $removed_build_requires{$_} \s* $/mx
263 if (keys %removed_build_requires) {
265 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:",
266 "(most likely a broken Module::Install)\n",
267 map { "\t$_" } (keys %removed_build_requires)