Summary:     The BSD database library for C (version 2).
Summary(ja): C 用 BSD データベースライブラリ (バージョン2)
Name:        db2
Version:     2.4.14
Release:     5vl2
#Source:     http://www.sleepycat.com/update/2.7.7/db-2.7.7.tar.gz
# Taken from glibc 2.1.3
Source:      db2-glibc-2.1.3.tar.gz
# Patch to make it standalone
Patch0:      db2-glibc-2.1.3.patch
Patch1:      db2-2.4.14-db2.patch
URL:         http://www.sleepycat.com
Copyright:   GPL
Group:       System Environment/Libraries
PreReq:      /sbin/ldconfig
BuildRoot:   %{_tmppath}/%{name}-%{version}-root
Prefix:      %{_prefix}

%ifnarch ia64
Conflicts:   glibc < 2.1.90
%endif


%package devel
Summary:     Development libs/header files for Berkeley DB (version 2) library.
Summary(ja): Berkeley DB (バージョン2) 用開発ライブラリ/ヘッダファイル
Group:       Development/Libraries
Prefix:      %{_prefix}
Requires:    %{name} = %{version}

%ifnarch ia64
Conflicts:   glibc-devel < 2.1.90
%endif


%description
The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides
embedded database support for both traditional and client/server applications.
This library used to be part of the glibc package.


%description devel
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, Hashing, Fixed and Variable-length
record access methods.

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


%prep
%setup -q -n db2
%patch0 -p1
%patch1 -p1 -b .db2


%build
CFLAGS="$RPM_OPT_FLAGS" make


%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/{include/db2,lib,bin}

# XXX this causes all symbols to be deleted from the shared library
#strip -R .comment libdb2.so.3
install -m644 libdb2.a			$RPM_BUILD_ROOT/%{_prefix}/lib/libdb2.a
install -m755 libdb2.so.3		$RPM_BUILD_ROOT/%{_prefix}/lib/libdb2.so.3
ln -sf libdb2.so.3 			$RPM_BUILD_ROOT/%{_prefix}/lib/libdb2.so
ln -sf libdb2.a				$RPM_BUILD_ROOT/%{_prefix}/lib/libndbm.a
ln -sf libdb2.so.3			$RPM_BUILD_ROOT/%{_prefix}/lib/libndbm.so

install -m644 db.h			$RPM_BUILD_ROOT/%{_prefix}/include/db2
install -m644 db_185.h			$RPM_BUILD_ROOT/%{_prefix}/include/db2
for p in db_archive db_checkpoint db_deadlock db_dump db_load \
	 db_printlog db_recover db_stat; do
	q="`echo $p | sed -e 's,^db_,db2_,'`"
	install -s -m755 $p		$RPM_BUILD_ROOT/%{_prefix}/bin/$q
done


%clean
rm -rf ${RPM_BUILD_ROOT}


%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc README LICENSE
%{_prefix}/lib/libdb2.so.3


%files devel
%defattr(-,root,root)
%{_prefix}/include/db2/db.h
%{_prefix}/include/db2/db_185.h
%{_prefix}/lib/libdb2.a
%{_prefix}/lib/libdb2.so
%{_prefix}/lib/libndbm.a
%{_prefix}/lib/libndbm.so
%{_prefix}/bin/db2_archive
%{_prefix}/bin/db2_checkpoint
%{_prefix}/bin/db2_deadlock
%{_prefix}/bin/db2_dump
%{_prefix}/bin/db2_load
%{_prefix}/bin/db2_printlog
%{_prefix}/bin/db2_recover
%{_prefix}/bin/db2_stat


%changelog
* Tue Dec 11 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.4.15-5vl2
- increeased release number for VineSeed main tree :)

* Thu May 10 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 2.4.15-5vl1
- based on 2.4.15-5 from Rawhide
- rebuilt for VineSeed

* Fri Oct  6 2000 Jeff Johnson <jbj@redhat.com>
- license is not BSD, GPL is closer (#17578).

* Thu Aug 17 2000 Bill Nottingham <notting@redhat.com>
- fix ia64 conflicts

* Thu Aug 17 2000 Jeff Johnson <jbj@redhat.com>
- summaries from specspo.

* Fri Jul 14 2000 Jeff Johnson <jbj@redhat.com>
- remove "strip -R comment" from spec file, rely on brp-* instead.

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Wed Jun 28 2000 Matt Wilson <msw@redhat.com>
- regenerated the db2.patch to link against -ldb2, not -ldb

* Mon May  8 2000 Jeff Johnson <jbj@redhat.com>
- Rename files (like db1) to prepare for db3 deployment.
- Change version to reflect Berkeley db rather than glibc distribution.

* Thu Apr 27 2000 Jakub Jelinek <jakub@redhat.com>
- Don't provide makedb, it is provided by glibc.

* Wed Apr 20 2000 Jakub Jelinek <jakub@redhat.com>
- Create.
