Fix update/delete on prefetching resultsets
[dbsrgits/DBIx-Class.git] / Makefile.PL
1 use inc::Module::Install 0.93;
2 use strict;
3 use warnings;
4 use POSIX ();
5
6 use 5.008001;
7
8 use FindBin;
9 use lib "$FindBin::Bin/lib";
10
11 # adjust ENV for $AUTHOR system() calls
12 use Config;
13 $ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
14
15
16 ###
17 ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
18 ### All of them should go to DBIx::Class::Optional::Dependencies
19 ###
20
21 name     'DBIx-Class';
22 perl_version '5.008001';
23 all_from 'lib/DBIx/Class.pm';
24
25 my $build_requires = {
26   'DBD::SQLite'              => '1.25',
27 };
28
29 my $test_requires = {
30   'File::Temp'               => '0.22',
31   'Test::Builder'            => '0.33',
32   'Test::Exception'          => '0',
33   'Test::More'               => '0.92',
34   'Test::Warn'               => '0.21',
35 };
36
37 my $runtime_requires = {
38   'Carp::Clan'               => '6.0',
39   'Class::Accessor::Grouped' => '0.09003',
40   'Class::C3::Componentised' => '1.0005',
41   'Class::Inspector'         => '1.24',
42   'Data::Page'               => '2.00',
43   'DBI'                      => '1.609',
44   'MRO::Compat'              => '0.09',
45   'Module::Find'             => '0.06',
46   'Path::Class'              => '0.18',
47   'SQL::Abstract'            => '1.67',
48   'SQL::Abstract::Limit'     => '0.13',
49   'Sub::Name'                => '0.04',
50   'Data::Dumper::Concise'    => '1.000',
51   'Scope::Guard'             => '0.03',
52   'Context::Preserve'        => '0.01',
53   'Try::Tiny'                => '0.04',
54   'namespace::clean'         => '0.14',
55 };
56
57 # this is so we can order requires alphabetically
58 # copies are needed for author requires injection
59 my $reqs = {
60   build_requires => { %$build_requires },
61   requires => { %$runtime_requires },
62   test_requires => { %$test_requires },
63 };
64
65
66 # require extra modules for testing if we're in a checkout
67 if ($Module::Install::AUTHOR) {
68   warn <<'EOW';
69 ******************************************************************************
70 ******************************************************************************
71 ***                                                                        ***
72 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
73 ***                                                                        ***
74 ******************************************************************************
75 ******************************************************************************
76
77 EOW
78
79   require DBIx::Class::Optional::Dependencies;
80   $reqs->{test_requires} = {
81     %{$reqs->{test_requires}},
82     map { %$_ } (values %{DBIx::Class::Optional::Dependencies->req_group_list}),
83   };
84 }
85
86 # compose final req list, for alphabetical ordering
87 my %final_req;
88 for my $rtype (keys %$reqs) {
89   for my $mod (keys %{$reqs->{$rtype}} ) {
90
91     # sanity check req duplications
92     if ($final_req{$mod}) {
93       die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
94     }
95
96     $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
97   }
98 }
99
100 # actual require
101 for my $mod (sort keys %final_req) {
102   my ($rtype, $ver) = @{$final_req{$mod}};
103   no strict 'refs';
104   $rtype->($mod, $ver);
105 }
106
107 auto_install();
108
109 # re-create various autogenerated documentation bits
110 if ($Module::Install::AUTHOR) {
111
112   print "Regenerating README\n";
113   system('pod2text lib/DBIx/Class.pm > README');
114
115   if (-f 'MANIFEST') {
116     print "Removing MANIFEST\n";
117     unlink 'MANIFEST';
118   }
119
120   print "Regenerating Optional/Dependencies.pod\n";
121   require DBIx::Class::Optional::Dependencies;
122   DBIx::Class::Optional::Dependencies->_gen_pod;
123
124   # FIXME Disabled due to unsolved issues, ask theorbtwo
125   #  require Module::Install::Pod::Inherit;
126   #  PodInherit();
127 }
128
129 tests_recursive (qw|
130     t
131 |);
132
133 install_script (qw|
134     script/dbicadmin
135 |);
136
137
138 ### Mangle makefile - read the comments for more info
139 #
140 postamble <<"EOP";
141
142 # This will add an extra dep-spec for the distdir target,
143 # which `make` will fold together in a first-come first-serve
144 # fashion. What we do here is essentially adding extra
145 # commands to execute once the distdir is assembled (via
146 # create_distdir), but before control is returned to a higher
147 # calling rule.
148 distdir : dbicadmin_pod_inject
149
150 # The pod self-injection code is in fact a hidden option in
151 # dbicadmin itself
152 dbicadmin_pod_inject :
153 \tcd \$(DISTVNAME) && \$(ABSPERL) -Ilib script/dbicadmin --selfinject-pod
154
155 # Regenerate manifest before running create_distdir.
156 create_distdir : manifest
157
158 EOP
159
160
161
162 resources 'IRC'         => 'irc://irc.perl.org/#dbix-class';
163 resources 'license'     => 'http://dev.perl.org/licenses/';
164 resources 'repository'  => 'http://dev.catalyst.perl.org/repos/bast/DBIx-Class/';
165 resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
166
167 # Deprecated/internal modules need no exposure
168 no_index directory => $_ for (qw|
169   lib/DBIx/Class/Admin
170   lib/DBIx/Class/SQLAHacks
171   lib/DBIx/Class/PK/Auto
172   lib/DBIx/Class/CDBICompat
173 |);
174 no_index package => $_ for (qw/
175   DBIx::Class::SQLAHacks DBIx::Class::Storage::DBIHacks
176 /);
177
178
179 WriteAll();
180
181
182 # Re-write META.yml to _exclude_ all forced requires (we do not want to ship this)
183 if ($Module::Install::AUTHOR) {
184
185   # FIXME test_requires is not yet part of META
186   my %original_build_requires = ( %$build_requires, %$test_requires );
187
188   print "Regenerating META with author requires excluded\n";
189   Meta->{values}{build_requires} = [ grep
190     { exists $original_build_requires{$_->[0]} }
191    ( @{Meta->{values}{build_requires}} )
192   ];
193
194   Meta->write;
195 }