File libdbi-drivers.spec of Package libdbi-drivers

#
# spec file for package libdbi-drivers
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define libdbi_sover 1
Name:           libdbi-drivers
Version:        0.9.0
Release:        0
Summary:        Database drivers for libdbi
License:        LGPL-2.1+
Group:          System/Libraries
Url:            http://libdbi-drivers.sf.net/

Source:         http://downloads.sf.net/libdbi-drivers/%name-%version.tar.gz
Patch1:         sqlite3.diff
Patch2:         badcode.diff
Patch3:         libdl.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gettext
BuildRequires:  libdbi-devel
BuildRequires:  libtool
BuildRequires:  mysql-devel
BuildRequires:  openjade
BuildRequires:  postgresql-devel
BuildRequires:  sqlite3-devel

%description
libdbi implements a database-independent abstraction layer in C,
similar to the DBI/DBD layer in Perl. Drivers are distributed
separately from the library itself.

%package dbd-mysql
Summary:        MySQL driver for libdbi
Group:          System/Libraries
Requires:       libdbi%{libdbi_sover} = %version

%description dbd-mysql
This driver provides connectivity to MySQL database servers through
the libdbi database independent abstraction layer. Switching a
program's driver does not require recompilation or rewriting source
code.

%package dbd-pgsql
Summary:        PostgreSQL driver for libdbi
Group:          System/Libraries
Requires:       libdbi%{libdbi_sover} = %version
Requires:       postgresql >= 7.0.3

%description dbd-pgsql
This driver provides connectivity to PostgreSQL database servers
through the libdbi database independent abstraction layer. Switching
a program's driver does not require recompilation or rewriting source
code.

%package dbd-sqlite3
Summary:        SQLite3 driver for libdbi
Group:          System/Libraries
Requires:       libdbi%{libdbi_sover} = %version
Requires:       sqlite

%description dbd-sqlite3
This driver provides connectivity to SQLite database servers through the
libdbi database independent abstraction layer. Switching a program's driver
does not require recompilation or rewriting source code.

%prep
%setup -q
%patch -P 1 -P 2 -P 3 -p1

#ensure license doesn't have a executable permission
chmod 644 COPYING

# Fake the __DATE__ so we do not needelessly rebuild
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" drivers/*/*.c

%build
autoreconf -fi
%configure		\
	--with-mysql 				\
	--with-pgsql 				\
	--with-sqlite3 				\
	--with-dbi-incdir=%_includedir/dbi	\
	--with-dbi-libdir=%{_libdir}		\
	--disable-static			\
	--disable-docs
make %{?_smp_mflags}

%install
make DESTDIR=$RPM_BUILD_ROOT install
find "%buildroot" -type f -name "*.la" -delete

%check
make check || :

%files dbd-mysql
%defattr(-,root,root)
%doc COPYING
%dir %{_libdir}/dbd
%{_libdir}/dbd/libdbdmysql.so

%files dbd-pgsql
%defattr(-,root,root)
%doc COPYING
%dir %{_libdir}/dbd
%{_libdir}/dbd/libdbdpgsql.so

%files dbd-sqlite3
%defattr(-,root,root)
%doc COPYING
%dir %{_libdir}/dbd
%{_libdir}/dbd/libdbdsqlite3.so

%changelog
openSUSE Build Service is sponsored by