File gdbm.spec of Package gdbm

#
# spec file for package gdbm
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           gdbm
%define lname	libgdbm4
Url:            http://directory.fsf.org/GNU/gdbm.html
#!BuildIgnore: man
# bug437293
%ifarch ppc64
Obsoletes:      gdbm-64bit
%endif
#
Version:        1.10
Release:        0
Summary:        GNU dbm key/data database
License:        GPL-3.0+
Group:          System/Libraries
Source:         ftp://prep.ai.mit.edu/gnu/gdbm/gdbm-%{version}.tar.gz
Source2:        baselibs.conf
# ENHANCE-FOR-UPSTREM i@marguerite.su - add zh_CN translation. And I'll submit it to upstream.
Source3:        zh_CN.gmo
# FIX-FOR-UPSTREAM i@marguerite.su - remove the build date from src/version.c
Patch4:         gdbm-no-build-date.patch
BuildRequires:  autoconf >= 2.63
BuildRequires:  automake >= 1.11
BuildRequires:  libtool
BuildRequires:  makeinfo
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GNU dbm is a library of database functions that use extensible
hashing and work similar to the standard UNIX dbm. These routines are
provided to a programmer needing to create and manipulate a hashed
database.

The basic use of GDBM is to store key/data pairs in a data file. Each
key must be unique and each key is paired with only one data item.

The library provides primitives for storing key/data pairs, searching
and retrieving the data by its key and deleting a key along with its
data. It also supports sequential iteration over all key/data pairs in
a database.

For compatibility with programs using old UNIX dbm functions, the
package also provides traditional dbm and ndbm interfaces.

%package -n %lname
Summary:        GNU dbm key/data database
License:        GPL-3.0+
Group:          System/Libraries
# O/P added in 12.2
Obsoletes:      gdbm < %{version}-%{release}
Provides:       gdbm = %{version}-%{release}

%description -n %lname
GNU dbm is a library of database functions that use extensible
hashing and work similar to the standard UNIX dbm. These routines are
provided to a programmer needing to create and manipulate a hashed
database.

The basic use of GDBM is to store key/data pairs in a data file. Each
key must be unique and each key is paired with only one data item.

The library provides primitives for storing key/data pairs, searching
and retrieving the data by its key and deleting a key along with its
data. It also supports sequential iteration over all key/data pairs in
a database.

For compatibility with programs using old UNIX dbm functions, the
package also provides traditional dbm and ndbm interfaces.

%package devel
Summary:        Include Files and Libraries mandatory for Development
License:        GPL-3.0+ and LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires(pre):  %install_info_prereq
Requires:       gdbm = %{version}
Provides:       gdbm:/usr/lib/libgdbm.so
# bug437293
%ifarch ppc64
Obsoletes:      gdbm-devel-64bit
%endif
#

%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.

%prep
%setup -q
%patch4 -p1

%build
aclocal
autoreconf --force --install
%ifarch sparc64
export CC="gcc -m64"
%endif
export CFLAGS="%{optflags} -Wa,--noexecstack"
%configure --enable-libgdbm-compat
make %{?_smp_mflags};

%install
%make_install
echo "/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( %{_libdir}/libgdbm.so %{_libdir}/libgdbm_compat.so )" > %{buildroot}/%{_libdir}/libndbm.so
echo "/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
GROUP ( %{_libdir}/libgdbm.a %{_libdir}/libgdbm_compat.a )" > %{buildroot}/%{_libdir}/libndbm.a

mkdir -p %{buildroot}%{_datadir}/locale/zh_CN/LC_MESSAGES/
cp -r %{SOURCE3} %{buildroot}%{_datadir}/locale/zh_CN/LC_MESSAGES/%{name}.mo
%find_lang %{name}

%post -n %lname -p /sbin/ldconfig

%postun -n %lname -p /sbin/ldconfig

%files -n %lname -f %{name}.lang
%defattr(-,root,root)
%doc COPYING README NEWS
%{_libdir}/libgdbm.so.4
%{_libdir}/libgdbm.so.4.0.0
%{_libdir}/libgdbm_compat.so.4
%{_libdir}/libgdbm_compat.so.4.0.0

%files devel
%defattr(-,root,root)
%{_bindir}/testgdbm
%{_includedir}/dbm.h
%{_includedir}/gdbm.h
%{_includedir}/ndbm.h
%{_infodir}/gdbm.info.gz
%{_libdir}/libgdbm.a
%{_libdir}/libgdbm.so
%{_libdir}/libgdbm_compat.a
%{_libdir}/libgdbm_compat.so
%{_libdir}/libndbm.a
%{_libdir}/libndbm.so
%{_mandir}/man3/gdbm.3.gz
%exclude %{_libdir}/*.la

%post devel
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%postun devel
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%changelog