File pdns.spec of Package pdns
#
# spec file for package pdns
#
# Copyright (c) 2015 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: 3.4.6
Release: 0
#
%define pkg_name pdns
%define pkg_version 3.4.6
%define polarssl_version 1.3.2
#
%define home %{_var}/lib/pdns
%if 0%{?suse_version} > 1220
%bcond_without systemd
%define _localstatedir /run/pdns
%else
%bcond_with systemd
%define _localstatedir %{_var}/run/pdns
%endif
%{!?_tmpfilesdir: %global _tmpfilesdir /usr/lib/tmpfiles.d }
#
%bcond_without pdns_lua
%bcond_with pdns_mongo
%bcond_without pdns_mydns
%bcond_without pdns_sqlite3
%bcond_with pdns_tinydns
%if 0%{?suse_version} >= 1320
%bcond_without pdns_lmdb
%bcond_with pdns_intree_polarssl
%else
%bcond_with pdns_lmdb
%bcond_without pdns_intree_polarssl
%endif
%if 0%{?suse_version} > 1230 && 0%{?suse_version} != 1315
%bcond_without pdns_geoip
%else
%bcond_with pdns_geoip
%endif
%if 0%{?suse_version} > 1200 && 0%{?suse_version} != 1315
%bcond_without pdns_botan
%else
%bcond_with pdns_botan
%endif
%if 0%{?suse_version} > 1110
%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
BuildRequires: boost-devel
BuildRequires: curl-devel
BuildRequires: flex
%if %{with pdns_geoip}
BuildRequires: GeoIP-devel
BuildRequires: yaml-cpp-devel
%endif
BuildRequires: gcc-c++
BuildRequires: gdbm-devel
BuildRequires: libtool
%if %{with pdns_lua}
BuildRequires: lua-devel
%endif
%if %{with pdns_lmdb}
BuildRequires: lmdb-devel
%endif
%if %{with pdns_tinydns}
# FIXME: Could not find libcdb/tinycdb
%endif
%if %{with pdns_mongo}
# FIXME: needs mongo devel package
%endif
BuildRequires: mysql-devel
BuildRequires: openldap2-devel
BuildRequires: pkg-config
BuildRequires: postgresql-devel
#BuildRequires: ragel
BuildRequires: sqlite-devel >= 3
%if %{with pdns_sqlite3}
BuildRequires: sqlite-devel >= 3
%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_intree_polarssl}
BuildRequires: polarssl-devel >= 1.1
%endif
%if %{with pdns_xdb}
BuildRequires: tdb-devel
%endif
%if %{with pdns_zeromq}
BuildRequires: zeromq-devel
%endif
%if %{with systemd}
BuildRequires: systemd
%{?systemd_requires}
%else
PreReq: %fillup_prereq
PreReq: %insserv_prereq
%endif
PreReq: pwdutils
#
Url: http://www.powerdns.com/
Source: http://downloads.powerdns.com/releases/pdns-%{pkg_version}.tar.bz2
Source1: rcpdns
Source2: README.opendbx
Source3: %{name}.service
Source4: pdns.tmpfiles
Source5: series
# PATCH-MISSING-TAG -- See http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch: pdns-3.4.0-no_date_time.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_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
%if %{with pdns_xdb}
%package backend-xdb
Requires: %{name} = %{version}
#
Summary: Samba TDB backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-xdb
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 Samba TDB backend for pdns.
%endif
%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
%if %{with pdns_lmdb}
%package backend-lmdb
Requires: %{name} = %{version}
#
Summary: LMDB backend for pdns
Group: Productivity/Networking/DNS/Servers
%description backend-lmdb
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 LMDB backend for pdns.
%endif
%if %{with pdns_recursor}
%package -n pdns-recursor
Requires: %{name} = %{version}
#
Summary: Modern, advanced and high performance recursing/non authoritative nameserver
Group: Productivity/Networking/DNS/Servers
%description -n pdns-recursor
PowerDNS Recursor is a non authoritative/recursing DNS server. Use this
package if you need a dns cache for your network.
%endif
%prep
%setup -n %{name}-%{pkg_version}
%patch -p1
%if %{with pdns_opendbx}
cp %{S:2} README.opendbx
%endif
cp modules/geobackend/README README.geobackend
# module-dir=/usr/local/lib
perl -p -i.back -e 's|module-dir=.*|module-dir=%{_libdir}/%{pkg_name}|g' pdns/pdns.conf-dist
diff -urN pdns/pdns.conf-dist{.back,} ||:
rm -v pdns/pdns.conf-dist.back
%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 \
%if %{with pdns_botan}
--enable-botan1.10 \
%endif
%if %{with pdns_intree_polarssl}
--without-system-polarssl \
%else
--with-system-polarssl \
%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 pdns_zeromq}
--enable-remotebackend-zeromq \
%endif
--with-modules="" \
%if %{with pdns_lua}
--with-lua \
%endif
--with-dynmodules="\
pipe \
bind \
random \
geo \
gmysql \
gpgsql \
ldap \
%if %{with pdns_geoip}
geoip \
%endif
%if %{with pdns_lmdb}
lmdb \
%endif
%if %{with pdns_lua}
lua \
%endif
%if %{with pdns_mongo}
mongodb \
%endif
%if %{with pdns_mydns}
mydns \
%endif
%if %{with pdns_tinydns}
tinydns \
%endif
%if %{with pdns_sqlite3}
gsqlite3 \
%endif
%if %{with pdns_opendbx}
opendbx \
%endif
%if %{with pdns_xdb}
xdb \
%endif
%if %{with pdns_db2}
db2 \
%endif
%if %{with pdns_odbc}
odbc \
%endif
%if %{with pdns_oracle}
goracle \
oracle \
%endif
"\
%if %{with pdns_tools}
--enable-tools \
%endif
--disable-static
make
%install
make install DESTDIR="%{buildroot}"
install -Dd -m 0755 %{buildroot}{%{home},%{_var}}
mv %{buildroot}%{_sysconfdir}/%{pkg_name}/pdns.conf{-dist,}
mkdir -p %{buildroot}%{_localstatedir}
%if %{with systemd}
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{pkg_name}.service
install -D -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/pdns.conf
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}/
# no longer ship dnsdist here -> separate upstream source and package now
#rm -v %{buildroot}%{_bindir}/dnsdist %{buildroot}%{_mandir}/man1/dnsdist.1*
%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}
%{?tmpfiles_create:%{tmpfiles_create}}
%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
%{_tmpfilesdir}/pdns.conf
%else
%{_sysconfdir}/init.d/%{pkg_name}
%endif
%{_sbindir}/rcpdns
%dir %attr(750,root,pdns) %{_sysconfdir}/%{pkg_name}
%attr(700,pdns,pdns) %dir %ghost %{_localstatedir}
%config(noreplace) %attr(640,root,pdns) %{_sysconfdir}/%{pkg_name}/%{pkg_name}.conf
%if %{with pdns_tools}
%{_bindir}/dnsbulktest
%{_bindir}/dnsreplay
%{_bindir}/dnsscan
%{_bindir}/dnsscope
%{_bindir}/dnstcpbench
%{_bindir}/dnswasher
%{_bindir}/nproxy
%{_bindir}/nsec3dig
%{_bindir}/saxfr
%{_mandir}/man1/dnstcpbench.1*
%{_mandir}/man1/dnsreplay.1*
%{_mandir}/man1/dnsscope.1*
%{_mandir}/man1/dnswasher.1*
%endif
%{_sbindir}/pdns_server
%{_bindir}/pdns_control
%{_bindir}/pdnssec
%{_bindir}/zone2sql
%{_bindir}/zone2json
%{_mandir}/man1/pdns_control.1*
%{_mandir}/man1/pdns_server.1*
%{_mandir}/man1/pdnssec.1*
%{_mandir}/man1/zone2sql.1*
%dir %{_libdir}/%{pkg_name}
%{_libdir}/%{pkg_name}/libpipebackend.so*
%{_libdir}/%{pkg_name}/libbindbackend.so*
%{_libdir}/%{pkg_name}/librandombackend.so*
%{_libdir}/%{pkg_name}/libgeobackend.so*
%dir %attr(750,pdns,pdns) %{home}
%if %{with pdns_recursor}
%files -n pdns-recursor
%defattr (-,root,root,-)
%{_sbindir}/pdns_recursor
%endif
%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_xdb}
%files backend-xdb
%defattr (-,root,root,-)
%{_bindir}/xdb-fill
%{_libdir}/%{pkg_name}/libxdbbackend.so*
%endif
%if %{with pdns_lmdb}
%files backend-lmdb
%defattr (-,root,root,-)
%{_bindir}/zone2lmdb
%{_libdir}/%{pkg_name}/liblmdbbackend.so*
%endif
%if %{with pdns_geoip}
%files backend-geoip
%defattr (-,root,root,-)
%{_libdir}/%{pkg_name}/libgeoipbackend.so*
%endif
%changelog