knot.spec 6.77 KB
Newer Older
1
%global _hardened_build 1
2
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
3 4 5

%define GPG_CHECK 0
%define VERSION __VERSION__
6
%define repodir %{_builddir}/%{name}-%{version}
7

8 9 10 11 12
Summary:	High-performance authoritative DNS server
Name:		knot
Version:	%{VERSION}
Release:	1%{?dist}
License:	GPLv3
13
URL:		https://www.knot-dns.cz
14 15
Source0:	%{name}_%{version}.orig.tar.xz

16
%if 0%{GPG_CHECK}
17
Source1:	https://secure.nic.cz/files/knot-dns/%{name}-%{version}.tar.xz.asc
18 19 20
# PGP keys used to sign upstream releases
# Export with --armor using command from https://fedoraproject.org/wiki/PackagingDrafts:GPGSignatures
# Don't forget to update %%prep section when adding/removing keys
21 22
Source100:	gpgkey-742FA4E95829B6C5EAC6B85710BB7AF6FEBBD6AB.gpg.asc
BuildRequires:	gnupg2
23 24 25
%endif

# Required dependencies
26
BuildRequires:	gcc
27 28 29
BuildRequires:	pkgconfig(liburcu)
BuildRequires:	pkgconfig(gnutls) >= 3.3
BuildRequires:	pkgconfig(libedit)
30

31
# Optional dependencies
32 33
BuildRequires:	pkgconfig(libcap-ng)
BuildRequires:	pkgconfig(libfstrm)
34 35
BuildRequires:	pkgconfig(libidn2)
BuildRequires:	pkgconfig(libmaxminddb)
36
BuildRequires:	pkgconfig(libprotobuf-c)
37
BuildRequires:	pkgconfig(libsystemd)
38
BuildRequires:	pkgconfig(systemd)
39

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
# Distro-dependent dependencies
%if 0%{?suse_version}
BuildRequires:	python3-Sphinx
BuildRequires:	lmdb-devel
BuildRequires:	protobuf-c
Requires(pre):  pwdutils
%endif
%if 0%{?rhel}
BuildRequires:	python-sphinx
BuildRequires:	lmdb-devel
%endif
%if 0%{?fedora}
BuildRequires:	python3-sphinx
BuildRequires:	pkgconfig(lmdb)
%endif
55

56
Requires(post):		systemd %{_sbindir}/runuser
57 58
Requires(preun):	systemd
Requires(postun):	systemd
59

60 61 62
# Knot DNS 2.7+ isn't compatible with earlier knot-resolver
Conflicts:	knot-resolver < 3.0.0

63
Requires:	%{name}-libs%{?_isa} = %{version}-%{release}
64 65 66 67 68

%description
Knot DNS is a high-performance authoritative DNS server implementation.

%package libs
69
Summary:	Libraries used by the Knot DNS server and client applications
70 71 72 73 74 75

%description libs
The package contains shared libraries used by the Knot DNS server and
utilities.

%package devel
76 77
Summary:	Development header files for the Knot DNS libraries
Requires:	%{name}-libs%{?_isa} = %{version}-%{release}
78 79 80 81 82 83

%description devel
The package contains development header files for the Knot DNS libraries
included in knot-libs package.

%package utils
84 85
Summary:	DNS client utilities shipped with the Knot DNS server
Requires:	%{name}-libs%{?_isa} = %{version}-%{release}
86 87 88 89 90

%description utils
The package contains DNS client utilities shipped with the Knot DNS server.

%package doc
91 92 93 94
Summary:	Documentation for the Knot DNS server
License:	GPLv3 and BSD and MIT
BuildArch:	noarch
Provides:	bundled(jquery) = 3.1.0
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115

%description doc
The package contains documentation for the Knot DNS server.
On-line version is available on https://www.knot-dns.cz/documentation/

%prep
%if 0%{GPG_CHECK}
export GNUPGHOME=./gpg-keyring
mkdir ${GNUPGHOME}
gpg2 --import %{SOURCE100}
gpg2 --verify %{SOURCE1} %{SOURCE0}
%endif
%setup -q

%build
# disable debug code (causes unused warnings)
CFLAGS="%{optflags} -DNDEBUG -Wno-unused"

%ifarch armv7hl i686
# 32-bit architectures sometimes do not have sufficient amount of
# contiguous address space to handle default values
116
%define configure_db_sizes --with-conf-mapsize=64
117 118
%endif

119 120 121 122 123 124 125 126 127 128
%configure \
  --sysconfdir=/etc \
  --localstatedir=/var/lib \
  --libexecdir=/usr/lib/knot \
  --with-rundir=/run/knot \
  --with-storage=/var/lib/knot \
  %{?configure_db_sizes} \
  --disable-static \
  --enable-dnstap=yes \
  --with-module-dnstap=yes
129 130 131 132 133 134 135
make %{?_smp_mflags}
make html

%install
make install DESTDIR=%{buildroot}

