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