File libdbi-drivers.spec of Package libdbi-drivers

#
# spec file for package libdbi-drivers
#
# Copyright (c) 2012 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 special -1

%define libdbi_ver 0.8.4
%define libdbi_sover 1

Summary:        Database drivers for libdbi
License:        LGPL-2.1+
Group:          Development/Libraries

Name:           libdbi-drivers
Version:        0.8.3
Release:        0
Url:            http://libdbi-drivers.sourceforge.net/
Source:         %{name}-%{version}%{special}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  gettext
BuildRequires:  libdbi-devel
BuildRequires:  mysql-devel
BuildRequires:  openjade
BuildRequires:  postgresql-devel
BuildRequires:  sqlite-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:          Development/Libraries
Requires:       libdbi%{libdbi_sover} = %{libdbi_ver}

%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:          Development/Libraries
Requires:       libdbi%{libdbi_sover} = %{libdbi_ver}
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.

%if 0%{?suse_version} == 910
# SLES 9

%package dbd-sqlite
Summary:        SQLite driver for libdbi
Group:          Development/Libraries
Requires:       libdbi%{libdbi_sover} = %{libdbi_ver}
Requires:       sqlite

%description dbd-sqlite
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.

%else

%package dbd-sqlite3

Summary:        SQLite3 driver for libdbi
Group:          Development/Libraries
Requires:       libdbi%{libdbi_sover} = %{libdbi_ver}
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.

%endif

%prep
%setup -q -n %{name}-%{version}%{special}

%build
%configure		\
	--with-mysql 				\
	--with-mysql-incdir=%_includedir/mysql	\
	--with-mysql-libdir=%{_libdir}/mysql	\
	--with-pgsql 				\
	--with-pgsql-incdir=%_includedir/pgsql	\
	--with-pgsql-libdir=%{_libdir}		\
%if 0%{?suse_version} == 910
	--with-sqlite 				\
	--with-sqlite-incdir=%_includedir	\
	--with-sqlite-libdir=%{_libdir}		\
%else
	--with-sqlite3 				\
	--with-sqlite3-incdir=%_includedir	\
	--with-sqlite3-libdir=%{_libdir}	\
%endif
	--with-dbi-incdir=%_includedir/dbi	\
	--with-dbi-libdir=%{_libdir}		\
	--disable-static			\
	--disable-docs
# Broken upstream code overrides CFLAGS !:-[. Since AM_CFLAGS is unused in
# the source, we can hack there to get our flags in...
make %{?_smp_mflags} AM_CFLAGS="%optflags"

%install
make DESTDIR=$RPM_BUILD_ROOT install

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

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

%if 0%{?suse_version} == 910
%defattr(-,root,root)
# SLES 9

%files dbd-sqlite
%defattr(-,root,root)
%dir %{_libdir}/dbd
%{_libdir}/dbd/libdbdsqlite.so
%{_libdir}/dbd/libdbdsqlite.la

%else

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

%endif

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by