Blob Blame History Raw
# TODO: no support for netconf/sysconf yet
%bcond_with sysrepo
%bcond_with gtest

#%%global prever P1
%global keama_version 4.5.0
# Bundled version of Bind libraries linked into Keama
%global bind_version 9.11.36

Name:           kea
Version:        2.4.1
Release:        %autorelease
Summary:        DHCPv4, DHCPv6 and DDNS server from ISC

License:        MPL-2.0 AND BSL-1.0
Source11:       kea-dhcp4.service
Source12:       kea-dhcp6.service
Source13:       kea-dhcp-ddns.service
Source14:       kea-ctrl-agent.service
Source15:       kea-tmpfiles.d.conf

Patch1:         kea-openssl-version.patch
Patch2:         kea-gtest.patch

# autoreconf
BuildRequires: autoconf automake libtool
BuildRequires: boost-devel
BuildRequires: gcc-c++
# %%configure --with-openssl
BuildRequires: openssl-devel
# %%configure --with-dhcp-mysql
%if 0%{?fedora} || 0%{?rhel} > 7
BuildRequires: mariadb-connector-c-devel
# TODO: propose upstream fix so this is not needed (no server-side related
# headers nor configuration should be needed)
BuildRequires: postgresql-server-devel
# %%configure --with-dhcp-mysql
BuildRequires: mariadb-devel
# %%configure --with-dhcp-pgsql
BuildRequires: postgresql-devel
BuildRequires: log4cplus-devel
%if %{with sysrepo}
# %%configure --with-sysrepo
BuildRequires: sysrepo-devel

%ifarch %{valgrind_arches}
BuildRequires: valgrind-devel
# src/lib/testutils/
BuildRequires: procps-ng
%if %{with gtest}
# %%configure --enable-gtest
BuildRequires: gtest-devel
# %%configure --enable-generate-parser
BuildRequires: bison
BuildRequires: flex
# %%configure --enable-shell
BuildRequires: python3-devel
# in case you ever wanted to use %%configure --enable-generate-docs
#BuildRequires: elinks asciidoc plantuml
BuildRequires: systemd
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx_rtd_theme
BuildRequires: make
BuildRequires: gnupg2

Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

DHCP implementation from Internet Systems Consortium, Inc. that features fully
functional DHCPv4, DHCPv6 and Dynamic DNS servers.
Both DHCP servers fully support server discovery, address assignment, renewal,
rebinding and release. The DHCPv6 server supports prefix delegation. Both
servers support DNS Update mechanism, using stand-alone DDNS daemon.

%package doc
Summary: Documentation for Kea DHCP server
BuildArch: noarch

%description doc
Documentation and example configuration for Kea DHCP server.

%package devel
Summary: Development headers and libraries for Kea DHCP server
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
# to build hooks (#1335900)
Requires: boost-devel
Requires: openssl-devel
Requires: pkgconfig

%description devel
Header files and API documentation.

%package hooks
Summary: Hooks libraries for kea
Requires: %{name}-libs%{?_isa} = %{version}-%{release}

%description hooks
Hooking mechanism allow Kea to load one or more dynamically-linked libraries
(known as "hooks libraries") and, at various points in its processing
("hook points"), call functions in them.  Those functions perform whatever
custom processing is required.

%package libs
Summary: Shared libraries used by Kea DHCP server

%description libs
This package contains shared libraries used by Kea DHCP server.

%package keama
Summary: Experimental migration assistant for Kea
Provides: bundled(bind-libs) = %{bind_version}

%description keama
The KEA Migration Assistant is an experimental tool which helps to translate
ISC DHCP configurations to Kea.

%if 0%{?fedora} || 0%{?rhel} > 8
%{gpgverify} --keyring='%{S:10}' --signature='%{S:1}' --data='%{S:0}'
%{gpgverify} --keyring='%{S:10}' --signature='%{S:3}' --data='%{S:2}'

%autosetup -T -b2 -N -n keama-%{keama_version}
%autosetup -p1 -n kea-%{version}%{?prever:-%{prever}}

