]>
Commit | Line | Data |
---|---|---|
9d52f503 | 1 | Name: pdns-recursor |
8ceb365e PL |
2 | Version: %{getenv:BUILDER_RPM_VERSION} |
3 | Release: %{getenv:BUILDER_RPM_RELEASE}%{?dist} | |
9d52f503 PL |
4 | Summary: Modern, advanced and high performance recursing/non authoritative name server |
5 | Group: System Environment/Daemons | |
6 | License: GPLv2 | |
7 | URL: https://powerdns.com | |
8ceb365e | 8 | Source0: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2 |
9d52f503 PL |
9 | %if 0%{?rhel} == 6 |
10 | Source1: pdns-recursor.init | |
11 | %endif | |
12 | ||
13 | Provides: powerdns-recursor = %{version}-%{release} | |
14 | %if 0%{?rhel} == 6 | |
15 | BuildRequires: boost148-devel | |
16 | BuildRequires: lua-devel | |
17 | %else | |
18 | BuildRequires: boost-devel | |
88301a04 | 19 | BuildRequires: libcap-devel |
23e7e4b3 PD |
20 | %ifarch aarch64 |
21 | BuildRequires: lua-devel | |
7838d044 | 22 | %define lua_implementation lua |
23e7e4b3 | 23 | %else |
9d52f503 | 24 | BuildRequires: luajit-devel |
7838d044 | 25 | %define lua_implementation luajit |
23e7e4b3 | 26 | %endif |
9d52f503 PL |
27 | BuildRequires: systemd |
28 | BuildRequires: systemd-devel | |
29 | %endif | |
30 | ||
9d52f503 PL |
31 | %ifarch ppc64 ppc64le |
32 | BuildRequires: libatomic | |
33 | %endif | |
34 | ||
f3e49553 | 35 | %if 0%{?rhel} >= 7 |
e593a398 | 36 | BuildRequires: fstrm-devel |
f3e49553 PD |
37 | %endif |
38 | ||
39 | BuildRequires: openssl-devel | |
40 | BuildRequires: net-snmp-devel | |
9d52f503 PL |
41 | BuildRequires: libsodium-devel |
42 | ||
43 | Requires(pre): shadow-utils | |
44 | %if 0%{?rhel} == 6 | |
45 | Requires(post): /sbin/chkconfig | |
46 | Requires(preun): /sbin/service, /sbin/chkconfig | |
47 | Requires(postun): /sbin/service | |
48 | %else | |
49 | %systemd_requires | |
50 | %endif | |
51 | ||
52 | %description | |
53 | PowerDNS Recursor is a non authoritative/recursing DNS server. Use this | |
54 | package if you need a dns cache for your network. | |
55 | ||
56 | ||
57 | %prep | |
58 | %if 0%{?rhel} == 6 | |
8ceb365e | 59 | %setup -n %{name}-%{getenv:BUILDER_VERSION} |
9d52f503 | 60 | %else |
8ceb365e | 61 | %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION} |
9d52f503 PL |
62 | %endif |
63 | ||
64 | %build | |
65 | %configure \ | |
e5d38a0f | 66 | --enable-option-checking=fatal \ |
9d52f503 | 67 | --sysconfdir=%{_sysconfdir}/%{name} \ |
cb264691 | 68 | --with-libsodium \ |
bdbd3e3c | 69 | --with-net-snmp \ |
9d52f503 PL |
70 | --disable-silent-rules \ |
71 | --disable-static \ | |
72 | --enable-unit-tests \ | |
73 | %if 0%{?rhel} == 6 | |
7c2ed3ce PD |
74 | --with-boost=/usr/include/boost148 LIBRARY_PATH=/usr/lib64/boost148 \ |
75 | CPPFLAGS=-D__STDC_FORMAT_MACROS | |
9d52f503 PL |
76 | |
77 | make %{?_smp_mflags} LIBRARY_PATH=/usr/lib64/boost148 | |
23e7e4b3 | 78 | %else |
d9707e17 | 79 | --enable-dnstap \ |
88301a04 | 80 | --with-libcap \ |
7838d044 | 81 | --with-lua=%{lua_implementation} \ |
9d52f503 PL |
82 | --enable-systemd --with-systemd=%{_unitdir} |
83 | ||
84 | make %{?_smp_mflags} | |
85 | %endif | |
86 | ||
87 | %check | |
88 | make %{?_smp_mflags} check || (cat test-suite.log && false) | |
89 | ||
90 | %install | |
91 | make install DESTDIR=%{buildroot} | |
92 | ||
93 | %{__mv} %{buildroot}%{_sysconfdir}/%{name}/recursor.conf{-dist,} | |
94 | ||
95 | %if 0%{?rhel} == 6 | |
96 | %{__install} -D -p %{SOURCE1} %{buildroot}%{_initrddir}/pdns-recursor | |
97 | %endif | |
98 | ||
99 | # change user and group to pdns-recursor | |
100 | sed -i \ | |
101 | -e 's/# setuid=/setuid=pdns-recursor/' \ | |
102 | -e 's/# setgid=/setgid=pdns-recursor/' \ | |
103 | %{buildroot}%{_sysconfdir}/%{name}/recursor.conf | |
104 | ||
105 | %pre | |
106 | getent group pdns-recursor > /dev/null || groupadd -r pdns-recursor | |
107 | getent passwd pdns-recursor > /dev/null || \ | |
108 | useradd -r -g pdns-recursor -d / -s /sbin/nologin \ | |
109 | -c "PowerDNS Recursor user" pdns-recursor | |
110 | exit 0 | |
111 | ||
112 | %post | |
113 | %if 0%{?rhel} == 6 | |
114 | chkconfig --add %{name} | |
115 | %else | |
b5179dca | 116 | systemctl daemon-reload ||: |
9d52f503 PL |
117 | %systemd_post %{name}.service |
118 | %endif | |
119 | ||
120 | %preun | |
121 | %if 0%{?rhel} == 6 | |
122 | if [ $1 -eq 0 ]; then | |
123 | service %{name} stop >/dev/null 2>&1 || : | |
124 | chkconfig --del %{name} | |
125 | fi | |
126 | %else | |
127 | %systemd_preun %{name}.service | |
128 | %endif | |
129 | ||
130 | %if 0%{?rhel} == 6 | |
131 | %postun | |
132 | if [ $1 -ge 1 ]; then | |
133 | service %{name} condrestart >/dev/null 2>&1 || : | |
134 | fi | |
135 | %else | |
136 | %postun | |
137 | %systemd_postun_with_restart pdns-recursor.service | |
138 | %endif | |
139 | ||
140 | %files | |
141 | %{_bindir}/rec_control | |
142 | %{_sbindir}/pdns_recursor | |
143 | %{_mandir}/man1/pdns_recursor.1.gz | |
144 | %{_mandir}/man1/rec_control.1.gz | |
145 | %if 0%{?rhel} == 6 | |
146 | %{_initrddir}/pdns-recursor | |
147 | %else | |
148 | %{_unitdir}/pdns-recursor.service | |
149 | %{_unitdir}/pdns-recursor@.service | |
150 | %endif | |
151 | %dir %{_sysconfdir}/%{name} | |
152 | %config(noreplace) %{_sysconfdir}/%{name}/recursor.conf | |
153 | %doc README |