1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

Cleaning up the layout

This commit is contained in:
Adam Kennedy 2009-01-24 12:49:35 +00:00
parent d3c816b701
commit 19672c1627

View file

@ -2,12 +2,11 @@ use ExtUtils::MakeMaker;
eval { eval {
require DBI; require DBI;
require DBI::DBD; require DBI::DBD;
die "Your DBI Version is too old - DBD::SQLite requires at least 1.21" unless ( $DBI::VERSION >= 1.21 ) {
unless $DBI::VERSION >= 1.21; die "Your DBI Version is too old - DBD::SQLite requires at least 1.21";
};
if ($@) {
warn $@;
} }
};
warn $@ if $@;
use Config; use Config;
use strict; use strict;
eval { eval {
@ -34,7 +33,7 @@ corruption.
EOT EOT
if ( prompt("Continue?", "N") !~ /^y/i ) { if ( prompt("Continue?", "N") !~ /^y/i ) {
print "Exiting\n"; print "Exiting\n";
exit -1; exit(-1);
} }
} }
}; };
@ -61,12 +60,13 @@ if ($force_local = (grep(/USE_LOCAL_SQLITE=.*/, @ARGV))[0]) {
$force_local =~ /=(.*)/; $force_local =~ /=(.*)/;
$force_local = "$1" ? 1 : 0; $force_local = "$1" ? 1 : 0;
if ( $force_local ) { if ( $force_local ) {
undef $sqlite_lib; # Keep these from making into CFLAGS/LDFLAGS # Keep these from making into CFLAGS/LDFLAGS
undef $sqlite_lib;
undef $sqlite_inc; undef $sqlite_inc;
} }
} }
# Now, check for a compatible sqlite3 # Now check for a compatible sqlite3
unless ($force_local) { unless ($force_local) {
my ($dir, $file, $fh, $version); my ($dir, $file, $fh, $version);
print "Checking installed SQLite version...\n"; print "Checking installed SQLite version...\n";
@ -112,33 +112,32 @@ unless ($force_local) {
my $nlid = $DBI::VERSION > 1.42 ? '' : '-Dno_last_insert_id'; my $nlid = $DBI::VERSION > 1.42 ? '' : '-Dno_last_insert_id';
my $libs = ''; my $libs = '';
$libs .= "-L$sqlite_lib " if ($sqlite_lib); $libs .= "-L$sqlite_lib " if $sqlite_lib;
$libs .= "-lsqlite3 " unless ($force_local); $libs .= "-lsqlite3 " unless $force_local;
WriteMakefile( WriteMakefile(
'NAME' => 'DBD::SQLite', 'NAME' => 'DBD::SQLite',
'VERSION_FROM' => 'lib/DBD/SQLite.pm', # finds $VERSION 'VERSION_FROM' => 'lib/DBD/SQLite.pm',
'PREREQ_PM' => {DBI => 1.21}, # e.g., Module::Name => 1.1 'PREREQ_PM' => { DBI => 1.21 },
'OBJECT' => ($force_local) ? '$(O_FILES)' : 'SQLite.o dbdimp.o', 'OBJECT' => ( $force_local ? '$(O_FILES)' : 'SQLite.o dbdimp.o' ),
'INC' => '-I. -I$(DBI_INSTARCH_DIR)' .
(($sqlite_inc) ? " -I$sqlite_inc" : ''),
$libs ? ('LIBS' => $libs) : (), $libs ? ('LIBS' => $libs) : (),
'OPTIMIZE' => "-O2", 'OPTIMIZE' => "-O2",
'DEFINE' => "-DSQLITE_CORE -DSQLITE_ENABLE_FTS2 -DNDEBUG=1 -DSQLITE_PTR_SZ=$Config{ptrsize}" .
( ($Config{d_usleep} ||
$Config{osname} =~ m/linux/) ?
" -DHAVE_USLEEP=1" : "" ) .
($DBI::VERSION > 1.42 ? '' : ' -Dno_last_insert_id') .
($Config{usethreads} ? '' : ' -DTHREADSAFE=0'),
'clean' => { FILES => 'SQLite.xsi config.h tv.log output' }, 'clean' => { FILES => 'SQLite.xsi config.h tv.log output' },
'PL_FILES' => {}, 'PL_FILES' => {},
'EXE_FILES' => [], 'EXE_FILES' => [],
'INC' => '-I. -I$(DBI_INSTARCH_DIR)' . ($sqlite_inc ? " -I$sqlite_inc" : ''),
'DEFINE' => "-DSQLITE_CORE -DSQLITE_ENABLE_FTS2 -DNDEBUG=1 -DSQLITE_PTR_SZ=$Config{ptrsize}" .
(($Config{d_usleep} || $Config{osname} =~ m/linux/) ? " -DHAVE_USLEEP=1" : "" ) .
($DBI::VERSION > 1.42 ? '' : ' -Dno_last_insert_id') .
($Config{usethreads} ? '' : ' -DTHREADSAFE=0'),
); );
package MY; package MY;
sub postamble { sub postamble {
eval { DBI::DBD::dbd_postamble(@_) }; eval { DBI::DBD::dbd_postamble(@_) };
} }
sub libscan { sub libscan {
my ($self, $path) = @_; my ($self, $path) = @_;
return if $path =~ /\.pl$/; return if $path =~ /\.pl$/;