File libdb_java-4_5.spec of Package libdb-4_5

# spec file for package libdb_java-4_5
# 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

%define         generic_name db
%define         docdir %{_defaultdocdir}/%{name}
%define         major 4
%define         minor 5

Name:           libdb_java-4_5
Version:        %{major}.%{minor}.20
Release:        0
Summary:        Java Bindings for the Berkeley DB
License:        BSD-3-Clause
Group:          Productivity/Databases/Servers
Source:         db-%{version}.tar.bz2
Source9:        getpatches
Patch0:         db-%{version}-rep.patch
Patch1:         db-%{version}-sequence.patch
Patch2:         db-%{version}.patch
BuildRequires:  autoconf
BuildRequires:  gcc-c++
BuildRequires:  java-sdk >= 1.5
BuildRequires:  unzip
BuildRequires:  update-alternatives
Requires:       libdb-%{major}_%{minor} = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Conflicts:      libdb_java-4_8

These are the Java bindings for the Berkeley DB. They are needed for
the Java support of db and dbxml.

%package        devel
Summary:        Java Bindings for the Berkeley DB
Group:          Productivity/Databases/Servers
Requires:       %{name} = %{version}
Requires:       glibc-devel
Conflicts:      libdb_java-4_8-devel

%description    devel
These are the Java bindings for the Berkeley DB. They are needed for
the Java support of db and dbxml.

These are the development files.

%setup -q -n %{generic_name}-%{version}
cd ..
tar -jcf %{generic_name}-%{version}.tar.bz2 %{generic_name}-%{version}

cd dist
CFLAGS="%{optflags} -fno-strict-aliasing"
# Build now the NPTL version
mkdir ../build_nptl
cd ../build_nptl
../dist/configure --prefix=%{_prefix} \
        --libdir=%{_libdir} --enable-compat185 --disable-dump185 \
        --enable-shared --disable-static --enable-rpc --enable-cxx \
        --with-mutex="POSIX/pthreads/library" \
        --enable-java JAVACFLAGS="-source 1.4 -target 1.4" \
%ifarch %arm
# 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 %{?_smp_mflags} LIBSO_LIBS='$(LIBS)' LIBXSO_LIBS='$(LIBS)'" -L%{_libdir} -lstdc++"

mkdir -p %{buildroot}%{_includedir}/db4
CONFIG_ARGS=$(find . -name "config.log" -exec grep "\$ \.\./dist\/configure" {} \; | sed 's/.*configure\( --.*\)/\1/g')
if [ -z "$CONFIG_ARGS" ]
  echo "could not find configure arguments ... exiting"
  exit 42
mkdir -p %{buildroot}%{_libdir}
cd build_nptl
make prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} strip=true install
cd ..
# make ldd happy:
chmod 755 %{buildroot}%{_libdir}/libdb*.so
# Fix header file installation
mv %{buildroot}%{_includedir}/*.h %{buildroot}%{_includedir}/db4
echo "#include <db4/db.h>" > %{buildroot}%{_includedir}/db.h
echo "#include <db4/db_185.h>" > %{buildroot}%{_includedir}/db_185.h
echo "#include <db4/db_cxx.h>" > %{buildroot}%{_includedir}/db_cxx.h
# remove dangling tags symlink from examples.
rm -f examples_cxx/tags
rm -f examples_c/tags
# Move documentation to the right directory
mkdir -p %{buildroot}%{docdir}
mv %{buildroot}%{_prefix}/docs/* %{buildroot}/%{docdir}
cp -a examples_cxx examples_c %{buildroot}/%{docdir}
cp -a LICENSE README %{buildroot}/%{docdir}
# Remove api documentation for Java and TCL
rm -rf %{buildroot}/%{docdir}/java
rm -rf %{buildroot}/%{docdir}/api_java
rm -rf %{buildroot}/%{docdir}/api_tcl
mv %{buildroot}/%{docdir}/collections/tutorial %{buildroot}/%{docdir}/
# Remove crappy *.la files
rm -rf %{buildroot}%{_libdir}/*.la
rm -rf %{buildroot}%{_libdir}/tls/*.la
pushd %{buildroot}
for file in `find | grep -v "\(java\|jar\)"`
  rm $file || true
rm -rf %{buildroot}/%{_defaultdocdir}
mkdir -p %{buildroot}/%{_javadir}
mv %{buildroot}/%{_libdir}/*.jar %{buildroot}/%{_javadir}/db-%{version}.jar
ln -sf %{_javadir}/db-%{version}.jar %{buildroot}/%{_javadir}/db.jar

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files devel

openSUSE Build Service is sponsored by