changes to replication so that if a replicant is offline when we do the initial conne...
[dbsrgits/DBIx-Class.git] / Makefile.PL
1 use inc::Module::Install 0.67;
2 use strict;
3 use warnings;
4
5 use 5.006001; # delete this line if you want to send patches for earlier.
6
7 name     'DBIx-Class';
8 perl_version '5.006001';
9 all_from 'lib/DBIx/Class.pm';
10
11 requires 'Data::Page'                => 2.00;
12 requires 'Scalar::Util'              => 0;
13 requires 'SQL::Abstract'             => 1.20;
14 requires 'SQL::Abstract::Limit'      => 0.101;
15 requires 'Class::C3'                 => 0.13;
16 requires 'Class::C3::Componentised'  => 0;
17 requires 'Storable'                  => 0;
18 requires 'Carp::Clan'                => 0;
19 requires 'DBI'                       => 1.40;
20 requires 'Module::Find'              => 0;
21 requires 'Class::Inspector'          => 0;
22 requires 'Class::Accessor::Grouped'  => 0.05002;
23 requires 'JSON::Any'                 => 1.00; 
24 requires 'Scope::Guard'              => 0.03;
25 requires 'Path::Class'               => 0;
26 requires 'List::Util'                => 1.19;
27 requires 'Sub::Name'                 => 0.04;
28
29 # Perl 5.8.0 doesn't have utf8::is_utf8()
30 requires 'Encode'                    => 0 if ($] <= 5.008000);  
31
32 test_requires 'DBD::SQLite'         => 1.14;
33 test_requires 'Test::Builder'       => 0.33;
34 test_requires 'Test::Warn'          => 0.11;
35 test_requires 'Test::Exception'     => 0;
36
37 install_script 'script/dbicadmin';
38
39 tests "t/*.t t/*/*.t";
40
41 # re-build README and require CDBI modules for testing if we're in a checkout
42
43 my @force_build_requires_if_author = qw(
44   DBIx::ContextualFetch
45   Class::Trigger
46   Time::Piece
47   Clone
48   Test::Pod::Coverage
49   Test::Memory::Cycle
50 );
51
52 if ($Module::Install::AUTHOR) {
53
54   foreach my $module (@force_build_requires_if_author) {
55     build_requires $module;
56   }
57
58   system('pod2text lib/DBIx/Class.pm > README');
59 }
60
61 auto_provides;
62
63 auto_install;
64
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
103 EOE
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
115 WriteAll;
116
117
118 if ($Module::Install::AUTHOR) {
119   # Need to do this _after_ WriteAll else it looses track of them
120   Meta->{values}{build_requires} = [ grep {
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;
129   } @{Meta->{values}{build_requires}} ];
130
131   my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys();
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     };
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' ],
142     [ 'license', 'http://dev.perl.org/licenses/' ],
143     [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ],
144   ];
145   Meta->write;
146 }
147
148
149