Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > f6471345f599ec4077f79b914d7de759 > files > 4

db3-3.3.11-24mdv2008.0.src.rpm

%define version 3.3.11
%define release %mkrel 24

# compatibility with legacy rpm
%{!?_lib:%define _lib	lib}

%define	__soversion	3.3
%define	_libdb_a	libdb-%{__soversion}.a
%define	_libcxx_a	libdb_cxx-%{__soversion}.a

# Define to build Java bindings
%define build_java	0

# Allow --with[out] JAVA rpm command line buil
%{?_with_JAVA: %{expand: %%define build_java 1}}
%{?_without_JAVA: %{expand: %%define build_java 0}}

%define libdb_orig	%mklibname db
%define libdb %mklibname db %{__soversion}
%define libdbdevel %libdb-devel
%define libdbcxx %mklibname dbcxx %{__soversion}
%define libdbjava %mklibname dbjava %{__soversion}
%define libdbtcl %mklibname dbtcl %{__soversion}

Summary:	The Berkeley DB database library for C
Name:		db3
Version:	%{version}
Release:	%{release}
Source:		http://www.sleepycat.com/update/%{version}/db-%{version}.tar.bz2
Patch1:		db3.3-3.3.11.patch
Patch2:		db3.3-compile-with-bash31.patch
URL:		http://www.sleepycat.com
License:	BSD
Group:		System/Libraries
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

BuildRequires:	glibc-static-devel
%if %{build_java}
BuildRequires:	gcc-java >= 3.1.1-0.8mdk
BuildRequires:	gcj-tools >= 3.1.1-0.8mdk
%endif
BuildRequires:	tcl
BuildRequires:	tcl-devel
BuildRequires:	db1-devel

%description
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB is used by many applications, including Python and Perl, so this
should be installed on all systems.

%package	-n %libdb
Summary:	The Berkeley DB database library for C
Group:		System/Libraries
Provides:	db3 = %{version}-%{release}

%description	-n %libdb
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB is used by many applications, including Python and Perl, so this
should be installed on all systems.

%package	-n %libdbcxx
Summary:	The C++ binding for Berkeley DB database library
Group:		System/Libraries

%description -n %libdbcxx
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB is used by many applications, including Python and Perl, so this
should be installed on all systems.

This package contains the files needed to build C++ programs which use
Berkeley DB.

%if %{build_java}
%package	-n %libdbjava
Summary:	The Java binding for Berkeley DB database library
Group:		System/Libraries

%description	-n %libdbjava
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB is used by many applications, including Python and Perl, so this
should be installed on all systems.

This package contains the files needed to build Java programs which use
Berkeley DB.
%endif

%package	-n %libdbtcl
Summary:	The Tcl binding for Berkeley DB database library
Group:		System/Libraries

%description	-n %libdbtcl
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB is used by many applications, including Python and Perl, so this
should be installed on all systems.

This package contains the header files, libraries, and documentation for
building tcl programs which use Berkeley DB.

%package	utils
Summary:	Command line tools for managing Berkeley DB databases
Group:		Databases

%description	utils
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB includes B+tree, Extended Linear Hashing, Fixed and Variable-length
record access methods, transactions, locking, logging, shared memory caching
and database recovery. DB supports C, C++, Java and Perl APIs.

This package contains command line tools for managing Berkeley DB databases

%package	-n %libdbdevel
Summary:	Development libraries/header files for the Berkeley DB library
Group:		Development/Databases
Requires:	%libdb = %{version}-%{release}
Requires:	%libdbtcl = %{version}-%{release}
Provides:	db3-devel = %{version}-%{release}
Provides:	libdb3.3-devel = %{version}-%{release}
Conflicts:	%{libdb_orig}4.0-devel, %{libdb_orig}4.1-devel
Conflicts:	%{libdb_orig}4.2-devel %{libdb_orig}4.3-devel
Conflicts:	%{libdb_orig}4.4-devel

%description -n %libdbdevel
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
Berkeley DB includes B+tree, Extended Linear Hashing, Fixed and Variable-length
record access methods, transactions, locking, logging, shared memory caching
and database recovery. DB supports C, C++, Java and Perl APIs.

This package contains the header files, libraries, and documentation for
building programs which use Berkeley DB.

%prep
%setup -q -n db-%{version}
%patch1 -p0 -b .orig
%patch2 -p0 -b .bash

