changes to replication so that if a replicant is offline when we do the initial conne...
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
737416a4 1use inc::Module::Install 0.67;
fe650234 2use strict;
3use warnings;
4
5use 5.006001; # delete this line if you want to send patches for earlier.
ce4c07df 6
7name 'DBIx-Class';
ce4c07df 8perl_version '5.006001';
8e0f16f1 9all_from 'lib/DBIx/Class.pm';
ce4c07df 10
ce4c07df 11requires 'Data::Page' => 2.00;
12requires 'Scalar::Util' => 0;
13requires 'SQL::Abstract' => 1.20;
14requires 'SQL::Abstract::Limit' => 0.101;
15requires 'Class::C3' => 0.13;
1680d317 16requires 'Class::C3::Componentised' => 0;
ce4c07df 17requires 'Storable' => 0;
ce4c07df 18requires 'Carp::Clan' => 0;
19requires 'DBI' => 1.40;
20requires 'Module::Find' => 0;
21requires 'Class::Inspector' => 0;
1d4e109a 22requires 'Class::Accessor::Grouped' => 0.05002;
c843f5e4 23requires 'JSON::Any' => 1.00;
9c6d6d93 24requires 'Scope::Guard' => 0.03;
8026d0eb 25requires 'Path::Class' => 0;
26ab719a 26requires 'List::Util' => 1.19;
ddc0a6c8 27requires 'Sub::Name' => 0.04;
ce4c07df 28
29# Perl 5.8.0 doesn't have utf8::is_utf8()
30requires 'Encode' => 0 if ($] <= 5.008000);
31
f4086911 32test_requires 'DBD::SQLite' => 1.14;
f947585b 33test_requires 'Test::Builder' => 0.33;
97aca715 34test_requires 'Test::Warn' => 0.11;
f947585b 35test_requires 'Test::Exception' => 0;
ce4c07df 36
37install_script 'script/dbicadmin';
38
39tests "t/*.t t/*/*.t";
40
1543db24 41# re-build README and require CDBI modules for testing if we're in a checkout
fe650234 42
43my @force_build_requires_if_author = qw(
44 DBIx::ContextualFetch
45 Class::Trigger
46 Time::Piece
a8e7500d 47 Clone
48 Test::Pod::Coverage
49 Test::Memory::Cycle
fe650234 50);
51
52if ($Module::Install::AUTHOR) {
53
54 foreach my $module (@force_build_requires_if_author) {
55 build_requires $module;
56 }
09d46657 57
1543db24 58 system('pod2text lib/DBIx/Class.pm > README');
ff132c6f 59}
60
61auto_provides;
62
3e110410 63auto_install;
64
e0b438fb 65# Have all prerequisites, check DBD::SQLite sanity
66{
67 my $pid = fork();
68 if (not defined $pid) {
69 die "Unable to fork(): $!";
70 }
71 elsif (! $pid) {
72 require DBI;
73 for (1 .. 10) {
74 my $dbh;
75 $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
76 AutoCommit => 1,
77 RaiseError => 0,
78 PrintError => 0,
79 })
80 or die "Unable to connect to database: $@";
81 $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error
82 $dbh->do ('COMMIT'); # followed by commit
83 $dbh->disconnect;
84 }
85
86 exit 0;
87 }
88 else {
89 wait();
90 my $sig = $? & 127;
91 if ($sig == 11) {
92 warn (<<EOE);
93
94############################### WARNING ###################################
95# #
96# You are running a buggy version of DBD::SQLite known to randomly #
97# segfault on errors. Even if you have the latest CPAN module version, #
98# the actual sqlite3.so might have been compiled against an older buggy #
99# sqlite3 dev library. You are strongly advised to update DBD::SQLite. #
100# #
101###########################################################################
102
103EOE
104 my $ans = prompt (
105 "The test suite of this module is almost certain to fail.\n"
106 . 'Do you really want to continue?',
107 'no',
108 );
109 exit 0 unless ($ans =~ /^y(es)?$/i);
110 }
111 }
112}
113
114
ce4c07df 115WriteAll;
09d46657 116
117
118if ($Module::Install::AUTHOR) {
119 # Need to do this _after_ WriteAll else it looses track of them
120 Meta->{values}{build_requires} = [ grep {
fe650234 121 my $ok = 1;
122 foreach my $module (@force_build_requires_if_author) {
123 if ($_->[0] =~ /$module/) {
124 $ok = 0;
125 last;
126 }
127 }
128 $ok;
09d46657 129 } @{Meta->{values}{build_requires}} ];
130
131 my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys();
fe650234 132 my $cr = Module::Install::Metadata->can("Meta_TupleKeys");
133 {
134 no warnings 'redefine';
135 *Module::Install::Metadata::Meta_TupleKeys = sub {
136 return $cr->(@_), 'resources';
137 };
09d46657 138 }
139 Meta->{values}{resources} = [
140 [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ],
141 [ 'IRC', 'irc://irc.perl.org/#dbix-class' ],
100dd0a8 142 [ 'license', 'http://dev.perl.org/licenses/' ],
143 [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ],
09d46657 144 ];
145 Meta->write;
146}
147
148
149