ribasushi-- #forgot to port changes to 64db.t
[dbsrgits/DBIx-Class.git] / Makefile.PL
1 use inc::Module::Install 0.67;
2
3 name     'DBIx-Class';
4 perl_version '5.006001';
5 all_from 'lib/DBIx/Class.pm';
6
7 requires 'Data::Page'                => 2.00;
8 requires 'Scalar::Util'              => 0;
9 requires 'SQL::Abstract'             => 1.24;
10 requires 'SQL::Abstract::Limit'      => 0.13;
11 requires 'Class::C3'                 => 0.20;
12 requires 'Class::C3::Componentised'  => 0;
13 requires 'Storable'                  => 0;
14 requires 'Carp::Clan'                => 0;
15 requires 'DBI'                       => 1.40;
16 requires 'Module::Find'              => 0;
17 requires 'Class::Inspector'          => 0;
18 requires 'Class::Accessor::Grouped'  => 0.08002;
19 requires 'JSON::Any'                 => 1.17;
20 requires 'Scope::Guard'              => 0.03;
21
22 # Perl 5.8.0 doesn't have utf8::is_utf8()
23 requires 'Encode'                    => 0 if ($] <= 5.008000);  
24
25 test_requires 'DBD::SQLite'         => 1.14;
26 test_requires 'Test::Builder'       => 0.33;
27
28 install_script 'script/dbicadmin';
29
30 tests "t/*.t t/*/*.t";
31
32 # re-build README and require CDBI modules for testing if we're in a checkout
33 if( -e 'inc/.author' ) {
34   build_requires 'DBIx::ContextualFetch';
35   build_requires 'Class::Trigger';
36   system('pod2text lib/DBIx/Class.pm > README');
37 }
38
39 auto_provides;
40
41 auto_install;
42 # Have all prerequisites, check DBD::SQLite sanity
43 if (! $ENV{DBICTEST_NO_SQLITE_CHECK} ) {
44
45   # Win32 does not have real fork()s so a segfault will bring
46   # everything down. Warn about it.
47   if ($^O eq 'MSWin32') {
48     print <<'EOW';
49
50 ######################################################################
51 #                                                                    #
52 # A short stress-testing of DBD::SQLite will follow. If you have a   #
53 # buggy library this might very well be the last text you will see   #
54 # before the installation silently terminates. If this happens it    #
55 # would mean that you are running a buggy version of DBD::SQLite     #
56 # known to randomly segfault on errors. Even if you have the latest  #
57 # CPAN module version, the system sqlite3 dynamic library might have #
58 # been compiled against an older buggy sqlite3 dev library (oddly    #
59 # DBD::SQLite will prefer the system library against the one bundled #
60 # with it). You are strongly advised to resolve this issue before    #
61 # proceeding.                                                        #
62 #                                                                    #
63 # If this happens to you (this text is the last thing you see), and  #
64 # you just want to install this module without worrying about the    #
65 # tests (which will almost certainly fail) - set the environment     #
66 # variable DBICTEST_NO_SQLITE_CHECK to a true value and try again.   #
67 #                                                                    #
68 ######################################################################
69
70 EOW
71   }
72
73   my $pid = fork();
74   if (not defined $pid) {
75       die "Unable to fork(): $!";
76   }
77   elsif (! $pid) {
78
79       require DBI;
80       for (1 .. 100) {
81           my $dbh;
82           $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, {
83               AutoCommit => 1,
84               RaiseError => 0,
85               PrintError => 0,
86           })
87               or die "Unable to connect to database: $@";
88           $dbh->do ('CREATE TABLE name_with_no_columns');   # a subtle syntax error
89           $dbh->do ('COMMIT');                              # followed by commit
90           $dbh->disconnect;
91       }
92
93       exit 0;
94   }
95   else {
96       wait();
97       my $sig = $? & 127;
98       if ($sig == 11) {
99           warn (<<EOE);
100
101 ############################### WARNING #################################
102 #                                                                       #
103 # You are running a buggy version of DBD::SQLite known to randomly      #
104 # segfault on errors.  Even if you have the latest CPAN module version, #
105 # the sqlite3 dynamic library on this system might have been compiled   #
106 # against an older buggy sqlite3 dev library (oddly DBD::SQLite will    #
107 # prefer the system library against the one bundled with it). You are   #
108 # strongly advised to resolve this issue before proceeding.             #
109 #                                                                       #
110 #########################################################################
111
112 EOE
113           my $ans = prompt (
114             "The test suite of this module is almost certain to fail.\n"
115             . 'Do you really want to continue?',
116             'no',
117           );
118           exit 0 unless ($ans =~ /^y(es)?$/i);
119       }
120   }
121 }
122
123 WriteAll;