# Remove tags files which we don't need.
find . -name tags | xargs rm -f
# Define a shell function for fixing HREF references in the docs, which
# would otherwise break when we split the docs up into subpackages.
fixup_href() {
    for doc in $@ ; do
        chmod u+w ${doc}
        sed -e 's,="../api_c/,="../../%{name}-devel-%{version}/api_c/,g' \
            -e 's,="api_c/,="../%{name}-devel-%{version}/api_c/,g' \
            -e 's,="../api_cxx/,="../../%{name}-devel-%{version}/api_cxx/,g' \
            -e 's,="api_cxx/,="../%{name}-devel-%{version}/api_cxx/,g' \
            -e 's,="../api_java/,="../../%{name}-devel-%{version}/api_java/,g' \
            -e 's,="api_java/,="../%{name}-devel-%{version}/api_java/,g' \
            -e 's,="../api_tcl/,="../../%{name}-devel-%{version}/api_tcl/,g' \
            -e 's,="api_tcl/,="../%{name}-devel-%{version}/api_tcl/,g' \
            -e 's,="../examples_c/,="../../%{name}-devel-%{version}/examples_c/,g' \
            -e 's,="examples_c/,="../%{name}-devel-%{version}/examples_c/,g' \
            -e 's,="../examples_cxx/,="../../%{name}-devel-%{version}/examples_cxx/,g' \
            -e 's,="examples_cxx/,="../%{name}-devel-%{version}/examples_cxx/,g' \
            -e 's,="../ref/,="../../%{name}-devel-%{version}/ref/,g' \
            -e 's,="ref/,="../%{name}-devel-%{version}/ref/,g' \
            -e 's,="../sleepycat/,="../../%{name}-devel-%{version}/sleepycat/,g' \
            -e 's,="sleepycat/,="../%{name}-devel-%{version}/sleepycat/,g' \
            -e 's,="../images/,="../../%{name}-%{version}/images/,g' \
            -e 's,="images/,="../%{name}-%{version}/images/,g' \
            -e 's,="../utility/,="../../%{name}-%{version}/utility/,g' \
            -e 's,="utility/,="../%{name}-%{version}/utility/,g' ${doc} > ${doc}.new
        touch -r ${doc} ${doc}.new
        cat ${doc}.new > ${doc}
        touch -r ${doc}.new ${doc}
        rm -f ${doc}.new
    done
}

set +x	# XXX painful to watch
# Fix all of the HTML files.
fixup_href `find . -name "*.html"`
set -x	# XXX painful to watch

%build
CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
%ifarch ppc
CFLAGS="-D_GNU_SOURCE -D_REENTRANT $RPM_OPT_FLAGS"; export CFLAGS
%endif

%if %{build_java}
# Use javac trampoline from gcj
mkdir -p build_unix/gcj
pushd build_unix/gcj;
cat > javac << EOF
#!/bin/sh
exec /usr/bin/gcj-`gcj -dumpversion` "\$@"
EOF
chmod +x javac
export JAVAC=$PWD/javac
export JAVACABS=$JAVAC
# Kludge lookup of <jni.h> and make configure grab the right one from gcj
ln -s `gcj -print-file-name=include` include
popd
%endif

# XXX --enable-posixmutexes is useful for threads but useless for interprocess locking.
# XXX --enable-diagnostic should be disabled for production (but is useful).
# XXX --enable-debug_{r,w}op should be disabled for production.
# XXX --enable-java

pushd build_unix
CONFIGURE_TOP="../dist" %configure \
	--enable-compat185 \
	--enable-dump185 \
	--enable-shared \
	--enable-static \
	--enable-rpc \
	--enable-tcl \
	--with-tcl=%{_libdir} \
	--enable-cxx \
%if %{build_java}
	--enable-java \
%endif
	--enable-test
	# --enable-diagnostic \
	# --enable-debug --enable-debug_rop --enable-debug_wop \
	# --enable-posixmutexes

make libdb=%{_libdb_a} %{_libdb_a}
make libcxx=%{_libcxx_a} %{_libcxx_a}

# Static link with old db-185 libraries.
/bin/sh ./libtool --mode=compile cc -c -O2 -g -g -I/usr/include/db1 -I../dist/../include -D_REENTRANT  ../dist/../db_dump185/db_dump185.c
cc -s -static -o db_dump185 db_dump185.o -L%{_libdir} -ldb1

# Compile rest normally.
make libdb=%{_libdb_a} libcxx=%{_libcxx_a} TCFLAGS='-I$(builddir)'
popd

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_includedir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
%makeinstall -C build_unix libdb=%{_libdb_a} libcxx=%{_libcxx_a}

# XXX annoying
#set -x
cd $RPM_BUILD_ROOT

%if %mdkversion < 1000
  mkdir -p ./%{_lib}
  mv .%{_libdir}/libdb-%{__soversion}.so ./%{_lib}
# XXX Rather than hack *.la (see below), create /usr/lib/libdb-3.1.so symlink.
  ln -sf ../../%{_lib}/libdb-%{__soversion}.so .%{_libdir}/libdb-%{__soversion}.so
