]> git.pld-linux.org Git - packages/syslog-ng.git/blob - syslog-ng.spec
- use system libmongo-client
[packages/syslog-ng.git] / syslog-ng.spec
1 #
2 # TODO:
3 #       - move SQL module to a separate package
4 #       - relies on libs in /usr/ which is wrong
5 #       - use external libivykis [>= 0.18+syslog-ng updates], libmongo_client [>= 0.1.0]
6 #
7 # Conditional build:
8 %bcond_with     dynamic         # link dynamically with glib, eventlog, pcre, openssl
9 %if "%{pld_release}" == "ac"
10 %bcond_with     sql             # build with support for logging to SQL DB
11 %else
12 %bcond_without  sql             # build without support for logging to SQL DB
13 %endif
14 %bcond_without  tests
15
16 %if "%{pld_release}" == "ac"
17 %define         glib2_ver       2.16.0
18 %else
19 %define         glib2_ver       2.24.0
20 %endif
21 Summary:        Syslog-ng - new generation of the system logger
22 Summary(pl.UTF-8):      Syslog-ng - zamiennik syskloga
23 Summary(pt_BR.UTF-8):   Daemon de log nova geração
24 Name:           syslog-ng
25 Version:        3.3.1
26 Release:        2
27 License:        GPL v2
28 Group:          Daemons
29 Source0:        http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/%{version}/source/%{name}_%{version}.tar.gz
30 # Source0-md5:  a3dfe8a49aa8ce1aeb7e1ed5b11af378
31 Source1:        %{name}.init
32 Source2:        %{name}.conf
33 Source3:        %{name}.logrotate
34 Source4:        http://www.balabit.com/support/documentation/syslog-ng-ose-v3.3-guide-admin-en.pdf
35 # Source4-md5:  bb23e36a8f44956858f2d622f9d1826d
36 Source5:        %{name}-simple.conf
37 Source6:        %{name}.upstart
38 Patch0:         %{name}-datadir.patch
39 Patch1:         cap_syslog-vserver-workaround.patch
40 URL:            http://www.balabit.com/products/syslog_ng/
41 BuildRequires:  autoconf >= 2.53
42 BuildRequires:  automake
43 BuildRequires:  bison >= 2.4
44 BuildRequires:  flex
45 BuildRequires:  libtool >= 2:2.0
46 BuildRequires:  pkgconfig
47 BuildRequires:  rpm >= 4.4.9-56
48 BuildRequires:  rpmbuild(macros) >= 1.561
49 BuildRequires:  which
50 %if %{with tests}
51 %{?with_sql:BuildRequires:      libdbi-drivers-sqlite3}
52 BuildRequires:  python
53 BuildRequires:  python-modules
54 BuildRequires:  tzdata
55 %endif
56 %if %{with dynamic}
57 BuildRequires:  eventlog-devel >= 0.2.12
58 BuildRequires:  glib2-devel >= 1:%{glib2_ver}
59 BuildRequires:  json-c-devel >= 0.7
60 BuildRequires:  libcap-devel
61 %{?with_sql:BuildRequires:      libdbi-devel >= 0.8.3-2}
62 BuildRequires:  libmongo-client-devel >= 0.1.0
63 BuildRequires:  libnet-devel >= 1:1.1.2.1-3
64 BuildRequires:  libwrap-devel
65 BuildRequires:  openssl-devel >= 0.9.8
66 BuildRequires:  pcre-devel >= 6.1
67 %else
68 BuildRequires:  eventlog-static >= 0.2.12
69 BuildRequires:  glib2-static >= 1:%{glib2_ver}
70 BuildRequires:  glibc-static
71 BuildRequires:  json-c-static >= 0.7
72 BuildRequires:  libcap-static
73 %{?with_sql:BuildRequires:      libdbi-static >= 0.8.3-2}
74 BuildRequires:  libmongo-client-static >= 0.1.0
75 BuildRequires:  libnet-static >= 1:1.1.2.1-3
76 BuildRequires:  libwrap-static
77 BuildRequires:  openssl-static >= 0.9.8
78 BuildRequires:  pcre-static >= 6.1
79 BuildRequires:  zlib-static
80 %endif
81 Requires(post): fileutils
82 Requires(post,preun):   /sbin/chkconfig
83 Requires:       glib2 >= 1:%{glib2_ver}
84 Requires:       psmisc >= 20.1
85 Requires:       rc-scripts >= 0.4.3.0
86 %if %{with dynamic}
87 Requires:       eventlog >= 0.2.12
88 Requires:       json-c >= 0.7
89 Requires:       libdbi >= 0.8.3-2
90 Requires:       libmongo-client >= 0.1.0
91 Requires:       libnet >= 1:1.1.2.1-7
92 Requires:       openssl >= 0.9.8
93 Requires:       pcre >= 6.1
94 %endif
95 Provides:       syslogdaemon
96 Conflicts:      klogd
97 Conflicts:      msyslog
98 Conflicts:      syslog
99 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
100
101 # syslog-ng has really crazy linking rules (see their bugzilla).
102 # Some rules, according to syslog-ng devs, are like this:
103 # - libsyslog-ng.so has undefined symbols for third party libraries
104 #   and these symbols should go via main syslog-ng binary
105 # - same applies for modules
106 %if %{without dynamic}
107 %define         no_install_post_check_so        1
108 # filterout_ld - see comment few lines above
109 %define         filterout_ld                    -Wl,--as-needed -Wl,--no-copy-dt-needed-entries
110 %define         _sbindir                        /sbin
111 %define         _libdir                         /%{_lib}
112 %endif
113
114 %description
115 syslog-ng is a syslogd replacement for Unix and Unix-like systems. It
116 has been tested on Solaris, BSDi and Linux, and were found to run
117 reliably. syslog-ng gives you a much enhanced configuration scheme,
118 which lets you filter messages based on not only priority/facility
119 pairs, but also on message content. You can use regexps to direct log
120 stream to different destinations. A destination can be anything from a
121 simple file to a network connection. syslog-ng supports TCP
122 logforwarding, together with hashing to prevent unauthorized
123 modification on the line.
124
125 %description -l pl.UTF-8
126 Syslog-ng jest zamiennikiem dla standardowo używanych programów typu
127 syslog. Działa w systemie SunOS, BSD, Linux. Daje znacznie większe
128 możliwości logowania i kontrolowania zbieranych informacji.
129
130 %description -l pt_BR.UTF-8
131 Syslog-ng é um substituto para o syslog tradicional, mas com diversas
132 melhorias, como, por exemplo, a habilidade de filtrar mensagens de log
133 por seu conteúdo (usando expressões regulares) e não apenas pelo par
134 facility/prioridade como o syslog original.
135
136 %package upstart
137 Summary:        Upstart job description for syslog-ng
138 Summary(pl.UTF-8):      Opis zadania Upstart dla demona syslog-ng
139 Group:          Daemons
140 Requires:       %{name} = %{version}-%{release}
141 Requires:       upstart >= 0.6
142 Conflicts:      avahi-upstart < 0.6.30-2
143 Conflicts:      openssh-server-upstart < 2:5.8p2-2
144 Conflicts:      postgresql-upstart < 9.0.4-2
145
146 %description upstart
147 Upstart job description for syslog-ng.
148
149 %description upstart -l pl.UTF-8
150 Opis zadania Upstart dla demona syslog-ng.
151
152 %prep
153 %setup -q
154 %patch0 -p1
155 %patch1 -p1
156 cp -a %{SOURCE4} doc
157 cp -a %{SOURCE5} contrib/syslog-ng.conf.simple
158
159 %{__sed} -i -e 's|/usr/bin/awk|/bin/awk|' scl/syslogconf/convert-syslogconf.awk
160
161 %build
162 for i in . lib/ivykis; do
163 cd $i
164         %{__libtoolize}
165         %{__aclocal} -I m4
166         %{__autoconf}
167         %{__autoheader}
168         %{__automake}
169 cd -
170 done
171 %configure \
172         --sysconfdir=%{_sysconfdir}/syslog-ng \
173         --datadir=%{_datadir}/syslog-ng \
174         --with-libmongo-client=system \
175         --with-module-dir=%{_libdir}/syslog-ng \
176         --with-pidfile-dir=/var/run \
177         --with-timezone-dir=%{_datadir}/zoneinfo \
178         --disable-systemd \
179         --enable-ipv6 \
180         --enable-linux-caps \
181         --enable-pacct \
182         --enable-pcre \
183         --enable-spoof-source \
184         --enable-ssl \
185         --enable-tcp-wrapper \
186 %if %{with sql}
187         --enable-sql \
188 %endif
189 %if %{with dynamic}
190         --enable-dynamic-linking
191 %else
192         --enable-mixed-linking
193 %endif
194
195 %{__make}
196
197 %{?with_tests:LD_LIBRARY_PATH=$PWD/lib/.libs %{__make} check}
198
199 %install
200 rm -rf $RPM_BUILD_ROOT
201 install -d $RPM_BUILD_ROOT/etc/{init,sysconfig,logrotate.d,rc.d/init.d} \
202         $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/patterndb.d \
203         $RPM_BUILD_ROOT/var/{log,lib/%{name}/xsd}
204
205 %{__make} -j1 install \
206         DESTDIR=$RPM_BUILD_ROOT
207
208 %{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/syslog-ng
209 cp -a %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/syslog-ng/syslog-ng.conf
210 cp -a %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/syslog-ng
211
212 for n in daemon debug iptables kernel lpr maillog messages secure spooler syslog user xferlog; do
213         > $RPM_BUILD_ROOT/var/log/$n
214 done
215 touch $RPM_BUILD_ROOT/etc/sysconfig/%{name}
216
217 %{__rm} $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}/loggen*
218 %{__rm} $RPM_BUILD_ROOT%{_libdir}/*.la
219 %{__rm} $RPM_BUILD_ROOT%{_libdir}/syslog-ng/*.la
220
221 %if "%{pld_release}" == "th"
222 %{__sed} -e 's|@@SBINDIR@@|%{_sbindir}|g' %{SOURCE6} > $RPM_BUILD_ROOT/etc/init/%{name}.conf
223 %endif
224
225 %clean
226 rm -rf $RPM_BUILD_ROOT
227
228 %post
229 /sbin/ldconfig
230 if [ "$1" = "1" ]; then
231         # disable /proc/kmsg from config on first install on vserver
232         {
233                 while read f ctx; do
234                         [ "$f" = "VxID:" -o "$f" = "s_context:" ] && break
235                 done </proc/self/status
236         } 2>/dev/null
237         if [ -z "$ctx" -o "$ctx" = "0" ]; then
238                 VSERVER=no
239         else
240                 VSERVER=yes
241         fi
242         if [ "$VSERVER" = "yes" ]; then
243                 %{__sed} -i -e '/\/proc\/kmsg/ s/^[^#]/#&/' %{_sysconfdir}/%{name}/%{name}.conf
244         fi
245 fi
246
247 /sbin/chkconfig --add syslog-ng
248 %service syslog-ng restart "syslog-ng daemon"
249
250 %preun
251 if [ "$1" = "0" ]; then
252         %service syslog-ng stop
253         /sbin/chkconfig --del syslog-ng
254 fi
255
256 %postun -p /sbin/ldconfig
257
258 %post upstart
259 %upstart_post %{name}
260
261 %postun upstart
262 %upstart_postun %{name}
263
264 %triggerun upstart -- syslog-ng-upstart < 3.2.4-3
265 #  use SERVICE_syslog=y in upstart job environment instead of SERVICE=syslog
266 %{__sed} -i -e 's,SERVICE=syslog,SERVICE_syslog=y,' /etc/init/*.conf || :
267
268 %triggerun -- syslog-ng < 3.0
269 sed -i -e 's#sync(\(.*\))#flush_lines(\1)#g' /etc/syslog-ng/syslog-ng.conf
270 sed -i -e 's#pipe ("/proc/kmsg"#file ("/proc/kmsg"#g' /etc/syslog-ng/syslog-ng.conf
271 sed -i -e 's#log_prefix#program_override#g' /etc/syslog-ng/syslog-ng.conf
272 sed -i -e 's#^destination #destination d_#g' /etc/syslog-ng/syslog-ng.conf
273 sed -i -e 's#destination(#destination(d_#g' /etc/syslog-ng/syslog-ng.conf
274 sed -i -e 's,\bstats\b,stats_freq,' /etc/syslog-ng/syslog-ng.conf
275 sed -i -e 's#match("IN\=\[A-Za-z0-9\]\* OUT=\[A-Za-z0-9\]\*");#match("IN=[A-Za-z0-9]* OUT=[A-Za-z0-9]*" value("MESSAGE"));#g' /etc/syslog-ng/syslog-ng.conf
276 sed -i -e "1 s#\(.*\)\$#@version: 3.0\n\1#g" /etc/syslog-ng/syslog-ng.conf
277 rm -f %{_var}/lib/%{name}/syslog-ng.persist
278 %service -q syslog-ng restart
279 exit 0
280
281 %files
282 %defattr(644,root,root,755)
283 %doc AUTHORS ChangeLog NEWS debian/syslog-ng.conf* contrib/relogger.pl
284 %doc contrib/syslog-ng.conf.{doc,simple,RedHat}
285 %doc contrib/{apparmor,selinux,syslog2ng} doc/syslog-ng-ose-v3.3-guide-admin-en.pdf
286 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
287 %attr(750,root,root) %dir %{_sysconfdir}/syslog-ng
288 %attr(750,root,root) %dir %{_sysconfdir}/syslog-ng/patterndb.d
289 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/modules.conf
290 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/scl.conf
291 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/syslog-ng/syslog-ng.conf
292 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/syslog-ng
293 %attr(754,root,root) /etc/rc.d/init.d/syslog-ng
294 %attr(755,root,root) %{_libdir}/libsyslog-ng-%{version}.so
295 %dir %{_libdir}/syslog-ng
296 %attr(755,root,root) %{_libdir}/syslog-ng/lib*.so
297 %attr(755,root,root) %{_sbindir}/syslog-ng
298 %attr(755,root,root) %{_sbindir}/syslog-ng-ctl
299 %attr(755,root,root) %{_bindir}/pdbtool
300 %attr(755,root,root) %{_bindir}/update-patterndb
301
302 %dir %{_datadir}/syslog-ng
303 %dir %{_datadir}/syslog-ng/include
304 %dir %{_datadir}/syslog-ng/include/scl
305 %dir %{_datadir}/syslog-ng/include/scl/pacct
306 %{_datadir}/syslog-ng/include/scl/pacct/plugin.conf
307 %dir %{_datadir}/syslog-ng/include/scl/syslogconf
308 %{_datadir}/syslog-ng/include/scl/syslogconf/README
309 %attr(755,root,root) %{_datadir}/syslog-ng/include/scl/syslogconf/convert-syslogconf.awk
310 %{_datadir}/syslog-ng/include/scl/syslogconf/plugin.conf
311 %dir %{_datadir}/syslog-ng/include/scl/system
312 %attr(755,root,root) %{_datadir}/syslog-ng/include/scl/system/generate-system-source.sh
313 %{_datadir}/syslog-ng/include/scl/system/plugin.conf
314 %dir %{_datadir}/syslog-ng/xsd
315 %{_datadir}/syslog-ng/xsd/patterndb-*.xsd
316
317 %dir %{_var}/lib/%{name}
318 %dir %{_var}/lib/%{name}/xsd
319 %{_mandir}/man1/pdbtool.1*
320 %{_mandir}/man1/syslog-ng-ctl.1*
321 %{_mandir}/man5/syslog-ng.conf.5*
322 %{_mandir}/man8/syslog-ng.8*
323
324 %attr(640,root,root) %ghost /var/log/*
325
326 %if "%{pld_release}" == "th"
327 %files upstart
328 %defattr(644,root,root,755)
329 %config(noreplace) %verify(not md5 mtime size) /etc/init/%{name}.conf
330 %endif
This page took 0.051645 seconds and 4 git commands to generate.