changed WriteAll; to WriteAll(); in Makefile.PL because of some sort of installation...
[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;
87e75121 13requires 'SQL::Abstract' => 1.24;
14requires 'SQL::Abstract::Limit' => 0.13;
15requires 'Class::C3' => 0.20;
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;
87e75121 22requires 'Class::Accessor::Grouped' => 0.08002;
f1b99b9e 23requires 'JSON::Any' => 1.17;
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;
ce3b4eb9 36test_requires 'Test::Deep' => 0;
ce4c07df 37
38install_script 'script/dbicadmin';
39
50891152 40tests_recursive 't';
ce4c07df 41
1543db24 42# re-build README and require CDBI modules for testing if we're in a checkout
fe650234 43
44my @force_build_requires_if_author = qw(
45 DBIx::ContextualFetch
46 Class::Trigger
47 Time::Piece
a8e7500d 48 Clone
49 Test::Pod::Coverage
50 Test::Memory::Cycle
fe650234 51);
52
53if ($Module::Install::AUTHOR) {
54
55 foreach my $module (@force_build_requires_if_author) {
56 build_requires $module;
57 }
09d46657 58
1543db24 59 system('pod2text lib/DBIx/Class.pm > README');
ff132c6f 60}
61
62auto_provides;
63
3e110410 64auto_install;
65
e0b438fb 66# Have all prerequisites, check DBD::SQLite sanity
269228af 67if (! $ENV{DBICTEST_NO_SQLITE_CHECK} ) {
68
e0b438fb 69 my $pid = fork();
70 if (not defined $pid) {
71 die "Unable to fork(): $!";
72 }
73 elsif (! $pid) {
269228af 74
75 # Win32 does not have real fork()s so a segfault will bring
76 # everything down. Warn about it.
77 if ($^O eq 'MSWin32') {
78 print <<'EOW';
79
80######################################################################
81# #
82# A short stress-testing of DBD::SQLite will follow. If you have a #
83# buggy library this might very well be the last text you will see #
84# before the installation silently terminates. If this happens it #
85# would mean that you are running a buggy version of DBD::SQLite #
86# known to randomly segfault on errors. Even if you have the latest #
3951a291 87# CPAN module version, the system sqlite3 dynamic library might have #
88# been compiled against an older buggy sqlite3 dev library (oddly #
89# DBD::SQLite will prefer the system library against the one bundled #
90# with it). You are strongly advised to resolve this issue before #
91# proceeding. #
269228af 92# #
93# If this happens to you (this text is the last thing you see), and #
94# you just want to install this module without worrying about the #
95# tests (which will almost certainly fail) - set the environment #
96# variable DBICTEST_NO_SQLITE_CHECK to a true value and try again. #
97# #
98######################################################################
99
100EOW
101 }
102
e0b438fb 103 require DBI;
269228af 104 for (1 .. 100) {
e0b438fb 105 my $dbh;
106 $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
107 AutoCommit => 1,
108 RaiseError => 0,
109 PrintError => 0,
110 })
111 or die "Unable to connect to database: $@";
112 $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error
113 $dbh->do ('COMMIT'); # followed by commit
114 $dbh->disconnect;
115 }
116
117 exit 0;
118 }
119 else {
120 wait();
121 my $sig = $? & 127;
122 if ($sig == 11) {
123 warn (<<EOE);
124
3951a291 125############################### WARNING #################################
126# #
127# You are running a buggy version of DBD::SQLite known to randomly #
128# segfault on errors. Even if you have the latest CPAN module version, #
129# the sqlite3 dynamic library on this system might have been compiled #
130# against an older buggy sqlite3 dev library (oddly DBD::SQLite will #
131# prefer the system library against the one bundled with it). You are #
132# strongly advised to resolve this issue before proceeding. #
133# #
134#########################################################################
e0b438fb 135
136EOE
137 my $ans = prompt (
138 "The test suite of this module is almost certain to fail.\n"
139 . 'Do you really want to continue?',
140 'no',
141 );
142 exit 0 unless ($ans =~ /^y(es)?$/i);
143 }
144 }
145}
146
147
43944e47 148WriteAll();
09d46657 149
150
151if ($Module::Install::AUTHOR) {
152 # Need to do this _after_ WriteAll else it looses track of them
153 Meta->{values}{build_requires} = [ grep {
fe650234 154 my $ok = 1;
155 foreach my $module (@force_build_requires_if_author) {
156 if ($_->[0] =~ /$module/) {
157 $ok = 0;
158 last;
159 }
160 }
161 $ok;
09d46657 162 } @{Meta->{values}{build_requires}} ];
163
164 my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys();
fe650234 165 my $cr = Module::Install::Metadata->can("Meta_TupleKeys");
166 {
167 no warnings 'redefine';
168 *Module::Install::Metadata::Meta_TupleKeys = sub {
169 return $cr->(@_), 'resources';
170 };
09d46657 171 }
172 Meta->{values}{resources} = [
173 [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ],
174 [ 'IRC', 'irc://irc.perl.org/#dbix-class' ],
100dd0a8 175 [ 'license', 'http://dev.perl.org/licenses/' ],
176 [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ],
09d46657 177 ];
178 Meta->write;
179}