rpms/perl-DBD-SQLite2/FC-4 DBD-SQLite2-systemlibs.patch, NONE, 1.1 perl-DBD-SQLite2.spec, 1.1, 1.2

Tom Callaway (spot) fedora-extras-commits at redhat.com
Sat Aug 6 14:33:12 UTC 2005


Author: spot

Update of /cvs/extras/rpms/perl-DBD-SQLite2/FC-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28734/FC-4

Modified Files:
	perl-DBD-SQLite2.spec 
Added Files:
	DBD-SQLite2-systemlibs.patch 
Log Message:

Use system sqlite2 instead of defaulting to local copy


DBD-SQLite2-systemlibs.patch:

--- NEW FILE DBD-SQLite2-systemlibs.patch ---
--- DBD-SQLite2-0.33/Makefile.PL.BAD	2005-08-06 09:05:23.000000000 -0500
+++ DBD-SQLite2-0.33/Makefile.PL	2005-08-06 09:27:08.000000000 -0500
@@ -7,12 +7,79 @@
 use Config;
 use strict;
 
+# 2005/8/6, by tcallawa at redhat.com
+#
+# Determine if we are going to use the provided SQLite2 code, or an
+# already-installed copy. To this end, look for two command line 
+# parameters:
+#
+#    USE_LOCAL_SQLITE -- If non-false, force use of the installed version
+#    SQLITE_LOCATION  -- If passed, look for headers and libs under this root
+#
+# In absense of either of those, expect SQLite 2.X.X libs and headers in the
+# common places known to Perl or the C compiler.
+require File::Spec;
+my ($force_local, $sqlite_base, $sqlite_lib, $sqlite_inc);
+if ($sqlite_base = (grep(/SQLITE_LOCATION=.*/, @ARGV))[0]) {
+    $sqlite_base =~ /=(.*)/;
+    $sqlite_base = $1;
+    $sqlite_lib = File::Spec->catdir($sqlite_base, 'lib');
+    $sqlite_inc = File::Spec->catdir($sqlite_base, 'include');
+}
+if ($force_local = (grep(/USE_LOCAL_SQLITE=.*/, @ARGV))[0]) {
+    $force_local =~ /=(.*)/;
+    $force_local = "$1" ? 1 : 0;
+    if ($force_local) {
+        undef $sqlite_lib; # Keep these from making into CFLAGS/LDFLAGS
+        undef $sqlite_inc;
+    }
+}
+
+# Now, check for sqlite2
+unless ($force_local) {
+    my ($dir, $file, $fh, $found);
+    print "Checking for SQLite2...\n";
+    if ($sqlite_inc) {
+        open($fh, '< ' . File::Spec->catfile($sqlite_inc, 'sqlite.h'))
+            or die "Error opening sqlite.h in $sqlite_inc: $!";
+        while (defined($_ = <$fh>)) {
+            $found = 1;
+        }
+        close($fh);
+    } else {
+        # Go hunting for the file
+        for $dir ([ qw(usr include) ], [ qw(usr local include) ]) {
+            $file = File::Spec->catfile('', @$dir, 'sqlite.h');
+            next unless (-f $file);
+            open($fh, "< $file") or die "Error opening $file: $!";
+            while (defined($_ = <$fh>)) {
+                $found = 1;
+            }
+            close($fh);
+            last if $found;
+        }
+    }
+    unless ($found) {
+        warn "No SQLite 2 header file was found. Using the local version instead.\n";
+        $force_local = 1;
+        undef $sqlite_lib;
+        undef $sqlite_inc;
+    } else {
+        print "Looks good\n";
+    }
+}
+
+ at ARGV = grep(! /SQLITE_LOCATION|USE_LOCAL_SQLITE/, @ARGV);
+
 WriteMakefile(
     'NAME'          => 'DBD::SQLite2',
     'VERSION_FROM'  => 'lib/DBD/SQLite2.pm', # finds $VERSION
     'PREREQ_PM'     => {DBI => 1.21}, # e.g., Module::Name => 1.1
-    'OBJECT'        => '$(O_FILES)',
-    'INC'           => '-I$(DBI_INSTARCH_DIR)',
+    'OBJECT'        => ($force_local) ? '$(O_FILES)' : 'SQLite2.o dbdimp.o',
+    'INC'           => '-I. -I$(DBI_INSTARCH_DIR)' .
+                       (($sqlite_inc) ? " -I$sqlite_inc" : ''),
+    $force_local ? () : ('LIBS' => '-lsqlite'),
+    $sqlite_lib  ? ('dynamic_lib' => { OTHERLDFLAGS => "-L$sqlite_lib" }) : (),
     'OPTIMIZE'      => "-O2",
     'DEFINE'        => "-DNDEBUG=1 -DSQLITE_PTR_SZ=$Config{ptrsize}" .
                        ($Config{d_usleep} ? " -DHAVE_USLEEP=1" : ""),


Index: perl-DBD-SQLite2.spec
===================================================================
RCS file: /cvs/extras/rpms/perl-DBD-SQLite2/FC-4/perl-DBD-SQLite2.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- perl-DBD-SQLite2.spec	6 Aug 2005 03:11:42 -0000	1.1
+++ perl-DBD-SQLite2.spec	6 Aug 2005 14:33:10 -0000	1.2
@@ -1,12 +1,13 @@
 Name:           perl-DBD-SQLite2
 Version:        0.33
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Self Contained RDBMS in a DBI Driver (sqlite 2.x)
 Group:          Development/Libraries
 License:        GPL or Artistic
 URL:            http://search.cpan.org/dist/DBD-SQLite2
 Source0:        http://search.cpan.org/CPAN/authors/id/M/MS/MSERGEANT/DBD-SQLite2-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch0:		DBD-SQLite2-systemlibs.patch
 
 BuildRequires:  perl >= 1:5.6.1, perl(DBI)
 Requires:  perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
@@ -16,6 +17,7 @@
 
 %prep
 %setup -q -n DBD-SQLite2-%{version}
+%patch0 -p1
 
 %build
 CFLAGS="$RPM_OPT_FLAGS" %{__perl} Makefile.PL INSTALLDIRS=vendor
@@ -44,6 +46,9 @@
 
 
 %changelog
+* Sat Aug  6 2005 Tom "spot" Callaway <tcallawa at redhat.com> 0.33-4
+- use system sqlite2 libs if found
+
 * Fri Aug  5 2005 Tom "spot" Callaway <tcallawa at redhat.com> 0.33-3
 - add BR: perl(DBI)
 - add README to %doc




More information about the fedora-extras-commits mailing list