%define pkg_name    tinycdb
%define pkg_version 0.78
%define pkg_release 2%{?_dist_release}

Summary: A package for maintenance of constant databases
Name:    %{pkg_name}
Version: %{pkg_version}
Release: %{pkg_release}

License: Public Domain
Group:   Applications/System
URL:     http://www.corpit.ru/mjt/tinycdb.html

Source:  http://www.corpit.ru/mjt/tinycdb/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-root
BuildRequires: build-essential

Vendor: Project Vine
Distribution: Vine Linux
Packager: ara_t


%description
tinycdb is a small, fast and reliable utility set and subroutine
library for creating and reading constant databases. The database
structure is tuned for fast reading:
+ Successful lookups take normally just two disk accesses.
+ Unsuccessful lookups take only one disk access.
+ Small disk space and memory size requirements; a database
  uses 2048 bytes for the header and 24 bytes plus size of
  (key,value) per record.
+ Maximum database size is 4GB; individual record size is not
  otherwise limited.
+ Portable file format.
+ Fast creation of new databases.
+ No locking, updates are atomical.

This package contains both the utility and the development
files, together with nss_cdb module.


%package devel
Summary: Development files for the tinycdb library.
Group:   Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
tinycdb is a small, fast and reliable utility set and subroutine
library for creating and reading constant databases.

This package contains tinycdb development libraries and header files.


%package devel-static
Summary: Development files for the tinycdb static library.
Group:   Development/Libraries
Requires: %{name}-devel = %{version}-%{release}

%description devel-static
Static library for tinycdb


%prep
%setup -q

%build
%{__make} CFLAGS="$RPM_OPT_FLAGS" \
          staticlib sharedlib cdb-shared nss \
          sysconfdir=/etc

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__mkdir} -p ${RPM_BUILD_ROOT}
%{make_install} \
 libdir=%{_libdir} bindir=%{_bindir} mandir=%{_mandir} \
 syslibdir=%{_libdir} sysconfdir=/etc \
 includedir=%{_includedir} \
 install-all install-nss install-piclib install-sharedlib

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post -p %{_syssbindir}/ldconfig
%postun -p %{_syssbindir}/ldconfig


%files
%defattr(-,root,root)
%{_bindir}/*
%{_mandir}/man1/*
%{_mandir}/man3/*
%{_mandir}/man5/*
%{_libdir}/libcdb.so*
%{_libdir}/libnss_cdb*
/etc/cdb-Makefile
%doc ChangeLog NEWS debian/changelog

%files devel
%defattr(-,root,root)
%{_includedir}/*

%files devel-static
%defattr(-,root,root)
%{_libdir}/libcdb.a
%{_libdir}/libcdb_pic.a


%changelog
* Sun Apr 10 2016 Toshiaki Ara <ara_t@384.jp> 0.78-2
- correct SPEC file

* Mon Jul 13 2015 Toshiaki Ara <ara_t@384.jp> 0.78-1
- Initial release