%endif

  mkdir -p .%{_includedir}/db3
  mv .%{_prefix}/include/*.h .%{_includedir}/db3
  ln -sf db3/db.h .%{_includedir}/db.h
# XXX This is needed for parallel install with db4
  for F in .%{_prefix}/bin/db_* ; do
    mv $F `echo $F | sed -e 's,/db_,/db3_,'`
  done
cd -
#set +x

# XXX libdb-3.1.so is in /lib teach libtool as well
#perl -pi -e 's,/usr,,' $RPM_BUILD_ROOT%{_libdir}/libdb-%{__soversion}.la

# Move db.jar file to the correct place, and version it
%if %{build_java}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/java
mv $RPM_BUILD_ROOT%{_libdir}/db.jar $RPM_BUILD_ROOT%{_datadir}/java/db-%{__soversion}.jar
%endif

# Remove unpackaged files
rm -rf	$RPM_BUILD_ROOT/usr/docs \
	$RPM_BUILD_ROOT/%{_libdir}/libdb_java-3.3_g.so	\
	$RPM_BUILD_ROOT/%{_libdir}/libdb_java-3.so	\
	$RPM_BUILD_ROOT/%{_libdir}/libdb_tcl-3.so	\
	$RPM_BUILD_ROOT/%{_libdir}/libdb_cxx-3.so	\
	$RPM_BUILD_ROOT/%{_libdir}/libdb-3.so

%clean
rm -rf $RPM_BUILD_ROOT

%post -n %libdb -p /sbin/ldconfig
%postun -n %libdb -p /sbin/ldconfig

%post -n %libdbcxx -p /sbin/ldconfig
%postun -n %libdbcxx -p /sbin/ldconfig

%if %{build_java}
%post -n %libdbjava -p /sbin/ldconfig
%postun -n %libdbjava -p /sbin/ldconfig
%endif

%post -n %libdbtcl -p /sbin/ldconfig
%postun -n %libdbtcl -p /sbin/ldconfig

%files -n %libdb
%defattr(644,root,root,755)
%doc LICENSE README
%if %mdkversion < 1000
%attr(755,root,root) /%{_lib}/libdb-%{__soversion}.so
%endif
%attr(755,root,root) %{_libdir}/libdb-%{__soversion}.so

%files -n %libdbcxx
%defattr(755,root,root)
%{_libdir}/libdb_cxx-%{__soversion}.so

%if %{build_java}
%files -n %libdbjava
%defattr(644,root,root,755)
%doc docs/api_java
%attr(755,root,root) %{_libdir}/libdb_java-%{__soversion}.so
%{_datadir}/java/db-%{__soversion}.jar
%endif

%files -n %libdbtcl
%defattr(755,root,root)
%{_libdir}/libdb_tcl-%{__soversion}.so

%files utils
%defattr(644,root,root,755)
%doc	docs/utility
%attr(755,root,root) %{_bindir}/*

%files -n %libdbdevel
%defattr(644,root,root,755)
%doc	docs/api_c docs/api_cxx docs/api_java docs/api_tcl docs/index.html
%doc	docs/ref docs/sleepycat docs/images
%doc	examples_c examples_cxx
%{_includedir}/*
%{_libdir}/libdb.so
%{_libdir}/libdb-%{__soversion}.la
%{_libdir}/%{_libdb_a}
%{_libdir}/libdb_cxx.so
%{_libdir}/libdb_cxx-%{__soversion}.la
%{_libdir}/%{_libcxx_a}
%{_libdir}/libdb_tcl.so
%{_libdir}/libdb_tcl-%{__soversion}.a
%{_libdir}/libdb_tcl-%{__soversion}.la
%if %{build_java}
%{_libdir}/libdb_java.so
%{_libdir}/libdb_java-%{__soversion}.a
%{_libdir}/libdb_java-%{__soversion}.la
%endif




%changelog
* Fri Sep 07 2007 Anssi Hannula <anssi@mandriva.org> 3.3.11-24mdv2008.0
+ Revision: 82000
- rebuild for new soname of tcl

* Thu Aug 23 2007 Thierry Vignaud <tvignaud@mandriva.com> 3.3.11-23mdv2008.0
+ Revision: 70171
- kill ldconfig require as requested by pixel
- kill file require


* Sat Mar 03 2007 Emmanuel Andry <eandry@mandriva.org> 3.3.11-22mdv2007.0
+ Revision: 131895
- uncompress patches
- Import db3

* Sun Apr 16 2006 Luca Berra <bluca@vodka.it> 3.3.11-21mdk
- remove old %%mdkversion define
- provide libdb3.3-devel also for biarches
- devel conflicts with all known db4X-devel
- force permissions on %%files
- allow installation of db3-utils in parallel with db4X-utils

* Thu Feb 16 2006 Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> 3.3.11-20mdk
- Rebuild for new tcl
- Patch 2 : fix configure script with bash 3.1
- Fix fake javac
- But as I can't get the java bindings to be rebuild, disable them for know
- Replace PreReq by Requires(pre)

* Fri Jul 09 2004 Christiaan Welvaart <cjw@daneel.dyndns.org> 3.3.11-19mdk
- fix build of db_dump185 with current libtool
- rebuild with gcc 3.4

* Sat Jun 05 2004 <lmontel@n2.mandrakesoft.com> 3.3.11-18mdk
- Rebuild