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