3 # - no globs for suid/sgid files
4 # - it requires some magick to work with cambozola
5 # - check default configuration in zm_create.sql (wrong paths: /tmp/, /usr/local/bin)
8 Summary: Zone Minder is a software motion detector with nice WWW GUI
9 Summary(pl.UTF-8): Zone Minder - programowy wykrywacz ruchu z miłym GUI przez WWW
14 Group: Applications/Graphics
15 Source0: https://github.com/ZoneMinder/ZoneMinder/archive/v%{version}.tar.gz
16 # Source0-md5: b0317c6fe003de9a0c7c76078b0adc2b
19 Source3: zm-logrotate_d
20 Source4: http://dig.hopto.org/xlib_shm/xlib_shm-0.6.3.tar.bz2
21 # Source4-md5: 469a65bdf658e68e23445f5cc6f07f07
22 # http://mootools.net/download
24 Source6: %{name}-tmpfiles.conf
25 Source7: http://downloads.sourceforge.net/jscalendar/jscalendar-1.0.zip
26 # Source7-md5: 10f2160fe68294013efcd1473cd36f72
27 Patch1: %{name}-xlib_shm.patch
28 Patch2: %{name}-build.patch
29 Patch3: %{name}-init.patch
31 Patch5: %{name}-types.patch
33 URL: http://www.zoneminder.com/
34 BuildRequires: autoconf >= 2.59
35 BuildRequires: automake
36 BuildRequires: bzip2-devel
37 BuildRequires: curl-devel
38 BuildRequires: ffmpeg-devel >= 0.4.9-4.20090225
40 BuildRequires: glibc-devel >= 6:2.7
41 BuildRequires: gnutls-devel
42 BuildRequires: libjpeg-devel
43 BuildRequires: libstdc++-devel
44 BuildRequires: libx264-devel
45 BuildRequires: mysql-devel
46 BuildRequires: openssl-devel
47 BuildRequires: pcre-devel
48 BuildRequires: perl-DBD-mysql
49 BuildRequires: perl-DBI
50 BuildRequires: perl-Date-Manip
51 BuildRequires: perl-Sys-Mmap
52 BuildRequires: perl-devel >= 1:5.6.0
53 BuildRequires: perl-libwww
54 BuildRequires: pkgconfig
55 BuildRequires: polkit-devel
56 BuildRequires: rpmbuild(macros) >= 1.268
57 BuildRequires: vlc-devel
58 BuildRequires: xorg-lib-libXv-devel
59 BuildRequires: zlib-devel
60 Requires(post,preun): /sbin/chkconfig
61 Requires: perl-DBD-mysql
62 Requires: perl-Date-Manip
63 Requires: perl-PHP-Serialization
64 Requires: perl-Sys-Mmap
69 Requires: webserver(php)
71 Suggests: perl-Archive-Zip
72 # for RS232/RS486 PTZ cameras
73 Suggests: perl-Device-SerialPort
74 # for sftp event uploading
76 # for event mail notification
77 Suggests: perl-MIME-tools
78 Suggests: perl-MIME-Lite
79 # for sftp event uploading
80 Suggests: perl-Net-SFTP
81 Suggests: perl-Net-SFTP-Foreign
83 Suggests: perl-Module-Load
84 # for X.10 support (TODO)
89 Obsoletes: zoneminder-X10
90 Obsoletes: zoneminder-control
91 Conflicts: apache-base < 2.4.0-1
92 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
94 %define specflags -D__STDC_CONSTANT_MACROS
96 %define _webapps /etc/webapps
97 %define _webapp %{name}
98 %define _appdir %{_datadir}/%{_webapp}
101 ZoneMinder is a set of applications which is intended to provide a
102 complete solution allowing you to capture, analyse, record and monitor
103 any cameras you have attached to a Linux based machine. It is designed
104 to run on kernels which support the Video For Linux (V4L) interface
105 and has been tested with cameras attached to BTTV cards, various USB
106 cameras and IP network cameras.
108 %description -l pl.UTF-8
109 ZoneMinder to zestaw aplikacji mających dostarczyć kompletne
110 rozwiązanie pozwalające na przechwytywanie, analizę, nagrywanie i
111 monitorowanie kamer podłączonych do maszyny z Linuksem. Jest
112 zaprojektowany do działania z jądrami obsługującymi interfejs Video
113 For Linux (V4L) i był testowany z kamerami podłączonymi do kart BTTV,
114 różnymi kamerami USB i sieciowymi kamerami IP.
117 %setup -q -n ZoneMinder-%{version} -a4 -a7
129 sed -i -e 's#-frepo##g' src/Makefile.am
130 sed -i -e 's#chown#true#g' -e 's#chmod#true#g' *.am */*.am */*/*.am
132 cat <<'EOF' >> db/zm_create.sql.in
133 UPDATE Config SET Value = '/cgi-bin/zoneminder/nph-zms' WHERE Name = 'ZM_PATH_ZMS';
134 UPDATE Config SET Value = '/var/run/zoneminder' WHERE Name = 'ZM_PATH_SOCKS';
135 UPDATE Config SET Value = '/var/log/zoneminder' WHERE Name = 'ZM_PATH_LOGS';
136 GRANT SELECT,INSERT,UPDATE,DELETE ON zm.* TO 'zmuser'@localhost IDENTIFIED BY 'zmpass';
139 install -d jscalendar-doc
140 %{__mv} jscalendar-[0-9]*/{*html,*php,doc/*,README} jscalendar-doc
141 %{__rm} -r jscalendar-[0-9]*/doc
149 ZM_RUNDIR=%{_var}/run/zoneminder \
150 ZM_SOCKDIR=%{_var}/run/zoneminder \
151 ZM_LOGDIR=%{_var}/log/zoneminder \
152 --with-libarch=%{_lib} \
155 --with-mysql=%{_prefix} \
157 --with-webgroup=http \
158 --with-webuser=http \
159 --with-webdir=%{_appdir}/www \
160 --with-cgidir=%{_libdir}/%{name}/cgi-bin
165 -e 's/(ZM_WEB_USER=).*$/${1}http/;' \
166 -e 's/(ZM_WEB_GROUP=).*$/${1}http/;' zm.conf
168 %{__cc} %{rpmcflags} %{rpmldflags} xlib_shm-*/xlib_shm.c -lXv -lXext -lX11 -lmysqlclient -o zm_xlib_shm
171 rm -rf $RPM_BUILD_ROOT
172 install -d $RPM_BUILD_ROOT{%{_localstatedir}/{run,log/zoneminder},/etc/logrotate.d} \
173 $RPM_BUILD_ROOT{%{_webapps}/%{_webapp},%{_sysconfdir}/tmpfiles.d}
176 DESTDIR=$RPM_BUILD_ROOT \
179 %{__rm} -r $RPM_BUILD_ROOT%{_prefix}/%{_lib}/perl5/vendor_perl/*.*/*-*
180 %{__rm} -r $RPM_BUILD_ROOT%{_prefix}/%{_lib}/perl5/*.*/*-*
181 %{__rm} $RPM_BUILD_ROOT%{_bindir}/zmx10.pl
183 install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/log/zoneminder
184 for dir in events images temp
186 install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/zoneminder/$dir
187 rm -rf $RPM_BUILD_ROOT%{_appdir}/www/$dir
188 ln -sf ../../../..%{_localstatedir}/lib/zoneminder/$dir $RPM_BUILD_ROOT%{_appdir}/www/$dir
190 install -D -m 755 scripts/zm $RPM_BUILD_ROOT/etc/rc.d/init.d/zoneminder
191 install %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
192 install %{SOURCE5} $RPM_BUILD_ROOT%{_appdir}/www
194 install zm_xlib_shm $RPM_BUILD_ROOT%{_bindir}
196 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
197 cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
199 # Install jscalendar - this really should be in its own package
200 install -d -m 755 $RPM_BUILD_ROOT%{_appdir}/www/jscalendar
201 cp -rp jscalendar-[0-9]*/* $RPM_BUILD_ROOT%{_appdir}/www/jscalendar
204 rm -rf $RPM_BUILD_ROOT
207 /sbin/chkconfig --add zoneminder
210 if [ "$1" = "0" ]; then
211 %service zoneminder stop
212 /sbin/chkconfig --del zoneminder
215 %triggerin -- apache-base
216 %webapp_register httpd %{_webapp}
218 %triggerun -- apache-base
219 %webapp_unregister httpd %{_webapp}
221 %triggerpostun -- %{name} < 1.25.0-6
222 if [ -f %{_sysconfdir}/httpd/conf.d/zoneminder.conf.rpmsave ]; then
223 mv %{_sysconfdir}/httpd/conf.d/zoneminder.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf.rpmsave
224 echo "Old apache config has been saved as %{_webapps}/%{_webapp}/httpd.conf.rpmsave"
229 %defattr(644,root,root,755)
230 %doc AUTHORS BUGS ChangeLog README.md jscalendar-doc
231 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
232 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
233 %config(noreplace) %attr(640,root,http) %{_sysconfdir}/zm.conf
234 %config(noreplace) /etc/logrotate.d/%{name}
235 %{_sysconfdir}/tmpfiles.d/%{name}.conf
236 %attr(754,root,root) /etc/rc.d/init.d/zoneminder
237 %attr(755,root,root) %{_bindir}/zma
238 %attr(755,root,root) %{_bindir}/zmaudit.pl
239 %attr(755,root,root) %{_bindir}/zmcamtool.pl
240 %attr(755,root,root) %{_bindir}/zmcontrol.pl
241 %attr(755,root,root) %{_bindir}/zmc
242 %attr(755,root,root) %{_bindir}/zmdc.pl
243 %attr(755,root,root) %{_bindir}/zmf
244 %attr(755,root,root) %{_bindir}/zmfilter.pl
245 %attr(755,root,root) %{_bindir}/zmpkg.pl
246 %attr(755,root,root) %{_bindir}/zmstreamer
247 %attr(755,root,root) %{_bindir}/zmsystemctl.pl
248 %attr(755,root,root) %{_bindir}/zmtrack.pl
249 %attr(755,root,root) %{_bindir}/zmtrigger.pl
250 %attr(755,root,root) %{_bindir}/zmu
251 %attr(755,root,root) %{_bindir}/zmupdate.pl
252 %attr(755,root,root) %{_bindir}/zmvideo.pl
253 %attr(755,root,root) %{_bindir}/zmwatch.pl
254 %attr(755,root,root) %{_bindir}/zm_xlib_shm
255 %{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy
256 %{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules
263 %dir %{_appdir}/www/events
264 %{_appdir}/www/graphics
265 %dir %{_appdir}/www/images
266 %{_appdir}/www/includes
268 %{_appdir}/www/jscalendar
271 %{_appdir}/www/sounds
272 %dir %{_appdir}/www/temp
275 %dir %{_libdir}/%{name}
276 %dir %{_libdir}/%{name}/cgi-bin
277 %attr(755,root,root) %{_libdir}/%{name}/cgi-bin/nph-zms
278 %attr(755,root,root) %{_libdir}/%{name}/cgi-bin/zms
280 %dir %attr(770,root,http) /var/log/zoneminder
281 %dir %attr(750,root,http) /var/lib/zoneminder
282 %dir %attr(770,root,http) /var/lib/zoneminder/events
283 %dir %attr(770,root,http) /var/lib/zoneminder/images
284 %dir %attr(770,root,http) /var/lib/zoneminder/temp
286 %{perl_vendorlib}/ZoneMinder
287 %{perl_vendorlib}/ZoneMinder.pm
288 %{_mandir}/man3/ZoneMinder*.3pm*