Skip to content

Commit

Permalink
Fix broken build
Browse files Browse the repository at this point in the history
  • Loading branch information
progier389 committed Jan 15, 2025
1 parent 2d00beb commit 3a8fe1d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
14 changes: 3 additions & 11 deletions rpm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,9 @@ RPMBUILD_OPTIONS += $(if $(filter 1, $(BUNDLE_LIBDB)),--with bundle_libdb,--with
LIBDB_URL ?= $(shell rpmspec $(RPMBUILD_OPTIONS) -P $(RPMBUILD)/SPECS/389-ds-base.spec | awk '/^Source4:/ {print $$2}')
LIBDB_TARBALL ?= $(shell basename "$(LIBDB_URL)")

# Enable BUNDLE_BDBREADERS if neither BUNDLE_LIBDB nor /usr/include/db.h is available
ifeq ($(BUNDLE_LIBDB), 1)
BUNDLE_BDBREADERS ?= 0
else
ifeq (,$(wildcard /usr/include/db.h))
BUNDLE_BDBREADERS ?= 1
else
BUNDLE_BDBREADERS ?= 0
endif
endif
RPMBUILD_OPTIONS += $(if $(filter 1, $(BUNDLE_BDBREADERS)),--with libbdb-ro,--without libbdb-ro)
# Check if BUNDLE_BDBREADERS is enabled.
BUNDLE_BDBREADERS = $(shell ./rpm/is-robdb-used $(BUNDLE_LIBDB))
RPMBUILD_OPTIONS += $(if $(filter 1, $(BUNDLE_BDBREADERS)),--with libbdb_ro,--without libbdb_ro)


# Some sanitizers are supported only by clang
Expand Down
19 changes: 11 additions & 8 deletions rpm/389-ds-base.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Requires: cyrus-sasl-md5
Requires: cyrus-sasl-plain
# this is needed for backldbm
%if %{with libbdb_ro}
Requires: %{name}-robdb-libs-%{version}
Requires: %{name}-robdb-libs= %{version}-%{release}
%else
%if %{without bundle_libdb}
Requires: libdb
Expand Down Expand Up @@ -446,6 +446,8 @@ autoreconf -fiv
%configure \
%if %{with libbdb_ro}
--with-libbdb-ro \
%else
--without-libbdb-ro \
%endif
%if %{with bundle_libdb}
--with-bundle-libdb=%{_builddir}/%{libdb_base_version}/BUILD/%{libdb_base_dir}/dist/dist-tls \
Expand Down Expand Up @@ -553,10 +555,7 @@ popd
%endif

%if %{with libbdb_ro}
mkdir -p ../robdb
pushd ../robdb
tar -xjf %{_sourcedir}/%{name}-%{version}.tar.bz2 --transform "s,^%{name}-%{version}/lib/librobdb,.," %{name}-%{version}/lib/librobdb/*
cp -pa COPYING COPYING.librobdb
pushd lib/librobdb
cp -pa COPYING %{_builddir}/%{name}-%{version}/COPYING.librobdb
cp -pa COPYING.RPM %{_builddir}/%{name}-%{version}/COPYING.RPM
install -m 0755 -d %{buildroot}/%{_libdir}
Expand All @@ -566,8 +565,8 @@ install -m 0755 -d %{buildroot}/%{_licensedir}/%{name}-robdb-libs
install -m 0644 $PWD/README.md %{buildroot}/%{_docdir}/%{name}-robdb-libs/README.md
install -m 0644 $PWD/COPYING %{buildroot}/%{_licensedir}/%{name}-robdb-libs/COPYING
install -m 0644 $PWD/COPYING.RPM %{buildroot}/%{_licensedir}/%{name}-robdb-libs/COPYING.RPM
install -m 0644 $PWD/COPYING.librobdb %{buildroot}/%{_licensedir}/%{name}/COPYING.librobdb
install -m 0644 $PWD/COPYING %{buildroot}/%{_licensedir}/%{name}/COPYING.RPM
install -m 0644 $PWD/COPYING %{buildroot}/%{_licensedir}/%{name}/COPYING.librobdb
install -m 0644 $PWD/COPYING.RPM %{buildroot}/%{_licensedir}/%{name}/COPYING.RPM
popd
%endif

Expand Down Expand Up @@ -734,6 +733,9 @@ fi
%exclude %{_libdir}/%{pkgname}/lib/libjemalloc_pic.a
%exclude %{_libdir}/%{pkgname}/lib/pkgconfig
%endif
%if %{with libbdb_ro}
%exclude %{_libdir}/%{pkgname}/librobdb.so
%endif

%files devel
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel
Expand Down Expand Up @@ -800,10 +802,11 @@ fi
%files robdb-libs
%license COPYING.librobdb COPYING.RPM
%doc %{_defaultdocdir}/%{name}-robdb-libs/README.md
/usr/lib64/dirsrv/librobdb.so
%{_libdir}/%{pkgname}/librobdb.so
%{_licensedir}/%{name}-robdb-libs/COPYING
%{_licensedir}/%{name}/COPYING.RPM
%{_licensedir}/%{name}/COPYING.librobdb

%endif

%changelog
Expand Down
23 changes: 23 additions & 0 deletions rpm/is-robdb-used
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Determine if Read Only Berkeley Database is needed.

BUNDLE_LIBDB="$1"

rc()
{
echo $1
exit 0
}

# Not needed if libdb is bundled (Typically on RHEL)
[ x$BUNDLE_LIBDB = x1 ] && rc 0
# Needed if libdb is not available
[ ! -f /usr/include/db.h ] && rc 1
# Needed on Fedora and CentOs
[ -f /etc/fedora-release ] && rc 1
[ -f /etc/centos-release ] && rc 1
# Still support full bdb
rc 0


0 comments on commit 3a8fe1d

Please sign in to comment.