Commit | Line | Data |
47a4aa51 |
1 | use inc::Module::Install 1.00; |
fe650234 |
2 | use strict; |
3 | use warnings; |
4 | |
55087b99 |
5 | use 5.008001; |
ce4c07df |
6 | |
8057ed01 |
7 | use FindBin; |
8 | use lib "$FindBin::Bin/lib"; |
93c50889 |
9 | |
97f9f16e |
10 | # adjust ENV for $AUTHOR system() calls |
11 | use Config; |
12 | $ENV{PERL5LIB} = join ($Config{path_sep}, @INC); |
13 | |
347275d1 |
14 | use Getopt::Long (); |
15 | |
16 | my $getopt = Getopt::Long::Parser->new( |
17 | config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/] |
18 | ); |
0424d17a |
19 | my $args = { |
20 | skip_author_deps => undef, |
21 | }; |
347275d1 |
22 | $getopt->getoptions($args, 'skip_author_deps'); |
0424d17a |
23 | if (@ARGV) { |
24 | warn "\nIgnoring unrecognized option(s): @ARGV\n\n"; |
25 | } |
97f9f16e |
26 | |
d1dc7a98 |
27 | # get cpanX --installdeps . to behave in a checkout (most users do not need |
28 | # the deps for a full test suite run, and if they do - there's MI::AutoInstall |
29 | # for that) |
30 | ## |
31 | ## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad) |
32 | ## |
33 | $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) ); |
34 | |
4b5544ad |
35 | ### |
36 | ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends() |
37 | ### All of them should go to DBIx::Class::Optional::Dependencies |
38 | ### |
39 | |
ce4c07df |
40 | name 'DBIx-Class'; |
b50d0dd3 |
41 | perl_version '5.008001'; |
8e0f16f1 |
42 | all_from 'lib/DBIx/Class.pm'; |
ce4c07df |
43 | |
8057ed01 |
44 | my $build_requires = { |
b9df8e39 |
45 | 'DBD::SQLite' => '1.29', |
8057ed01 |
46 | }; |
47 | |
48 | my $test_requires = { |
30da8374 |
49 | 'File::Temp' => '0.22', |
50 | 'Test::Builder' => '0.33', |
30da8374 |
51 | 'Test::Exception' => '0', |
52 | 'Test::More' => '0.92', |
53 | 'Test::Warn' => '0.21', |
8057ed01 |
54 | }; |
55 | |
56 | my $runtime_requires = { |
8057ed01 |
57 | 'Carp::Clan' => '6.0', |
7653fdac |
58 | 'Class::Accessor::Grouped' => '0.09004', |
8057ed01 |
59 | 'Class::C3::Componentised' => '1.0005', |
60 | 'Class::Inspector' => '1.24', |
61 | 'Data::Page' => '2.00', |
62 | 'DBI' => '1.609', |
c1fdb460 |
63 | 'File::Path' => '2.07', |
8057ed01 |
64 | 'MRO::Compat' => '0.09', |
65 | 'Module::Find' => '0.06', |
f4d7449c |
66 | 'Path::Class' => '0.18', |
b6cd6478 |
67 | 'SQL::Abstract' => '1.68', |
8057ed01 |
68 | 'Sub::Name' => '0.04', |
69 | 'Data::Dumper::Concise' => '1.000', |
b7b18f32 |
70 | 'Scope::Guard' => '0.03', |
71 | 'Context::Preserve' => '0.01', |
20674fcd |
72 | 'Try::Tiny' => '0.04', |
ecb68746 |
73 | 'namespace::clean' => '0.14', |
3b5c273e |
74 | 'Math::BigInt' => '1.89', |
63ca94e1 |
75 | 'Math::Base36' => '0.07', |
b6cd6478 |
76 | 'Config::Any' => '0.20', |
8057ed01 |
77 | }; |
78 | |
79 | # this is so we can order requires alphabetically |
80 | # copies are needed for author requires injection |
81 | my $reqs = { |
82 | build_requires => { %$build_requires }, |
83 | requires => { %$runtime_requires }, |
84 | test_requires => { %$test_requires }, |
85 | }; |
3a4251e2 |
86 | |
8057ed01 |
87 | |
92f8f62a |
88 | # require extra modules for testing if we're in a checkout |
0424d17a |
89 | my $optdep_msg; |
92f8f62a |
90 | if ($Module::Install::AUTHOR) { |
0424d17a |
91 | if ($args->{skip_author_deps}) { |
92 | $optdep_msg = <<'EOW'; |
93 | |
94 | ****************************************************************************** |
95 | ****************************************************************************** |
96 | *** *** |
97 | *** IGNORING AUTHOR MODE: no optional test dependencies will be forced. *** |
98 | *** *** |
99 | *** If you are using this checkout with the intention of submitting a DBIC *** |
100 | *** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so *** |
101 | *** that every possible unit-test will run. *** |
102 | *** *** |
103 | ****************************************************************************** |
104 | ****************************************************************************** |
105 | |
106 | EOW |
107 | } |
108 | else { |
109 | $optdep_msg = <<'EOW'; |
110 | |
8057ed01 |
111 | ****************************************************************************** |
112 | ****************************************************************************** |
113 | *** *** |
114 | *** AUTHOR MODE: all optional test dependencies converted to hard requires *** |
7adae31a |
115 | *** ( to disable re-run Makefile.PL with --skip_author_deps ) *** |
8057ed01 |
116 | *** *** |
117 | ****************************************************************************** |
118 | ****************************************************************************** |
119 | |
120 | EOW |
121 | |
0424d17a |
122 | require DBIx::Class::Optional::Dependencies; |
123 | $reqs->{test_requires} = { |
124 | %{$reqs->{test_requires}}, |
125 | map { %$_ } (values %{DBIx::Class::Optional::Dependencies->req_group_list}), |
126 | }; |
127 | } |
8057ed01 |
128 | } |
129 | |
130 | # compose final req list, for alphabetical ordering |
131 | my %final_req; |
132 | for my $rtype (keys %$reqs) { |
133 | for my $mod (keys %{$reqs->{$rtype}} ) { |
134 | |
135 | # sanity check req duplications |
136 | if ($final_req{$mod}) { |
b718fd0a |
137 | die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n"; |
8057ed01 |
138 | } |
139 | |
140 | $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ], |
141 | } |
142 | } |
143 | |
144 | # actual require |
145 | for my $mod (sort keys %final_req) { |
146 | my ($rtype, $ver) = @{$final_req{$mod}}; |
147 | no strict 'refs'; |
148 | $rtype->($mod, $ver); |
149 | } |
a410299d |
150 | |
0424d17a |
151 | # output twice since the deplist is > 70 lines |
f90896ae |
152 | warn $optdep_msg if $Module::Install::AUTHOR; |
92f8f62a |
153 | auto_install(); |
f90896ae |
154 | warn $optdep_msg if $Module::Install::AUTHOR; |
92f8f62a |
155 | |
156 | # re-create various autogenerated documentation bits |
157 | if ($Module::Install::AUTHOR) { |
158 | |
159 | print "Regenerating README\n"; |
160 | system('pod2text lib/DBIx/Class.pm > README'); |
161 | |
162 | if (-f 'MANIFEST') { |
163 | print "Removing MANIFEST\n"; |
164 | unlink 'MANIFEST'; |
165 | } |
166 | |
92f8f62a |
167 | print "Regenerating Optional/Dependencies.pod\n"; |
168 | require DBIx::Class::Optional::Dependencies; |
ccebe1f1 |
169 | DBIx::Class::Optional::Dependencies->_gen_pod (Meta->version); |
92f8f62a |
170 | |
171 | # FIXME Disabled due to unsolved issues, ask theorbtwo |
172 | # require Module::Install::Pod::Inherit; |
173 | # PodInherit(); |
174 | } |
175 | |
f90896ae |
176 | |
7eaae8db |
177 | tests_recursive (qw| |
178 | t |
179 | |); |
180 | |
f90896ae |
181 | # temporary(?) until I get around to fix M::I wrt xt/ |
182 | # needs Module::Install::AuthorTests |
c1fdb460 |
183 | eval { |
7f2c37b8 |
184 | recursive_author_tests (qw/xt/); |
185 | 1; |
186 | } || do { |
d1dc7a98 |
187 | if ($Module::Install::AUTHOR && ! $args->{skip_author_deps}) { |
22a2062e |
188 | my $err = $@; |
189 | eval { require Module::Install::AuthorTests } |
eeaf8701 |
190 | || die "\nYou need Module::Install::AuthorTests installed to run this Makefile.PL in author mode (or supply --skip_author_deps):\n\n$@\n"; |
22a2062e |
191 | die $@; |
192 | } |
7f2c37b8 |
193 | }; |
f90896ae |
194 | |
195 | |
a410299d |
196 | install_script (qw| |
197 | script/dbicadmin |
198 | |); |
199 | |
7eaae8db |
200 | |
201 | ### Mangle makefile - read the comments for more info |
202 | # |
203 | postamble <<"EOP"; |
204 | |
205 | # This will add an extra dep-spec for the distdir target, |
206 | # which `make` will fold together in a first-come first-serve |
207 | # fashion. What we do here is essentially adding extra |
208 | # commands to execute once the distdir is assembled (via |
209 | # create_distdir), but before control is returned to a higher |
210 | # calling rule. |
211 | distdir : dbicadmin_pod_inject |
212 | |
213 | # The pod self-injection code is in fact a hidden option in |
214 | # dbicadmin itself |
215 | dbicadmin_pod_inject : |
216 | \tcd \$(DISTVNAME) && \$(ABSPERL) -Ilib script/dbicadmin --selfinject-pod |
217 | |
218 | # Regenerate manifest before running create_distdir. |
219 | create_distdir : manifest |
220 | |
221 | EOP |
222 | |
f90896ae |
223 | homepage 'http://www.dbix-class.org/'; |
a410299d |
224 | resources 'IRC' => 'irc://irc.perl.org/#dbix-class'; |
225 | resources 'license' => 'http://dev.perl.org/licenses/'; |
aeb669b8 |
226 | resources 'repository' => 'git://git.shadowcat.co.uk/dbsrgits/DBIx-Class.git'; |
a410299d |
227 | resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class'; |
70fbb0b8 |
228 | resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class'; |
a410299d |
229 | |
974fe5e8 |
230 | # Deprecated/internal modules need no exposure |
231 | no_index directory => $_ for (qw| |
bc6f129c |
232 | lib/DBIx/Class/Admin |
281738a4 |
233 | lib/DBIx/Class/PK/Auto |
bc6f129c |
234 | lib/DBIx/Class/CDBICompat |
974fe5e8 |
235 | |); |
236 | no_index package => $_ for (qw/ |
d5dedbd6 |
237 | DBIx::Class::Storage::DBIHacks |
974fe5e8 |
238 | /); |
a410299d |
239 | |
713cc98e |
240 | WriteAll(); |
09d46657 |
241 | |
80ff5ae0 |
242 | # Re-write META.yml to _exclude_ all forced requires (we do not want to ship this) |
1278e5f0 |
243 | # We are also not using M::I::AuthorRequires as this will be an extra dep, and |
244 | # deps in Makefile.PL suck (no autoinstall) |
0424d17a |
245 | if ($Module::Install::AUTHOR && ! $args->{skip_author_deps} ) { |
713cc98e |
246 | |
8057ed01 |
247 | # FIXME test_requires is not yet part of META |
248 | my %original_build_requires = ( %$build_requires, %$test_requires ); |
1278e5f0 |
249 | my @all_build_requires = @{delete Meta->{values}{build_requires}}; |
250 | my %removed_build_requires; |
8057ed01 |
251 | |
1278e5f0 |
252 | for (@all_build_requires) { |
253 | if ($original_build_requires{$_->[0]}) { |
254 | push @{Meta->{values}{build_requires}}, $_; |
255 | } |
256 | else { |
257 | $removed_build_requires{$_->[0]} = $_->[1] |
258 | unless $_->[0] eq 'ExtUtils::MakeMaker'; |
259 | } |
260 | } |
713cc98e |
261 | |
1278e5f0 |
262 | print "Regenerating META with author requires excluded\n"; |
713cc98e |
263 | Meta->write; |
1278e5f0 |
264 | |
265 | # test that we really took things away (just in case) |
266 | my $meta = do { local @ARGV = 'META.yml'; local $/; <> }; |
267 | for (keys %removed_build_requires) { |
268 | delete $removed_build_requires{$_} |
269 | unless $meta =~ /^ \s+ $_: \s+ $removed_build_requires{$_} \s* $/mx |
270 | } |
271 | |
272 | if (keys %removed_build_requires) { |
3ac9a26c |
273 | die join ("\n", |
274 | "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:", |
275 | "(most likely a broken Module::Install)\n", |
1278e5f0 |
276 | map { "\t$_" } (keys %removed_build_requires) |
277 | ) . "\n\n"; |
278 | } |
09d46657 |
279 | } |