File libdb-5_1.spec of Package libdb-5_3

#
# spec file for package libdb-5_3 
#
#

# norootforbuild
BuildRequires: gcc gcc-c++ autoconf automake fdupes
#BuildRequires:    aaa_base acl attr audit-libs autoconf automake bash binutils bzip2 coreutils cpio cpp cracklib cvs diffutils file filesystem fillup findutils gawk gcc gcc-c++ gdbm gettext gettext-devel glibc glibc-devel glibc-locale grep groff gzip info insserv less libacl libattr libbz2-1 libgomp42 libltdl-3 libmudflap42 libreadline5 libtool libuuid1 libvolume_id libxcrypt libzio linux-kernel-headers m4 make man mktemp ncurses net-tools netcfg pam pam-modules patch perl perl-base permissions popt rpm sed sysvinit tar texinfo timezone util-linux zlib

Name:           libdb-5_1
%define         generic_name db
%define         docdir %{_defaultdocdir}/%{name}
%define         source_dir %{_datadir}/%{name}-source
Version:        5.1.29.NC
Release:        0
%define         major 5
%define         minor 1
Summary:        Berkeley DB Database Library Version 5.1
Source:         db-%{version}.tar.gz
Source1:        db-rpmlintrc
Patch0:         gcc8.patch
Url:            http://www.sleepycat.com
License:        BSD-3-Clause
Group:          System/Libraries
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       db = %{version}

%description
The Berkeley DB Database is a programmatic toolkit that provides
database support for applications.

This package contains the necessary runtime libraries.

%package -n db-utils
Summary:        Command Line tools for Managing Berkeley DB Databases
Group:          Productivity/Databases/Tools
Prefix:         %{_prefix}
Requires:       db = %{version}

%description -n db-utils
The Berkeley DB Database is a programmatic toolkit that provides
database support for applications.

This package contains the command line tools for managing Berkeley DB
databases.

%package -n     db-doc
Summary:        Documentation for Berkeley DB
Group:          Development/Libraries/C and C++
Prefix:         %{_prefix}

%description -n db-doc
The Berkeley DB Database is a programmatic toolkit that provides
database support for applications.

This package contains the documentation.

%package        devel
Summary:        Development Include Files and Libraries for Berkeley DB library Version 5.1
Group:          Development/Libraries/C and C++
Prefix:         %{_prefix}
Requires:       db = %{version} glibc-devel
Provides:       db-devel = %{version}

%description    devel
The Berkeley DB Database is a programmatic toolkit that provides
database support for applications.

This package contains the header files and libraries.

%prep 
%setup -q -n %{generic_name}-%{version}
%patch -P 0

%build
cd dist
./s_config
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
CC=gcc
export CFLAGS CXXFLAGS CC
#
# Build now the NPTL version
#
mkdir ../build_nptl
cd ../build_nptl
../dist/configure --prefix=%{_prefix} \
        --libdir=%{_libdir} --enable-compat185 --disable-dump185 \
        --enable-shared --enable-static --enable-cxx --enable-stl \
        --with-mutex="POSIX/pthreads/library" \
        %{_target_cpu}-suse-linux

## Make sure O_DIRECT is really disabled (build host could have old kernel)
#perl -pi -e 's/#define HAVE_O_DIRECT 1/#undef HAVE_O_DIRECT/' db_config.h
## Remove libtool predep_objects and postdep_objects wonkiness
#perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool
#perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool
#perl -pi -e 's/-shared -nostdlib/-shared/' libtool
make LIBSO_LIBS='$(LIBS)' LIBXSO_LIBS='$(LIBS)'" -L%{_libdir} -lstdc++"

%install
mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/db5
#mkdir -p ${RPM_BUILD_ROOT}% {source_dir}/
#
#cp % {_builddir}/% {generic_name}-% {version}.tar.bz2 ${RPM_BUILD_ROOT}% {source_dir}/
#mkdir -p $RPM_BUILD_ROOT/% {_defaultdocdir}/% {name}-source
#cat >>$RPM_BUILD_ROOT/% {_defaultdocdir}/% {name}-source/README<<EOF
#The patches in this directory were applied to the sources.
#The sources were installed to:
#% {source_dir}/% {generic_name}-% {version}.tar.bz2
#EOF
CONFIG_ARGS=$(find . -name "config.log" -exec grep "\$ \.\./dist\/configure" {} \; | sed 's/.*configure\( --.*\)/\1/g')
if [ -z "$CONFIG_ARGS" ]
then
  echo "could not find configure arguments ... exiting"
  exit 42
