]> git.ipfire.org Git - thirdparty/pdns.git/blob - builder-support/specs/dnsdist.spec
configure: with-libsodium
[thirdparty/pdns.git] / builder-support / specs / dnsdist.spec
1 Name: dnsdist
2 Version: %{getenv:BUILDER_RPM_VERSION}
3 Release: %{getenv:BUILDER_RPM_RELEASE}%{dist}
4 Summary: Powerful and scriptable DNS loadbalancer
5 License: GPLv2
6 Vendor: PowerDNS.COM BV
7 Group: System/DNS
8 Source: %{name}-%{getenv:BUILDER_VERSION}.tar.bz2
9 BuildRequires: readline-devel
10 BuildRequires: libedit-devel
11 BuildRequires: openssl-devel
12
13 %if 0%{?el6}
14 BuildRequires: boost148-devel
15 BuildRequires: lua-devel
16 BuildRequires: protobuf-compiler
17 BuildRequires: protobuf-devel
18 BuildRequires: re2-devel
19 %endif
20 %if 0%{?suse_version}
21 BuildRequires: boost-devel
22 BuildRequires: lua-devel
23 BuildRequires: systemd-units
24 BuildRequires: systemd-devel
25 %endif
26 %if 0%{?rhel} >= 7
27 BuildRequires: boost-devel
28 BuildRequires: gnutls-devel
29 BuildRequires: libsodium-devel
30 %ifarch aarch64
31 BuildRequires: lua-devel
32 %define lua_implementation lua
33 %else
34 BuildRequires: luajit-devel
35 %define lua_implementation luajit
36 %endif
37 BuildRequires: net-snmp-devel
38 BuildRequires: protobuf-compiler
39 BuildRequires: protobuf-devel
40 BuildRequires: re2-devel
41 BuildRequires: systemd-devel
42 BuildRequires: systemd-units
43 %endif
44
45 %if 0%{?el6}
46 Requires(pre): shadow-utils
47 %endif
48 %if 0%{?suse_version}
49 Requires(pre): shadow
50 %systemd_requires
51 %endif
52 %if 0%{?rhel} >= 7
53 Requires(pre): shadow-utils
54 BuildRequires: fstrm-devel
55 %systemd_requires
56 %endif
57
58 %description
59 dnsdist is a high-performance DNS loadbalancer that is scriptable in Lua.
60
61 %prep
62 %if 0%{?rhel} == 6
63 %setup -n %{name}-%{getenv:BUILDER_VERSION}
64 %else
65 %autosetup -p1 -n %{name}-%{getenv:BUILDER_VERSION}
66 %endif
67
68 # run as dnsdist user
69 sed -i '/^ExecStart/ s/dnsdist/dnsdist -u dnsdist -g dnsdist/' dnsdist.service.in
70
71 %build
72 %configure \
73 --sysconfdir=/etc/dnsdist \
74 --disable-static \
75 --disable-dependency-tracking \
76 --disable-silent-rules \
77 --enable-unit-tests \
78 --enable-dns-over-tls \
79 %if 0%{?el6}
80 --disable-dnscrypt \
81 --without-libsodium \
82 --enable-re2 \
83 --with-net-snmp \
84 --with-protobuf \
85 --with-boost=/usr/include/boost148 LIBRARY_PATH=/usr/lib64/boost148
86 %endif
87 %if 0%{?suse_version}
88 --disable-dnscrypt \
89 --without-libsodium \
90 --disable-re2 \
91 --enable-systemd --with-systemd=/lib/systemd/system \
92 --without-protobuf \
93 --without-net-snmp
94 %endif
95 %if 0%{?rhel} >= 7
96 --enable-fstrm \
97 --with-gnutls \
98 --with-protobuf \
99 --with-lua=%{lua_implementation} \
100 --with-libsodium \
101 --enable-dnscrypt \
102 --enable-systemd --with-systemd=/lib/systemd/system \
103 --enable-re2 \
104 --with-net-snmp
105 %endif
106
107 %if 0%{?el6}
108 make %{?_smp_mflags} LIBRARY_PATH=/usr/lib64/boost148
109 %else
110 make %{?_smp_mflags}
111 %endif
112 mv dnsdistconf.lua dnsdist.conf.sample
113
114 %check
115 make %{?_smp_mflags} check || (cat test-suite.log && false)
116
117 %install
118 %make_install
119 install -d %{buildroot}/%{_sysconfdir}/dnsdist
120 %if 0%{?el6}
121 install -d -m 755 %{buildroot}/%{_sysconfdir}/init && install -m 644 contrib/dnsdist.upstart.conf %{buildroot}/%{_sysconfdir}/init/%{name}.conf
122 install -d -m 755 %{buildroot}/%{_sysconfdir}/default && install -m 644 contrib/dnsdist.default %{buildroot}/%{_sysconfdir}/default/%{name}
123 %else
124 # EL7 and SUSE
125 sed -i "s,/^\(ExecStart.*\)dnsdist\(.*\)\$,\1dnsdist -u dnsdist -g dnsdist\2," %{buildroot}/lib/systemd/system/dnsdist.service
126 sed -i "s,/^\(ExecStart.*\)dnsdist\(.*\)\$,\1dnsdist -u dnsdist -g dnsdist\2," %{buildroot}/lib/systemd/system/dnsdist@.service
127 %endif
128
129 %pre
130 getent group dnsdist >/dev/null || groupadd -r dnsdist
131 getent passwd dnsdist >/dev/null || \
132 useradd -r -g dnsdist -d / -s /sbin/nologin \
133 -c "dnsdist user" dnsdist
134 exit 0
135
136 %post
137 %if 0%{?el6}
138 if [ -x /sbin/initctl ]; then
139 /sbin/initctl reload-configuration
140 fi
141 %endif
142 %if 0%{?suse_version}
143 %service_add_post %{name}.service
144 %endif
145 %if 0%{?rhel} >= 7
146 %systemd_post %{name}.service
147 %endif
148
149 %preun
150 %if 0%{?el6}
151 if [ $1 -eq 0 ] ; then
152 # This is package removal, not upgrade
153 /sbin/stop %{name} >/dev/null 2>&1 || :
154 fi
155 %endif
156 %if 0%{?suse_version}
157 %service_del_preun %{name}.service
158 %endif
159 %if 0%{?rhel} >= 7
160 %systemd_preun %{name}.service
161 %endif
162
163 %postun
164 %if 0%{?el6}
165 if [ $1 -ge 1 ] ; then
166 # Package upgrade, not uninstall
167 if [ -x /sbin/initctl ] && /sbin/initctl status %{name} 2>/dev/null | grep -q 'running' ; then
168 /sbin/initctl restart %{name} > /dev/null 2>&1 || :
169 fi
170 fi
171 %endif
172 %if 0%{?suse_version}
173 %service_del_postun %{name}.service
174 %endif
175 %if 0%{?rhel} >= 7
176 %systemd_postun_with_restart %{name}.service
177 %endif
178
179 %files
180 %{!?_licensedir:%global license %%doc}
181 %doc dnsdist.conf.sample
182 %doc README.md
183 %{_bindir}/*
184 %{_mandir}/man1/*
185 %dir %{_sysconfdir}/dnsdist
186 %if 0%{?el6}
187 %{_sysconfdir}/init/%{name}.conf
188 %{_sysconfdir}/default/%{name}
189 %else
190 /lib/systemd/system/dnsdist*
191 %endif