rm -rf doc/sphinx/_build

# to be able to build on ppc64(le)
sed -i -e 's|ECHO|YYECHO|g' src/lib/eval/

autoreconf --verbose --force --install

%configure \
    --disable-dependency-tracking \
    --disable-rpath \
    --disable-silent-rules \
    --disable-static \
    --enable-generate-parser \
    --enable-shell \
    --enable-generate-docs \
    --enable-generate-messages \
    --enable-perfdhcp \
%if %{with gtest}
    --with-gtest \
    --with-mysql \
    --with-pgsql \
    --with-gnu-ld \
    --with-log4cplus \
%if %{with sysrepo}
    --with-sysrepo \


# Configure & build Keama
pushd ../keama-%{keama_version}
%configure \
    --disable-dependency-tracking \


%if %{with gtest}
make check

%make_install docdir=%{_pkgdocdir}

# Install Keama
pushd ../keama-%{keama_version}

# Remove Keama's static library, dhcp headers and man pages
rm -f %{buildroot}/%{_libdir}/libdhcp.a
rm -rf %{buildroot}/%{_includedir}/omapip/
rm -rf %{buildroot}%{_mandir}/man5/

# Get rid of .la files
find %{buildroot} -type f -name "*.la" -delete -print

%if %{without sysrepo}
# Remove netconf files
rm %{buildroot}%{_mandir}/man8/kea-netconf.8

# Install systemd units
install -Dpm 0644 %{S:11} %{buildroot}%{_unitdir}/kea-dhcp4.service
install -Dpm 0644 %{S:12} %{buildroot}%{_unitdir}/kea-dhcp6.service
install -Dpm 0644 %{S:13} %{buildroot}%{_unitdir}/kea-dhcp-ddns.service
install -Dpm 0644 %{S:14} %{buildroot}%{_unitdir}/kea-ctrl-agent.service

# Start empty lease databases
mkdir -p %{buildroot}%{_sharedstatedir}/kea/
touch %{buildroot}%{_sharedstatedir}/kea/kea-leases4.csv
touch %{buildroot}%{_sharedstatedir}/kea/kea-leases6.csv

rm -f %{buildroot}%{_pkgdocdir}/COPYING
rm -f %{buildroot}%{_pkgdocdir}/html/.buildinfo

mkdir -p %{buildroot}/run
install -dm 0755 %{buildroot}/run/kea/

install -Dpm 0644 %{S:15} %{buildroot}%{_tmpfilesdir}/kea.conf

%systemd_post kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service kea-ctrl-agent.service

%systemd_preun kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service kea-ctrl-agent.service

%systemd_postun_with_restart kea-dhcp4.service kea-dhcp6.service kea-dhcp-ddns.service kea-ctrl-agent.service

%ldconfig_scriptlets libs

%license COPYING
%dir %{_sysconfdir}/kea/
%config(noreplace) %{_sysconfdir}/kea/kea*.conf
%dir %{_sharedstatedir}/kea
%config(noreplace) %{_sharedstatedir}/kea/kea-leases*.csv
%if %{with sysrepo}
%dir /run/kea/

%files doc
%dir %{_pkgdocdir}
%doc %{_pkgdocdir}/AUTHORS
%doc %{_pkgdocdir}/ChangeLog
%doc %{_pkgdocdir}/
%doc %{_pkgdocdir}/
%doc %{_pkgdocdir}/examples
%doc %{_pkgdocdir}/html
%doc %{_pkgdocdir}/platforms.rst
%doc %{_pkgdocdir}/README

%files devel

%files hooks
%dir %{_libdir}/kea

%files libs
%license COPYING
# find `rpm --eval %%{_topdir}`/BUILDROOT/kea-*/usr/lib64/ -type f | grep /usr/lib64/libkea | sed -e 's#.*/usr/lib64\(.*\.so\.[0-9]\+\)\.[0-9]\+\.[0-9]\+#%%{_libdir}\1*#' | sort

%files keama
%license COPYING