fi
#echo $CONFIG_ARGS >> $RPM_BUILD_ROOT/% {_defaultdocdir}/% {name}-source/configure_args.txt
#cp % {_sourcedir}/*patch* $RPM_BUILD_ROOT/% {_defaultdocdir}/% {name}-source || true
#cp % {_sourcedir}/*.dif*  $RPM_BUILD_ROOT/% {_defaultdocdir}/% {name}-source || true
#
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}
cd build_nptl
make prefix=${RPM_BUILD_ROOT}%{_prefix} libdir=${RPM_BUILD_ROOT}%{_libdir} strip=false install
cd ..
# make ldd happy:
chmod 755 $RPM_BUILD_ROOT%{_libdir}/libdb*.so
# Fix header file installation
mv ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/db5
for i in ${RPM_BUILD_ROOT}%{_includedir}/db5/*;
do
    header=$(basename $i)
    echo "#include <db5/$header>" > ${RPM_BUILD_ROOT}%{_includedir}/$header
done

# Move documentation to the right directory
mkdir -p $RPM_BUILD_ROOT%{docdir}
mv $RPM_BUILD_ROOT%{_prefix}/docs/* $RPM_BUILD_ROOT/%{docdir}
cp -a LICENSE README $RPM_BUILD_ROOT/%{docdir}
#
# Remove api documentation for Java and TCL
rm -rf $RPM_BUILD_ROOT/%{docdir}/java
rm -rf $RPM_BUILD_ROOT/%{docdir}/api_java
rm -rf $RPM_BUILD_ROOT/%{docdir}/api_tcl
mv $RPM_BUILD_ROOT/%{docdir}/collections/tutorial $RPM_BUILD_ROOT/%{docdir}/
# Remove crappy *.la files
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la
rm -rf $RPM_BUILD_ROOT%{_libdir}/tls/*.la
# link dupes
%fdupes %{buildroot}%{_libdir}
%fdupes %{buildroot}%{docdir}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
rm -rf ${RPM_BUILD_ROOT}

%files 
%defattr(-,root,root)
%{_libdir}/libdb-%{major}.%{minor}.so
%{_libdir}/libdb_cxx-%{major}.%{minor}.so
%{_libdir}/libdb_stl-%{major}.%{minor}.so

%files -n db-doc
%defattr(-,root,root)
%dir %{docdir}
%doc %{docdir}/*

%files -n db-utils
%defattr(-,root,root)
%{_bindir}/db_archive
%{_bindir}/db_checkpoint
%{_bindir}/db_deadlock
%{_bindir}/db_dump
%{_bindir}/db_load
%{_bindir}/db_printlog
%{_bindir}/db_recover
%{_bindir}/db_stat
%{_bindir}/db_upgrade
%{_bindir}/db_verify
%{_bindir}/db_hotbackup
%{_bindir}/db_log_verify
%{_bindir}/db_replicate

%files devel
%defattr(-,root,root)
%dir %{_includedir}/db5
%{_includedir}/db5/*.h
%{_includedir}/db*.h
%{_libdir}/libdb.so
%{_libdir}/libdb.a
%{_libdir}/libdb-%{major}.%{minor}.a
%{_libdir}/libdb-%{major}.so
%{_libdir}/libdb_cxx.so
%{_libdir}/libdb_cxx.a
%{_libdir}/libdb_cxx-%{major}.%{minor}.a
%{_libdir}/libdb_cxx-%{major}.so
%{_libdir}/libdb_stl.so
%{_libdir}/libdb_stl.a
%{_libdir}/libdb_stl-%{major}.%{minor}.a
%{_libdir}/libdb_stl-%{major}.so

%changelog

openSUSE Build Service is sponsored by