%bcond_without java # don't build Java bindings
%bcond_without tcl # don't build Tcl bindings
%bcond_without static_libs # don't build static libraries
-%bcond_with default_db # use this db as default system db
-
-%include /usr/lib/rpm/macros.java
+%bcond_with sqlite3 # build Sqlite3 API libraries
+%bcond_without default_db # don't use this db as default system db [Th uses DB 5.3]
+%bcond_without rpm_db # install library to rootfs for /bin/rpm
%define major 5
%define libver %{major}.3
-%define ver %{libver}.15
+%define ver %{libver}.28
%define patchlevel 0
Summary: Berkeley DB database library for C
Summary(pl.UTF-8): Biblioteka C do obsługi baz Berkeley DB
Name: db5.3
Version: %{ver}.%{patchlevel}
-Release: 1
+Release: 6
License: BSD-like (see LICENSE)
Group: Libraries
#Source0Download: http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html
Source0: http://download.oracle.com/berkeley-db/db-%{ver}.tar.gz
-# Source0-md5: 5493fb5f7cc3915887c836b096f18773
+# Source0-md5: b99454564d5b4479750567031d66fe24
+Patch0: %{name}-link.patch
+Patch1: %{name}-sql-features.patch
+Patch2: db-5.3.28-cwd-db_config.patch
+Patch3: %{name}-atomic_compare_exchange.patch
URL: http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html
BuildRequires: automake
%if %{with java}
Summary: SQL layer for Berkeley database library
Summary(pl.UTF-8): Wartstwa SQL dla biblioteki baz danych Berkeley
Group: Libraries
-%if %{with default_bd}
+%if %{with default_db}
Provides: db-sql = %{version}-%{release}
%endif
Summary(pl.UTF-8): Pliki programistyczne biblioteki db-sql
Group: Development/Libraries
Requires: %{name}-sql = %{version}-%{release}
-%if %{with default_bd}
+%if %{with default_db}
Provides: db-sql-devel = %{version}-%{release}
Obsoletes: db-sql-devel
%endif
%prep
%setup -q -n db-%{ver}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
%build
cp -f /usr/share/automake/config.sub dist
+cp -f /usr/share/automake/config.sub lang/sql/sqlite
JAVACFLAGS="-source 1.5 -target 1.5"
export JAVACFLAGS
--enable-build_dbm \
--enable-posixmutexes \
--enable-sql \
- --enable-sql_compat \
+ %{?with_sqlite3:--enable-sql_compat} \
--enable-sql_codegen \
--enable-stl \
%{?with_java:--enable-java} \
docdir=%{_docdir}/db-%{version}-docs \
includedir=%{_includedir}
-%if %{with default_db}
+%if %{with rpm_db}
install -d $RPM_BUILD_ROOT/%{_lib}
mv $RPM_BUILD_ROOT%{_libdir}/libdb-%{libver}.so $RPM_BUILD_ROOT/%{_lib}
+ln -sf /%{_lib}/libdb-%{libver}.so $RPM_BUILD_ROOT%{_libdir}/libdb-%{libver}.so
%endif
cd $RPM_BUILD_ROOT%{_libdir}
mv -f $RPM_BUILD_ROOT%{_libdir}/db.jar $RPM_BUILD_ROOT%{_javadir}/db-%{libver}.jar
%endif
%if %{with default_db}
-ln -sf /%{_lib}/libdb-%{libver}.so libdb.so
-ln -sf /%{_lib}/libdb-%{libver}.so libdb-%{libver}.so
-ln -sf /%{_lib}/libdb-%{libver}.so libndbm.so
+ln -sf libdb-%{libver}.so libdb.so
+ln -sf libdb-%{libver}.so libndbm.so
ln -sf libdb-%{libver}.la libdb.la
ln -sf libdb-%{libver}.la libndbm.la
ln -sf libdb_cxx-%{libver}.so libdb_cxx.so
ln -sf libdb-%{libver}.a libndbm.a
ln -sf libdb_cxx-%{libver}.a libdb_cxx.a
%endif
+%else
+%{__rm} libdb.so
+%{__rm} libdb_cxx.so
+%{__rm} libdb_sql.so
+%{__rm} libdb_stl.so
+%{__rm} libdb-%{major}.so
+%{__rm} libdb_cxx-%{major}.so
+%{__rm} libdb_sql-%{major}.so
+%{__rm} libdb_stl-%{major}.so
+%if %{with java}
+%{__rm} libdb_java.so
+%{__rm} libdb_java-%{major}.so
+%endif
+%if %{with tcl}
+%{__rm} libdb_tcl.so
+%{__rm} libdb_tcl-%{major}.so
+%endif
%endif
sed -i "s/old_library=''/old_library='libdb-%{libver}.a'/" libdb-%{libver}.la
%files
%defattr(644,root,root,755)
%doc LICENSE README docs/index.html docs/license
-%if %{with default_db}
+%if %{with rpm_db}
%attr(755,root,root) /%{_lib}/libdb-%{libver}.so
%else
%attr(755,root,root) %{_libdir}/libdb-%{libver}.so
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/db%{libver}_sql_codegen
%{_libdir}/libdb-%{libver}.la
+%if %{with rpm_db}
+%attr(755,root,root) %{_libdir}/libdb-%{libver}.so
+%endif
%if %{with default_db}
%attr(755,root,root) %{_bindir}/db_sql_codegen
-%attr(755,root,root) %{_libdir}/libdb-%{libver}.so
%attr(755,root,root) %{_libdir}/libdb-%{major}.so
%attr(755,root,root) %{_libdir}/libdb.so
%attr(755,root,root) %{_libdir}/libndbm.so
%{_includedir}/dbstl_utility.h
%{_includedir}/dbstl_vector.h
+%if %{with sqlite3}
%files sqlite3
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/sqlite3
%defattr(644,root,root,755)
%{_libdir}/libsqlite3.la
%{_includedir}/sqlite3.h
+%endif
%files utils
%defattr(644,root,root,755)