# install documentation
136
install -d -m 0755 %{buildroot}%{_pkgdocdir}/samples
137
install -p -m 0644 -t %{buildroot}%{_pkgdocdir}/samples samples/*.zone*
138
install -p -m 0644 NEWS README %{buildroot}%{_pkgdocdir}
139 140 141 142
cp -av doc/_build/html %{buildroot}%{_pkgdocdir}
[ -r %{buildroot}%{_pkgdocdir}/html/index.html ] || exit 1
rm -f %{buildroot}%{_pkgdocdir}/html/.buildinfo

143
# install configuration file
144
rm %{buildroot}%{_sysconfdir}/%{name}/*
145
install -p -m 0644 -D %{repodir}/samples/%{name}.sample.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
146

147
# install systemd files
148 149
install -p -m 0644 -D %{repodir}/distro/common/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -p -m 0644 -D %{repodir}/distro/common/%{name}.tmpfiles %{buildroot}%{_tmpfilesdir}/%{name}.conf
150 151

# create storage dir and key dir
152 153 154
install -d %{buildroot}%{_sharedstatedir}
install -d -m 0775 -D %{buildroot}%{_sharedstatedir}/%{name}
install -d -m 0770 -D %{buildroot}%{_sharedstatedir}/%{name}/keys
155

156 157
# remove libarchive files
find %{buildroot} -type f -name "*.la" -delete -print
158 159 160 161 162 163

%check
make check

%pre
getent group knot >/dev/null || groupadd -r knot
164 165 166 167 168 169
getent passwd knot >/dev/null || \
  useradd -r -g knot -d %{_sysconfdir}/knot -s /sbin/nologin \
  -c "Knot DNS server" knot
%if 0%{?suse_version}
%service_add_pre knot.service
%endif
170 171

%post
172 173 174 175
systemd-tmpfiles --create %{_tmpfilesdir}/knot.conf &>/dev/null || :
%if 0%{?suse_version}
%service_add_post knot.service
%else
176
%systemd_post knot.service
177
%endif
178 179

%preun
180 181 182
%if 0%{?suse_version}
%service_del_preun knot.service
%else
183
%systemd_preun knot.service
184
%endif
185 186

%postun
187 188 189
%if 0%{?suse_version}
%service_del_postun knot.service
%else
190
%systemd_postun_with_restart knot.service
191
%endif
192

193 194 195
%if 0%{?fedora}
# https://fedoraproject.org/wiki/Changes/Removing_ldconfig_scriptlets
%else
196 197
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
198
%endif
199 200

%files
201 202 203
%license COPYING
%{_pkgdocdir}/NEWS
%{_pkgdocdir}/README
204 205 206 207 208
%{_pkgdocdir}/samples
%dir %attr(750,root,knot) %{_sysconfdir}/%{name}
%config(noreplace) %attr(640,root,knot) %{_sysconfdir}/%{name}/%{name}.conf
%dir %attr(775,root,knot) %{_sharedstatedir}/%{name}
%dir %attr(770,root,knot) %{_sharedstatedir}/%{name}/keys
209
%{_unitdir}/knot.service
210 211
%{_tmpfilesdir}/%{name}.conf
%{_bindir}/kzonecheck
212
%{_sbindir}/kjournalprint
213 214 215 216 217
%{_sbindir}/keymgr
%{_sbindir}/knotc
%{_sbindir}/knotd
%{_mandir}/man1/kzonecheck.*
%{_mandir}/man5/knot.conf.*
218
%{_mandir}/man8/kjournalprint.*
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
%{_mandir}/man8/keymgr.*
%{_mandir}/man8/knotc.*
%{_mandir}/man8/knotd.*

%files utils
%{_bindir}/kdig
%{_bindir}/khost
%{_bindir}/knsec3hash
%{_bindir}/knsupdate
%{_mandir}/man1/kdig.*
%{_mandir}/man1/khost.*
%{_mandir}/man1/knsec3hash.*
%{_mandir}/man1/knsupdate.*

%files libs
234 235 236
%license COPYING
%doc NEWS
%doc README
237 238 239 240 241
%{_libdir}/libdnssec.so.*
%{_libdir}/libknot.so.*
%{_libdir}/libzscanner.so.*

%files devel
242
%{_includedir}/libdnssec
243 244
%{_includedir}/knot
%{_includedir}/libknot
245
%{_includedir}/libzscanner
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
%{_libdir}/libdnssec.so
%{_libdir}/libknot.so
%{_libdir}/libzscanner.so
%{_libdir}/pkgconfig/knotd.pc
%{_libdir}/pkgconfig/libdnssec.pc
%{_libdir}/pkgconfig/libknot.pc
%{_libdir}/pkgconfig/libzscanner.pc

%files doc
%dir %{_pkgdocdir}
%{_pkgdocdir}/html

%changelog
* Wed Feb 21 2018 Tomas Krizek <tomas.krizek@nic.cz> - 2.6.5-1
- move spec upstream
- see NEWS or https://knot-dns.cz