File pdns.spec of Package pdns
#
# spec file for package pdns
#
# Copyright (c) 2017 SUSE LINUX 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 http://bugs.opensuse.org/
#
Name: pdns
Version: 4.0.4
Release: 0
#
%define pkg_name pdns
%define pkg_version 4.0.4
#
%if 0%{?suse_version} > 1230 || 0%{?rhel_version} > 600 || 0%{?centos_version} > 600 || 0%{?fedora_version} >= 20 || 0%{?el7}%{?fc20}%{?fc21}%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without systemd
%else
%bcond_with systemd
%endif
%if 0%{?fedora_version} >= 24 || 0%{?fc24}%{?fc25}
%bcond_with systemd_separetedlibs
%else
%bcond_without systemd_separetedlibs
%endif
#
%bcond_without pdns_lua
%bcond_without pdns_mydns
%bcond_with pdns_experimental_gss_tsig
%bcond_without pdns_odbc
%bcond_without pdns_sqlite3
%bcond_with pdns_tinydns
%if (0%{?suse_version} > 1230 && 0%{?suse_version} != 1315) || 0%{?is_opensuse}
%bcond_without pdns_geoip
%else
%bcond_with pdns_geoip
%endif
%if 0%{?suse_version} && ! ( 0%{?suse_version} == 1315 && ! 0%{?is_opensuse} )
%bcond_without pdns_protobuf
%bcond_without pdns_botan
%else
%bcond_with pdns_protobuf
%bcond_with pdns_botan
%endif
%if 0%{?suse_version} > 1110 || 0%{?rhel_version} > 600 || 0%{?centos_version} > 600 || 0%{?fedora_version} >= 22 || 0%{?fc22}%{?fc23}%{?fc24}%{?fc25}
%bcond_without pdns_tools
%bcond_without pdns_pkcs11
%bcond_without pdns_zeromq
%else
%bcond_with pdns_tools
%bcond_with pdns_pkcs11
%bcond_with pdns_zeromq
%endif
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with pdns_botan}
BuildRequires: Botan-devel >= 1.10
%endif
#BuildRequires: asciidoc
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
%if 0%{?suse_version} > 1325
BuildRequires: libboost_program_options-devel
%else
BuildRequires: boost-devel
%endif
BuildRequires: curl-devel
BuildRequires: flex
%if %{with pdns_geoip}
BuildRequires: GeoIP-devel
BuildRequires: yaml-cpp-devel
%endif
%if %{with pdns_experimental_gss_tsig}
BuildRequires: pkgconfig(gss)
BuildRequires: pkgconfig(krb5)
BuildRequires: pkgconfig(krb5-gssapi)
%endif
BuildRequires: gcc-c++
BuildRequires: gdbm-devel
BuildRequires: libtool
# unused atm BuildRequires: libedit-devel
BuildRequires: libsodium-devel
%if %{with pdns_lua}
BuildRequires: lua-devel
%endif
%if %{with pdns_tinydns}
# FIXME: Could not find libcdb/tinycdb
%endif
BuildRequires: mysql-devel
%if 0%{?suse_version}
BuildRequires: openldap2-devel
%else
BuildRequires: openldap-devel
%endif
BuildRequires: postgresql-devel
#BuildRequires: ragel
%if %{with pdns_protobuf}
BuildRequires: protobuf-devel
%endif
BuildRequires: sqlite-devel >= 3
%if %{with pdns_sqlite3}
BuildRequires: sqlite-devel >= 3
%endif
%if %{with pdns_odbc}
BuildRequires: unixODBC-devel
%endif
#
%if %{with pdns_opendbx}
BuildRequires: opendbx-backend-pgsql
BuildRequires: opendbx-devel
%endif
BuildRequires: pkgconfig
%if %{with pdns_pkcs11}
BuildRequires: pkgconfig(p11-kit-1)
%endif
%if %{with pdns_zeromq}
BuildRequires: zeromq-devel
%endif
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%if %{with systemd_separetedlibs}
BuildRequires: pkgconfig(libsystemd)
%endif
%{?systemd_requires}
%else
PreReq: %fillup_prereq
PreReq: %insserv_prereq
%endif
PreReq: pdns-common
#
Url: http://www.powerdns.com/
Source: http://downloads.powerdns.com/releases/pdns-%{pkg_version}.tar.bz2
Source3: http://downloads.powerdns.com/releases/pdns-%{pkg_version}.tar.bz2.sig
Source1: rcpdns
Source2: README.opendbx
Patch: pdns-4.0.3_allow_dacoverride_in_capset.patch
# PATCH-FIX-UPSTREAM pdns-4.0.4_mysql-schema-mariadb.patch
Patch2: pdns-4.0.4_mysql-schema-mariadb.patch
Summary: Modern, advanced and high performance authoritative-only nameserver
License: GPL-2.0
Group: Productivity/Networking/DNS/Servers
%description
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
%package backend-mysql
Requires: %{name} = %{version}
#
Summary: MySQL backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-mysql
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the MySQL backend for pdns.
%if %{with pdns_mydns}
%package backend-mydns
Requires: %{name} = %{version}
#
Summary: MyDNS backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-mydns
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the MyDNS backend for pdns.
%endif
%package backend-postgresql
Requires: %{name} = %{version}
#
Summary: PostgreSQL backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-postgresql
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the PostgreSQL backend for pdns.
%if %{with pdns_odbc}
%package backend-godbc
Requires: %{name} = %{version}
#
Summary: ODBC backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-godbc
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the ODBC backend for pdns.
%endif
%if %{with pdns_sqlite3}
%package backend-sqlite3
Requires: %{name} = %{version}
#
Summary: SQLite 3 backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-sqlite3
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the SQLite 3 backend for pdns.
%endif
%package backend-ldap
Requires: %{name} = %{version}
#
Summary: LDAP backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-ldap
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the LDAP backend for pdns.
%if %{with pdns_opendbx}
%package backend-opendbx
Requires: %{name} = %{version}
#
Summary: OpenDBX backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-opendbx
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the OpenDBX backend for pdns.
%endif
%if %{with pdns_lua}
%package backend-lua
Requires: %{name} = %{version}
#
Summary: Lua backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-lua
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the Lua backend for pdns.
%endif
%package backend-remote
Requires: %{name} = %{version}
#
Summary: Remote backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-remote
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the remote backend for pdns.
%if %{with pdns_geoip}
%package backend-geoip
Requires: %{name} = %{version}
#
Summary: GeoIP backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-geoip
The PowerDNS Nameserver is a modern, advanced and high performance
authoritative-only nameserver. It is written from scratch and conforms
to all relevant DNS standards documents. Furthermore, PowerDNS
interfaces with almost any database.
This package holds the GeoIP backend for pdns.
%endif
%prep
%setup -n %{name}-%{pkg_version}
%patch -p1
%patch2 -p1
%if %{with pdns_opendbx}
cp %{S:2} README.opendbx
%endif
%build
# touch NEWS AUTHORS COPYING
# autoreconf -fiv
# set $LD for now. this fixes the configure check for relro,now.
export LD="$(which ld)"
export CFLAGS="%{optflags} -DLDAP_DEPRECATED"
export CXXFLAGS="$CFLAGS"
# "mysql" backend is legacy crap. dont build it!
%configure \
--docdir=%{_datadir}/doc/packages/%{name}/ \
--disable-silent-rules \
--with-socketdir=%{_localstatedir} \
--localstatedir=%{_localstatedir} \
--with-pic \
--enable-libsodium \
--enable-reproducible \
%if %{with pdns_protobuf}
--with-protobuf \
%endif
%if %{with pdns_botan}
--enable-botan1.10 \
%endif
%if %{with pdns_experimental_gss_tsig}
--enable-experimental-gss-tsig \
%endif
--sysconfdir=%{_sysconfdir}/%{pkg_name} \
--libdir=%{_libdir} \
--with-pgsql-lib=%{_libdir} \
--with-mysql-lib=%{_libdir} \
%if %{with pdns_pkcs11}
--enable-experimental-pkcs11 \
%endif
%if %{with sanitizer}
--enable-asan \
--enable-msan \
--enable-tsan \
--enable-lsan \
--enable-ubsan \
%endif
--enable-malloc-trace \
%if %{with pdns_zeromq}
--enable-remotebackend-zeromq \
%endif
--with-modules="" \
%if %{with pdns_lua}
--with-lua \
%endif
--with-dynmodules="\
bind \
%if %{with pdns_geoip}
geoip \
%endif
gmysql \
%if %{with pdns_odbc}
godbc \
%endif
%if %{with pdns_oracle}
goracle \
%endif
gpgsql \
%if %{with pdns_sqlite3}
gsqlite3 \
%endif
ldap \
%if %{with pdns_lua}
lua \
%endif
%if %{with pdns_mydns}
mydns \
%endif
%if %{with pdns_opendbx}
opendbx \
%endif
%if %{with pdns_oracle}
oracle \
%endif
pipe \
random \
remote \
%if %{with pdns_tinydns}
tinydns \
%endif
"\
%if %{with pdns_tools}
--enable-tools \
%endif
--disable-static
make %{?_smp_mflags}
%install
make %{?_smp_mflags} install DESTDIR="%{buildroot}"
sed "s:# setgid=:setgid=pdns:g
s:# setuid=:setuid=pdns:g" \
%{buildroot}%{_sysconfdir}/%{pkg_name}/pdns.conf-dist > %{buildroot}%{_sysconfdir}/%{pkg_name}/pdns.conf &&
rm %{buildroot}%{_sysconfdir}/%{pkg_name}/pdns.conf-dist
%if %{with systemd}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{pkg_name}
%else
install -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{pkg_name}
ln -s -f ../..%{_sysconfdir}/init.d/%{pkg_name} %{buildroot}%{_sbindir}/rc%{pkg_name}
%endif
rm -rfv %{buildroot}%{_libdir}/pdns/*.la
#
install -m 0644 AUTHORS NEWS NOTICE COPYING README* %{buildroot}%{_datadir}/doc/packages/%{name}/
%pre
/usr/sbin/groupadd -r pdns >/dev/null 2>&1 || :
/usr/sbin/useradd -g pdns -s /bin/false -r -c "pdns" -d %{home} pdns >/dev/null 2>&1 || :
%if %{with systemd}
%service_add_pre %{name}.service
%endif
%post
%if %{with systemd}
%service_add_post %{name}.service
%else
%{fillup_and_insserv pdns}
%endif
%preun
%if %{with systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal pdns
%endif
%postun
%if %{with systemd}
%service_del_postun %{name}.service
%else
%restart_on_update pdns
%insserv_cleanup
%endif
%files
%defattr (-,root,root,-)
%dir %{_datadir}/doc/packages/%{name}/
%doc %{_datadir}/doc/packages/%{name}/AUTHORS
%doc %{_datadir}/doc/packages/%{name}/COPYING
%doc %{_datadir}/doc/packages/%{name}/NEWS
%doc %{_datadir}/doc/packages/%{name}/NOTICE
%doc %{_datadir}/doc/packages/%{name}/README*
%exclude %{_datadir}/doc/packages/%{name}/*.sql
%if %{with systemd}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}@.service
%else
%{_sysconfdir}/init.d/%{pkg_name}
%endif
%{_sbindir}/rcpdns
%config(noreplace) %attr(640,root,pdns) %{_sysconfdir}/%{pkg_name}/%{pkg_name}.conf
%{_bindir}/dnsbulktest
%{_bindir}/dnsreplay
%{_bindir}/dnsscan
%{_bindir}/dnsscope
%{_bindir}/dnstcpbench
%{_bindir}/dnswasher
%{_bindir}/nproxy
%{_bindir}/nsec3dig
%{_bindir}/saxfr
%{_bindir}/calidns
%{_bindir}/dnsgram
%{_bindir}/dumresp
%{_bindir}/ixplore
%{_bindir}/sdig
%{_bindir}/pdns_control
%{_bindir}/pdns_notify
%{_bindir}/pdnsutil
%{_bindir}/stubquery
%{_bindir}/zone2sql
%{_bindir}/zone2json
%{_sbindir}/pdns_server
%if %{with pdns_protobuf}
%{_bindir}/dnspcap2protobuf
%{_mandir}/man1/dnspcap2protobuf.1.gz
%endif
%{_mandir}/man1/dnsbulktest.1*
%{_mandir}/man1/dnsgram.1*
%{_mandir}/man1/dnsscan.1*
%{_mandir}/man1/ixplore.1*
%{_mandir}/man1/nsec3dig.1*
%{_mandir}/man1/saxfr.1*
%{_mandir}/man1/sdig.1*
%{_mandir}/man1/dnstcpbench.1*
%{_mandir}/man1/dnsreplay.1*
%{_mandir}/man1/dnsscope.1*
%{_mandir}/man1/dnswasher.1*
%{_mandir}/man1/pdns_control.1*
%{_mandir}/man1/pdns_notify.1*
%{_mandir}/man1/pdns_server.1*
%{_mandir}/man1/pdnsutil.1*
%{_mandir}/man1/zone2json.1*
%{_mandir}/man1/zone2sql.1*
%{_mandir}/man1/calidns.1*
%{_mandir}/man1/dumresp.1*
%{_mandir}/man1/nproxy.1*
%dir %{_libdir}/%{pkg_name}
%{_libdir}/%{pkg_name}/libpipebackend.so*
%{_libdir}/%{pkg_name}/libbindbackend.so*
%{_libdir}/%{pkg_name}/librandombackend.so*
%files backend-mysql
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libgmysqlbackend.so*
%doc %{_datadir}/doc/packages/%{name}/*.mysql.sql
%if %{with pdns_mydns}
%files backend-mydns
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libmydnsbackend.so*
%endif
%if %{with pdns_lua}
%files backend-lua
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libluabackend.so*
%endif
%files backend-postgresql
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libgpgsqlbackend.so*
%doc %{_datadir}/doc/packages/%{name}/*.pgsql.sql
%if %{with pdns_sqlite3}
%files backend-sqlite3
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libgsqlite3backend.so*
%doc %{_datadir}/doc/packages/%{name}/*.sqlite3.sql
%endif
%files backend-ldap
%defattr (-,root,root,-)
%{_bindir}/zone2ldap
%{_libdir}/%{pkg_name}/libldapbackend.so*
%{_mandir}/man1/zone2ldap.1*
%if %{with pdns_opendbx}
%files backend-opendbx
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libopendbxbackend.so*
%endif
%if %{with pdns_odbc}
%files backend-godbc
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libgodbcbackend.so*
%endif
%if %{with pdns_geoip}
%files backend-geoip
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libgeoipbackend.so*
%endif
%files backend-remote
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libremotebackend.so
%changelog