Summary:     The BSD database library for C (version 1).
Summary(ja): C 用 BSD データベースライブラリ (バージョン1)
Name:        db1
Version:     1.85
Release:     5vl2
Source:      http://www.sleepycat.com/update/%{version}/db.%{version}.tar.gz
Patch:       db.%{version}.patch
URL:         http://www.sleepycat.com
Copyright:   BSD
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 1) library.
Summary(ja): Berkeley DB (バージョン1) 用開発ライブラリ/ヘッダファイル
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.
It should be installed if compatibility is needed with databases created
with db1.
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 db.%{version}
%patch -p1


%build

gzip -9 docs/*.ps
cd PORT/linux
OORG="$RPM_OPT_FLAGS" make


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

sed -n '/^\/\*-/,/^ \*\//s/^.\*.\?//p' include/db.h | grep -v '^@.*db\.h' > LICENSE

perl -pi -e 's/<db.h>/<db1\/db.h>/' PORT/include/ndbm.h

cd PORT/linux
sover=`echo libdb.so.* | sed 's/libdb.so.//'`
install -m644 libdb.a			$RPM_BUILD_ROOT/%{_prefix}/lib/libdb1.a
install -m755 libdb.so.$sover		$RPM_BUILD_ROOT/%{_prefix}/lib/libdb1.so.$sover
ln -sf libdb1.so.$sover 		$RPM_BUILD_ROOT/%{_prefix}/lib/libdb1.so
ln -sf libdb1.so.$sover			$RPM_BUILD_ROOT/%{_prefix}/lib/libdb.so.$sover
install -m644 ../include/ndbm.h		$RPM_BUILD_ROOT/%{_prefix}/include/db1/
install -m644 ../../include/db.h	$RPM_BUILD_ROOT/%{_prefix}/include/db1/
install -m644 ../../include/mpool.h	$RPM_BUILD_ROOT/%{_prefix}/include/db1/
install -s -m755 db_dump185		$RPM_BUILD_ROOT/%{_prefix}/bin/db1_dump185


%clean
rm -rf ${RPM_BUILD_ROOT}


%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc README LICENSE changelog
%{_prefix}/lib/libdb1.so.*
%{_prefix}/lib/libdb.so.*
%{_prefix}/bin/db1_dump185


%files devel
%defattr(-,root,root)
%doc docs/*.ps.gz
%{_prefix}/include/db1
%{_prefix}/lib/libdb1.a
%{_prefix}/lib/libdb1.so


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

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

* Fri Oct  6 2000 Jeff Johnson <jbj@redhat.com>
- use <db1/db.h> if including <db1/ndbm.h> (#18292).

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

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

* Sun Aug  6 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

* Sun May 28 2000 Jeff Johnson <jbj@redhat.com>
- rename db_dump185 to db1_dump185 to avoid file conflict with db3.

* Thu Apr 20 2000 Jakub Jelinek <jakub@redhat.com>
- Include db_dump185 program from db2 here (as it is linked
  against this shared library).

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