File dba-lmdb-0929.spec of Package dba-lmdb-0929

%define real_name 	lmdb
%define version		0.9.29
%define vers		0929
%define prefix		/DBA/lmdb/%{version}
%global debug_package %{nil}

Name:           dba-%{real_name}-%{vers}
Summary:        Lightning Memory-Mapped Database Manager
Version:        %{version}
Release:        1
License:        OLDAP-2.8
Url:            https://symas.com/mdb/
Group:          Productivity/Networking/Web/Servers
Source:         https://git.openldap.org/openldap/openldap/-/archive/LMDB_%{version}/openldap-LMDB_%{version}.tar.gz
Source1:        dba-lmdb-rpmlintrc
Source2:        lmdb.pc.in
Source3:        filter-provides.sh
Source4:        filter-requires.sh
# PATCH-FIX-UPSTREAM - debugging tools (https://github.com/kacfengine/lmdb)
Patch1:         0001-Add-extra-tools-and-CFEngine-modifications-for-LMDB.patch
# PATCH-FIX-OPENSUSE - Implicit declaration of atol()
Patch2:         liblmdb-implicit-decl.patch
# PATCH-FIX-OPENSUSE - Build and link to shared library
Patch3:         Makefile-build-use-shared-lib.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%define _use_internal_dependency_generator 0
%define __find_provides %{SOURCE3}
%define __find_requires %{SOURCE4}

BuildRequires:  gcc glibc-devel

%if 0%{?suse_version} >= 1200
BuildRequires:  automake libtool
%endif

%if 0%{?suse_version} >= 1100
BuildRequires:          -post-build-checks
%endif

%description
LMDB is a Btree-based database management library with an API similar
to BerkeleyDB. The library is thread-aware and supports concurrent
read/write access from multiple processes and threads. The DB
structure is multi-versioned, and data pages use a copy-on-write
strategy, which also provides resistance to corruption and eliminates
the need for any recovery procedures. The database is exposed in a
memory map, requiring no page cache layer of its own.

%prep
%setup -qn openldap-LMDB_%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1

%{__chmod} +x %{SOURCE3}
%{__chmod} +x %{SOURCE4}

%build
cd libraries/liblmdb
make %{?_smp_mflags} V=1 SOVERSION=%{version} shared=no CFLAGS="%{optflags}"

%install
# prevent rpath problem on suse
export NO_BRP_CHECK_RPATH=true

cd libraries/liblmdb
#make install DESTDIR="%buildroot" SOVERSION=%{version} \
#    bindir=%{_bindir} \
#    libdir=%{_libdir} \
#    mandir=%{_mandir} \
#    includedir=%{_includedir} \
#    datarootdir=%{_datadir}
#ln -s %{_libdir}/liblmdb-%{version}.so %{buildroot}%{_libdir}/liblmdb.so
#
#%{__mkdir_p}  %{buildroot}%{_libdir}/pkgconfig
#
## Install pkgconfig file
#sed -e 's:@PREFIX@:%{_prefix}:g' \
#    -e 's:@EXEC_PREFIX@:%{_exec_prefix}:g' \
#    -e 's:@LIBDIR@:%{_libdir}:g' \
#    -e 's:@INCLUDEDIR@:%{_includedir}:g' \
#    -e 's:@PACKAGE_VERSION@:%{version}:g' \
#    %{SOURCE1} >lmdb.pc
#install -Dpm 0644 -t %{buildroot}%{_libdir}/pkgconfig lmdb.pc

make DESTDIR=$RPM_BUILD_ROOT install SOVERSION=%{version} \
    bindir=%{prefix}/bin \
    libdir=%{prefix}/lib \
    mandir=%{prefix}/man \
    includedir=%{prefix}/include 

cd  %{buildroot}%{prefix}/lib/
ln -s liblmdb-%{version}.so liblmdb.so

%{__mkdir_p} %{buildroot}%{prefix}/lib/pkgconfig

# Install pkgconfig file
sed -e 's:@PREFIX@:%{prefix}:g' \
    -e 's:@EXEC_PREFIX@:%{prefix}:g' \
    -e 's:@LIBDIR@:%{prefix}/lib:g' \
    -e 's:@INCLUDEDIR@:%{prefix}/include:g' \
    -e 's:@PACKAGE_VERSION@:%{version}:g' \
    %{SOURCE2} >lmdb.pc
install -Dpm 0644 -t %{buildroot}%{prefix}/lib/pkgconfig lmdb.pc

%post
/sbin/ldconfig  -n %{prefix}/lib

%postun
/sbin/ldconfig  -n %{prefix}/lib

%clean
%{__rm} -rf %{buildroot}

%files
#       _
#  O/ _|_o| _  _
#  /O  | ||(/__>
# 
%defattr(-,root,root)
%dir %{prefix}
%{prefix}/include
%{prefix}/lib
%{prefix}/bin
%{prefix}/man
#%{_bindir}/*
#%_libdir/liblmdb-%version.so
#%_includedir/*
#%_libdir/liblmdb.so
#%_libdir/pkgconfig/lmdb.pc

%changelog
* Fri Jun 17 2022 Dennis Hampe <dennis.hampe@bertelsmann.de>
- inital version
openSUSE Build Service is sponsored by