File libapr-util1.spec of Package libapr-util1

#
# spec file for package libapr-util1
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           libapr-util1
%define with_sqlite2 0
%define with_sqlite3 0
%define with_mysql 0
%if 0%{?suse_version} > 910
# see previous versions of this package for a workaround how to build the mysql driver on SLES9.
%define with_mysql 1
%endif
%define with_pgsql 0
%if 0%{?suse_version} >= 910
  %define with_sqlite2 1
  %define with_pgsql 1
%endif
%if 0%{?suse_version} >= 930
  %define with_sqlite2 0
  %define with_sqlite3 1
%endif
#
%define dso_libdir %{_libdir}/apr-util-1
#
BuildRequires:  db-devel libapr1-devel
#
#
# database backends
#
%if %{with_mysql}
BuildRequires:  mysql-devel
%endif
#
%if %{with_sqlite2}
BuildRequires:  sqlite-devel
%endif
%if %{with_sqlite3}
BuildRequires:  sqlite-devel
%endif
#
%if %{with_pgsql}
BuildRequires:  postgresql-devel
%endif
#
#
# distro specific buildrequires
#
%if %{?suse_version:1}0
BuildRequires:  doxygen openldap2-devel
%endif
%if 0%{?suse_version} > 1020
BuildRequires:  libexpat-devel pkgconfig
%else
BuildRequires:  expat
%endif
%if %{?fedora_version:1}0
BuildRequires:  expat-devel openldap2-devel
%endif
%if %{?mandriva_version:1}0
BuildRequires:  expat-devel libldap2.3_0-devel
%endif
%if %{?rhel_version:1}0
BuildRequires:  expat-devel openldap2-devel
%endif
%if %{?centos_version:1}0
BuildRequires:  expat-devel openldap2-devel
%endif
#
Url:            http://apr.apache.org/
License:        Apache-2.0
Group:          Development/Libraries/Other
AutoReqProv:    on
Version:        1.3.12
Release:        12
Summary:        Apache Portable Runtime (APR) Library
Source:         http://www.apache.org/dist/apr/apr-util-%{version}.tar.bz2
Source2:        baselibs.conf
Patch0:         libapr-util1-1.3.12-gcc46.patch
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Obsoletes:      libapr_memcache0
# bug437293
%ifarch ppc64
Obsoletes:      libapr-util1-64bit
%endif
%ifarch  %ix86 ppc
Obsoletes:      libapr-util1-32bit
%endif
#
%define apuver 1
%define includedir %{_includedir}/apr-%{apuver}

%description
A companion library to APR, the Apache Portable Runtime.



Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE

%package devel
License:        Apache-2.0
Summary:        Apache Portable Runtime (APR) Library
Group:          Development/Libraries/Other
Requires:       libapr-util1 = %{version}
Requires:       libapr1-devel
# apu-config returns -lldap -lber -ldb_<dbversion>
# until this is fixed the devel package should require those
Requires:       openldap2-devel db-devel
%if 0%{?suse_version} > 1020
Requires:       libexpat-devel
%endif
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      libapr-util1-devel-64bit
%endif
%ifarch  %ix86 ppc
Obsoletes:      libapr-util1-devel-32bit
%endif
#

%description devel
A companion library to APR, the Apache Portable Runtime.



Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE

%package dbd-mysql
Summary:        DBD driver for MySQL
License:        LGPL-2.1+
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description dbd-mysql
DBD driver for MySQL.



Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE

%package dbd-pgsql
License:        Apache-2.0
Summary:        DBD driver for PostgreSQL
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description dbd-pgsql
DBD driver for PostgreSQL.



Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE

%package dbd-sqlite2
License:        Apache-2.0
Summary:        DBD driver for SQLite 2
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description dbd-sqlite2
DBD driver for SQLite 2.



Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE

%package dbd-sqlite3
License:        Apache-2.0
Summary:        DBD driver for SQLite 3
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description dbd-sqlite3
DBD driver for SQLite 3.



Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE

%prep
%setup -q -n apr-util-%{version}
%patch0

%build
export CFLAGS="$RPM_OPT_FLAGS"
rm -rf aclocal.m4 autom4te*.cache
autoheader --force
autoconf --force
%{__sed} -i -e '/OBJECTS_all/s, dbd/apr_dbd_[^ ]*\.lo,,g' build-outputs.mk
export CPPFLAGS='-I /usr/include/pgsql'
# all DBD driveres are built by default, nowadays -- except mysql.
%configure \
	--includedir=%{includedir} \
	--with-apr=/usr/bin/apr-1-config \
	--with-expat=/usr \
	--with-ldap \
	--with-berkeley-db \
%if %{with_mysql}
	--with-mysql \
%endif
	--without-gdbm \
    --disable-static \
    --with-pic
#
make %{?jobs:-j%jobs} CPPFLAGS='-I /usr/include/pgsql'
#
%if %{?suse_version:1}0
make dox
%endif

%install
make install DESTDIR=$RPM_BUILD_ROOT
%if %{?suse_version:1}0
mv docs/dox/html html
%endif
# multiacrh anti-borker
perl -pi -e "s|^LDFLAGS=.*|LDFLAGS=\"\"|g" %{buildroot}%{_bindir}/apu-%{apuver}-config 
# includes anti-borker
perl -pi -e "s|-I%{_includedir}/mysql||g" %{buildroot}%{_bindir}/apu-%{apuver}-config
# unpackaged files
rm -f $RPM_BUILD_ROOT/%{_libdir}/aprutil.exp
# don't package these static libraries for now
rm -f $RPM_BUILD_ROOT/%{dso_libdir}/apr_dbd_*.a
rm -f $RPM_BUILD_ROOT/%{dso_libdir}/apr_ldap_*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libaprutil-%{apuver}.a

%check
# fails on qemu, works on real hardware
%if !0%{?qemu_user_space_build:1}
make check
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc CHANGES
%doc LICENSE
%doc NOTICE
%{_libdir}/libaprutil-%{apuver}.so.*
%dir %{dso_libdir}
%attr(755,root,root) %{dso_libdir}/apr_ldap*
%attr(755,root,root) %{dso_libdir}/apr_dbm_db*
%if %{with_mysql}

%files dbd-mysql
%defattr(-,root,root,-)
%attr(755,root,root) %{dso_libdir}/apr_dbd_mysql*
%endif
%if %{with_pgsql}

%files dbd-pgsql
%defattr(-,root,root,-)
%attr(755,root,root) %{dso_libdir}/apr_dbd_pgsql*
%endif
%if %{with_sqlite2}

%files dbd-sqlite2
%defattr(-,root,root,-)
%attr(755,root,root) %{dso_libdir}/apr_dbd_sqlite2*
%endif
%if %{with_sqlite3}

%files dbd-sqlite3
%defattr(-,root,root,-)
%attr(755,root,root) %{dso_libdir}/apr_dbd_sqlite3*
%endif

%files devel
%defattr(-,root,root)
%if %{?suse_version:1}0
%doc --parents html
%endif
%dir %{includedir}
%{includedir}/*.h
%{_libdir}/libaprutil-%{apuver}.so
%{_bindir}/apu-%{apuver}-config
%{_libdir}/pkgconfig/apr-util-%{apuver}.pc
%exclude %{_libdir}/*.la

%changelog
openSUSE Build Service is sponsored by