0.08100 release
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
737416a4 1use inc::Module::Install 0.67;
fe650234 2use strict;
3use warnings;
76607ac8 4use POSIX ();
fe650234 5
6use 5.006001; # delete this line if you want to send patches for earlier.
ce4c07df 7
8name 'DBIx-Class';
ce4c07df 9perl_version '5.006001';
8e0f16f1 10all_from 'lib/DBIx/Class.pm';
ce4c07df 11
82fae370 12requires 'Data::Page' => 2.00;
13requires 'Scalar::Util' => 0;
2d60be4d 14requires 'SQL::Abstract' => 1.51;
82fae370 15requires 'SQL::Abstract::Limit' => 0.13;
65f668c2 16requires 'Class::C3::Componentised' => 1.0004;
82fae370 17requires 'Storable' => 0;
18requires 'Carp::Clan' => 0;
19requires 'DBI' => 1.40;
20requires 'Module::Find' => 0;
21requires 'Class::Inspector' => 0;
2d60be4d 22requires 'Class::Accessor::Grouped' => 0.08003;
82fae370 23requires 'JSON::Any' => 1.17;
24requires 'Scope::Guard' => 0.03;
25requires 'Path::Class' => 0;
26requires 'List::Util' => 1.19;
27requires 'Sub::Name' => 0.04;
0fdb7298 28requires 'MRO::Compat' => 0.09;
ce4c07df 29
30# Perl 5.8.0 doesn't have utf8::is_utf8()
82fae370 31requires 'Encode' => 0 if ($] <= 5.008000);
ce4c07df 32
9ac2c0f8 33# configure_requires so the sanity check below can run
e22999bf 34configure_requires 'DBD::SQLite' => 1.21;
d9a898ca 35
f947585b 36test_requires 'Test::Builder' => 0.33;
97aca715 37test_requires 'Test::Warn' => 0.11;
f947585b 38test_requires 'Test::Exception' => 0;
ce3b4eb9 39test_requires 'Test::Deep' => 0;
ce4c07df 40
82fae370 41recommends 'SQL::Translator' => 0.09004;
42
ce4c07df 43install_script 'script/dbicadmin';
44
50891152 45tests_recursive 't';
ce4c07df 46
c96454c3 47# re-build README and require extra modules for testing if we're in a checkout
fe650234 48
82fae370 49my %force_requires_if_author = (
c96454c3 50 'Test::Pod::Coverage' => 1.04,
9ac2c0f8 51 'SQL::Translator' => 0.09004,
52
53 # CDBI-compat related
82fae370 54 'DBIx::ContextualFetch' => 0,
602fd807 55 'Class::DBI::Plugin::DeepAbstractSearch' => 0,
82fae370 56 'Class::Trigger' => 0,
57 'Time::Piece' => 0,
58 'Clone' => 0,
9ac2c0f8 59
60 # t/52cycle.t
82fae370 61 'Test::Memory::Cycle' => 0,
9ac2c0f8 62
c96454c3 63 # t/60core.t
64 'DateTime::Format::MySQL' => 0,
65
9ac2c0f8 66 # t/93storage_replication.t
67 'Moose', => 0,
68 'MooseX::AttributeHelpers' => 0.12,
c96454c3 69
70 # t/96_is_deteministic_value.t
71 'DateTime::Format::Strptime' => 0,
fe650234 72);
73
74if ($Module::Install::AUTHOR) {
75
82fae370 76 foreach my $module (keys %force_requires_if_author) {
6882de2b 77 build_requires ($module => $force_requires_if_author{$module});
fe650234 78 }
09d46657 79
1543db24 80 system('pod2text lib/DBIx/Class.pm > README');
ff132c6f 81}
82
83auto_provides;
84
d7fda552 85if ($Module::Install::AUTHOR) {
86 warn <<'EOW';
87******************************************************************************
88******************************************************************************
89*** ***
90*** AUTHOR MODE: all optional test dependencies converted to hard requires ***
91*** ***
92******************************************************************************
93******************************************************************************
94
95EOW
96}
3e110410 97auto_install;
98
e0b438fb 99# Have all prerequisites, check DBD::SQLite sanity
269228af 100if (! $ENV{DBICTEST_NO_SQLITE_CHECK} ) {
101
e0b438fb 102 my $pid = fork();
103 if (not defined $pid) {
104 die "Unable to fork(): $!";
105 }
106 elsif (! $pid) {
269228af 107
108 # Win32 does not have real fork()s so a segfault will bring
109 # everything down. Warn about it.
110 if ($^O eq 'MSWin32') {
111 print <<'EOW';
112
113######################################################################
114# #
115# A short stress-testing of DBD::SQLite will follow. If you have a #
116# buggy library this might very well be the last text you will see #
117# before the installation silently terminates. If this happens it #
118# would mean that you are running a buggy version of DBD::SQLite #
119# known to randomly segfault on errors. Even if you have the latest #
3951a291 120# CPAN module version, the system sqlite3 dynamic library might have #
121# been compiled against an older buggy sqlite3 dev library (oddly #
122# DBD::SQLite will prefer the system library against the one bundled #
123# with it). You are strongly advised to resolve this issue before #
124# proceeding. #
269228af 125# #
126# If this happens to you (this text is the last thing you see), and #
127# you just want to install this module without worrying about the #
128# tests (which will almost certainly fail) - set the environment #
129# variable DBICTEST_NO_SQLITE_CHECK to a true value and try again. #
130# #
131######################################################################
132
133EOW
134 }
135
e0b438fb 136 require DBI;
269228af 137 for (1 .. 100) {
e0b438fb 138 my $dbh;
139 $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
140 AutoCommit => 1,
141 RaiseError => 0,
142 PrintError => 0,
143 })
144 or die "Unable to connect to database: $@";
145 $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error
146 $dbh->do ('COMMIT'); # followed by commit
147 $dbh->disconnect;
148 }
149
150 exit 0;
151 }
152 else {
76607ac8 153 eval {
154 local $SIG{ALRM} = sub { die "timeout\n" };
155 alarm 5;
156 wait();
157 alarm 0;
158 };
7a0e56cb 159 my $exception = $@;
160
e0b438fb 161 my $sig = $? & 127;
7a0e56cb 162
163# make sure process actually dies
164 $exception && kill POSIX::SIGKILL(), $pid;
165
166 if ($exception || $sig == POSIX::SIGSEGV() || $sig == POSIX::SIGABRT()
3c086319 167 || $sig == 7) { # 7 == SIGBUS, haven't seen it but just in case
e0b438fb 168 warn (<<EOE);
169
3951a291 170############################### WARNING #################################
171# #
172# You are running a buggy version of DBD::SQLite known to randomly #
173# segfault on errors. Even if you have the latest CPAN module version, #
174# the sqlite3 dynamic library on this system might have been compiled #
175# against an older buggy sqlite3 dev library (oddly DBD::SQLite will #
176# prefer the system library against the one bundled with it). You are #
177# strongly advised to resolve this issue before proceeding. #
178# #
179#########################################################################
e0b438fb 180
181EOE
182 my $ans = prompt (
183 "The test suite of this module is almost certain to fail.\n"
184 . 'Do you really want to continue?',
185 'no',
186 );
187 exit 0 unless ($ans =~ /^y(es)?$/i);
188 }
189 }
190}
191
192
43944e47 193WriteAll();
09d46657 194
195
196if ($Module::Install::AUTHOR) {
e22999bf 197 # Need to do this _after_ WriteAll else it loses track of them
09d46657 198 Meta->{values}{build_requires} = [ grep {
fe650234 199 my $ok = 1;
82fae370 200 foreach my $module (keys %force_requires_if_author) {
fe650234 201 if ($_->[0] =~ /$module/) {
202 $ok = 0;
203 last;
204 }
205 }
206 $ok;
09d46657 207 } @{Meta->{values}{build_requires}} ];
208
209 my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys();
fe650234 210 my $cr = Module::Install::Metadata->can("Meta_TupleKeys");
211 {
212 no warnings 'redefine';
213 *Module::Install::Metadata::Meta_TupleKeys = sub {
214 return $cr->(@_), 'resources';
215 };
09d46657 216 }
217 Meta->{values}{resources} = [
218 [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ],
219 [ 'IRC', 'irc://irc.perl.org/#dbix-class' ],
100dd0a8 220 [ 'license', 'http://dev.perl.org/licenses/' ],
221 [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ],
09d46657 222 ];
223 Meta->write;
224}
9a3219ee 225