]> git.pld-linux.org Git - packages/zbar.git/blob - zbar.spec
d46da61cb50fca539d94f45e80fcd6b6631e3110
[packages/zbar.git] / zbar.spec
1 # TODO: both python2 and python3 in same build?
2 #
3 # Conditional build:
4 %bcond_with     java    # Java interface [some file missing]
5 %bcond_with     npapi   # NPAPI plugin for Firefox/OpenOffice [nothing really yet]
6 %bcond_with     gtk2    # GTK+ 2.x instead of 2.x
7 %bcond_with     python2 # Python 2.x module
8 %bcond_without  python3 # Python 3.x module
9 %bcond_without  qt      # Qt widget (Qt5 or Qt4)
10 %bcond_with     qt4     # Qt4 instead of Qt5
11 %bcond_with     tests   # "make test" for Perl module [needs X display]
12 #
13 %if %{with python2}
14 %undefine       with_python3
15 %endif
16 Summary:        ZBar Bar Code Reader
17 Summary(pl.UTF-8):      ZBar - czytnik kodów paskowych
18 Name:           zbar
19 Version:        0.23.1
20 Release:        2
21 License:        LGPL v2.1+
22 Group:          Libraries
23 # no releases since 2009
24 #Source0:       http://downloads.sourceforge.net/zbar/%{name}-%{version}.tar.bz2
25 # non-maintainer release
26 Source0:        https://linuxtv.org/downloads/zbar/%{name}-%{version}.tar.bz2
27 # Source0-md5:  5f8fc224e5ee924b6dd1032b944d0b3a
28 Patch0:         %{name}-sh.patch
29 Patch1:         %{name}-link.patch
30 Patch2:         %{name}-npapi.patch
31 Patch3:         %{name}-missing-files.patch
32 Patch4:         %{name}-no-gettext.h.patch
33 URL:            http://zbar.sourceforge.net/
34 BuildRequires:  ImageMagick-devel >= 1:6.2.6
35 BuildRequires:  autoconf >= 2.68
36 BuildRequires:  automake >= 1:1.13
37 BuildRequires:  dbus-devel >= 1.0
38 BuildRequires:  gettext-tools >= 0.18
39 BuildRequires:  glib2-devel >= 2.0
40 BuildRequires:  gobject-introspection-devel >= 0.6.7
41 %{?with_gtk2:BuildRequires:     gtk+2-devel >= 2.0}
42 %{!?with_gtk2:BuildRequires:    gtk+3-devel >= 3.0}
43 %{?with_java:BuildRequires:     jdk}
44 BuildRequires:  libjpeg-devel
45 BuildRequires:  libstdc++-devel
46 BuildRequires:  libtool >= 2:2.2
47 BuildRequires:  libv4l-devel
48 BuildRequires:  perl-devel >= 1:5.8.0
49 BuildRequires:  pkgconfig
50 %{?with_npapi:BuildRequires:    pkgconfig(mozilla-plugin)}
51 %if %{with python2}
52 BuildRequires:  python-devel >= 1:2.7.0
53 BuildRequires:  python-pygtk-devel >= 2:2.0
54 %endif
55 %if %{with python3}
56 BuildRequires:  python3-devel >= 1:3.2
57 %endif
58 BuildRequires:  rpm-perlprov >= 4.1-13
59 BuildRequires:  rpm-pythonprov
60 BuildRequires:  rpmbuild(macros) >= 1.357
61 BuildRequires:  xmlto
62 BuildRequires:  xorg-lib-libX11-devel
63 BuildRequires:  xorg-lib-libXext-devel
64 BuildRequires:  xorg-lib-libXv-devel
65 %if %{with qt}
66 %if %{with qt4}
67 BuildRequires:  QtCore-devel >= 4
68 BuildRequires:  QtGui-devel >= 4
69 BuildRequires:  qt4-build >= 4
70 %else
71 BuildRequires:  Qt5Core-devel >= 5
72 BuildRequires:  Qt5Gui-devel >= 5
73 BuildRequires:  Qt5Widgets-devel >= 5
74 BuildRequires:  Qt5X11Extras-devel >= 5
75 BuildRequires:  qt5-build >= 5
76 %endif
77 %endif
78 Requires:       ImageMagick-libs >= 1:6.2.6
79 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
80
81 %description
82 ZBar Bar Code Reader is an open source software suite for reading bar
83 codes from various sources, such as video streams, image files and raw
84 intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128,
85 Code 39, Interleaved 2 of 5 and QR Code. Included with the library are
86 basic applications for decoding captured bar code images and using a
87 video device (eg, webcam) as a bar code scanner. For application
88 developers, language bindings are available for C, C++, Python and
89 Perl as well as GUI widgets for Qt, GTK+ and PyGTK.
90
91 %description -l pl.UTF-8
92 ZBar Bar Code Reader to zestaw oprogramowania do odczytu kodów
93 paskowych z różnych źródeł, takich jak strumienie wideo, pliki obrazów
94 oraz czujniki jasności. Obsługuje kody EAN-13/UPC-A, UPC-E, EAN-8,
95 Code 128, Code 39, Interleaved 2 of 5 oraz QR Code. Do biblioteki
96 dołączone są podstawowe aplikacje do dekodowania wyłapanych obrazów
97 kodów paskowych oraz używania urządzeń wejściowych obrazu (np. kamer
98 internetowych) jako skanera kodów paskowych. Dla programistów są
99 dostępne też wiązania dla C, C++, Pythona, Perla oraz widgety GUI dla
100 Qt, GTK+ oraz PyGTK.
101
102 %package devel
103 Summary:        C and C++ header files for ZBar library
104 Summary(pl.UTF-8):      Pliki nagłówkowe C i C++ dla biblioteki ZBar
105 Group:          Development/Libraries
106 Requires:       %{name} = %{version}-%{release}
107 Requires:       libjpeg-devel
108 Requires:       xorg-lib-libXext-devel
109 Requires:       xorg-lib-libXv-devel
110
111 %description devel
112 C and C++ header files for ZBar library.
113
114 %description devel -l pl.UTF-8
115 Pliki nagłówkowe C i C++ dla biblioteki ZBar.
116
117 %package static
118 Summary:        Static ZBar library
119 Summary(pl.UTF-8):      Statyczna biblioteka ZBar
120 Group:          Development/Libraries
121 Requires:       %{name}-devel = %{version}-%{release}
122
123 %description static
124 Static ZBar library.
125
126 %description static -l pl.UTF-8
127 Statyczna biblioteka ZBar.
128
129 %package gtk
130 Summary:        Bar code scanning and decoding GTK+ widget
131 Summary(pl.UTF-8):      Widget GTK+ do skanowania i dekodowania kodów paskowych
132 Group:          X11/Libraries
133 Requires:       %{name} = %{version}-%{release}
134
135 %description gtk
136 Bar code scanning and decoding GTK+ widget.
137
138 %description gtk -l pl.UTF-8
139 Widget GTK+ do skanowania i dekodowania kodów paskowych.
140
141 %package gtk-devel
142 Summary:        Header file for bar code scanning and decoding GTK+ widget
143 Summary(pl.UTF-8):      Plik nagłówkowy widgetu GTK+ do skanowania i dekodowania kodów paskowych
144 Group:          X11/Development/Libraries
145 Requires:       %{name}-devel = %{version}-%{release}
146 Requires:       %{name}-gtk = %{version}-%{release}
147 %{?with_gtk2:Requires:  gtk+2-devel >= 2.0}
148 %{!?with_gtk2:Requires: gtk+3-devel >= 3.0}
149
150 %description gtk-devel
151 Header file for bar code scanning and decoding GTK+ widget.
152
153 %description gtk-devel -l pl.UTF-8
154 Plik nagłówkowy widgetu GTK+ do skanowania i dekodowania kodów
155 paskowych.
156
157 %package gtk-static
158 Summary:        Bar code scanning and decoding GTK+ widget - static library
159 Summary(pl.UTF-8):      Widget GTK+ do skanowania i dekodowania kodów paskowych - biblioteka statyczna
160 Group:          X11/Development/Libraries
161 Requires:       %{name}-gtk-devel = %{version}-%{release}
162
163 %description gtk-static
164 Bar code scanning and decoding GTK+ widget - static library.
165
166 %description gtk-static -l pl.UTF-8
167 Widget GTK+ do skanowania i dekodowania kodów paskowych - biblioteka
168 statyczna.
169
170 %package qt
171 Summary:        Bar code scanning and decoding Qt4 widget
172 Summary(pl.UTF-8):      Widget Qt4 do skanowania i dekodowania kodów paskowych
173 Group:          X11/Libraries
174 Requires:       %{name} = %{version}-%{release}
175
176 %description qt
177 Bar code scanning and decoding Qt4 widget.
178
179 %description qt -l pl.UTF-8
180 Widget Qt4 do skanowania i dekodowania kodów paskowych.
181
182 %package qt-devel
183 Summary:        Header file for bar code scanning and decoding Qt4 widget
184 Summary(pl.UTF-8):      Plik nagłówkowy widgetu Qt4 do skanowania i dekodowania kodów paskowych
185 Group:          X11/Development/Libraries
186 Requires:       %{name}-devel = %{version}-%{release}
187 Requires:       %{name}-qt = %{version}-%{release}
188 %if %{with qt4}
189 Requires:       QtCore-devel >= 4
190 Requires:       QtGui-devel >= 4
191 %else
192 Requires:       Qt5Core >= 5
193 Requires:       Qt5Gui >= 5
194 Requires:       Qt5Widgets >= 5
195 Requires:       Qt5X11Extras >= 5
196 %endif
197
198 %description qt-devel
199 Header file for bar code scanning and decoding Qt4 widget.
200
201 %description qt-devel -l pl.UTF-8
202 Plik nagłówkowy widgetu Qt4 do skanowania i dekodowania kodów
203 paskowych.
204
205 %package qt-static
206 Summary:        Bar code scanning and decoding Qt4 widget - static library
207 Summary(pl.UTF-8):      Widget Qt4 do skanowania i dekodowania kodów paskowych - biblioteka statyczna
208 Group:          X11/Development/Libraries
209 Requires:       %{name}-qt-devel = %{version}-%{release}
210
211 %description qt-static
212 Bar code scanning and decoding Qt4 widget - static library.
213
214 %description qt-static -l pl.UTF-8
215 Widget Qt4 do skanowania i dekodowania kodów paskowych - biblioteka
216 statyczna.
217
218 %package -n perl-Barcode-ZBar
219 Summary:        Perl interface to ZBar bar code reader
220 Summary(pl.UTF-8):      Interfejs Perla do czytnika kodów paskowych ZBar
221 Group:          Development/Languages/Perl
222 Requires:       %{name} = %{version}-%{release}
223
224 %description -n perl-Barcode-ZBar
225 Perl interface to ZBar bar code reader.
226
227 %description -n perl-Barcode-ZBar -l pl.UTF-8
228 Interfejs Perla do czytnika kodów paskowych ZBar.
229
230 %package -n python-zbar
231 Summary:        Python 2 interface to ZBar bar code reader
232 Summary(pl.UTF-8):      Interfejs Pythona 2 do czytnika kodów paskowych ZBar
233 Group:          Libraries/Python
234 Requires:       %{name} = %{version}-%{release}
235 Requires:       python-libs >= 1:2.7.0
236
237 %description -n python-zbar
238 Python 2 interface to ZBar bar code reader.
239
240 %description -n python-zbar -l pl.UTF-8
241 Interfejs Pythona 2 do czytnika kodów paskowych ZBar.
242
243 %package -n python-zbar-pygtk
244 Summary:        Bar code scanning and decoding PyGTK widget
245 Summary(pl.UTF-8):      Widget PyGTK do skanowania i dekodowania kodów paskowych
246 Group:          Libraries/Python
247 Requires:       %{name}-gtk = %{version}-%{release}
248 Requires:       python-libs >= 1:2.7.0
249 Requires:       python-pygtk-gtk >= 2:2.0
250
251 %description -n python-zbar-pygtk
252 Bar code scanning and decoding PyGTK widget.
253
254 %description -n python-zbar-pygtk -l pl.UTF-8
255 Widget PyGTK do skanowania i dekodowania kodów paskowych.
256
257 %package -n python3-zbar
258 Summary:        Python 3 interface to ZBar bar code reader
259 Summary(pl.UTF-8):      Interfejs Pythona 3 do czytnika kodów paskowych ZBar
260 Group:          Libraries/Python
261 Requires:       %{name} = %{version}-%{release}
262
263 %description -n python3-zbar
264 Python 3 interface to ZBar bar code reader.
265
266 %description -n python3-zbar -l pl.UTF-8
267 Interfejs Pythona 3 do czytnika kodów paskowych ZBar.
268
269 %package -n browser-plugin-zbar
270 Summary:        ZBar plugin for Web browsers
271 Summary(pl.UTF-8):      Wtyczka ZBar dla przeglądarek WWW
272 Group:          X11/Applications/Graphics
273 Requires:       %{name} = %{version}-%{release}
274 Requires:       browser-plugins >= 2.0
275
276 %description -n browser-plugin-zbar
277 ZBar plugin for Web browsers.
278
279 %description -n browser-plugin-zbar -l pl.UTF-8
280 Wtyczka ZBar dla przeglądarek WWW.
281
282 %prep
283 %setup -q
284 %patch0 -p1
285 %patch1 -p1
286 %patch2 -p1
287 %patch3 -p1
288 %patch4 -p1
289
290 %build
291 %{__libtoolize}
292 %{__aclocal}
293 %{__autoconf}
294 %{__autoheader}
295 %{__automake}
296 # for ">>" in nested template usage
297 CXXFLAGS="%{rpmcxxflags} -std=c++11"
298 %configure \
299         --disable-silent-rules \
300         %{?with_gtk2:--with-gtk=gtk2} \
301         %{!?with_java:--without-java} \
302         --with-python=%{?with_python2:python2}%{?with_python3:python3}%{!?with_python2:%{!?with_python3:no}} \
303         %{!?with_qt:--without-qt} \
304         %{?with_qt4:--without-qt5} \
305         %{?with_npapi:--with-npapi}
306 %{__make}
307
308 TOPDIR=$(pwd)
309 cd perl
310 %{__perl} Makefile.PL \
311         INSTALLDIRS=vendor \
312         INC="-I${TOPDIR}/include" \
313         LIBS="-L${TOPDIR}/zbar/.libs -lzbar"
314
315 %{__make} \
316         CC="%{__cc}" \
317         OPTIMIZE="%{rpmcflags}"
318
319 %{?with_tests:%{__make} test}
320
321 %install
322 rm -rf $RPM_BUILD_ROOT
323 install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
324
325 %{__make} install \
326         DESTDIR=$RPM_BUILD_ROOT
327
328 # obsoleted by pkg-config
329 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libzbar*.la
330 # packaged as %doc
331 %{__rm} -r $RPM_BUILD_ROOT%{_docdir}/zbar
332
333 %if %{with python2}
334 %{__rm} $RPM_BUILD_ROOT%{py_sitedir}/*.la
335 %endif
336 %if %{with python3}
337 %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/*.la
338 %endif
339
340 %{__make} -C perl install \
341         DESTDIR=$RPM_BUILD_ROOT
342
343 %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/Barcode/ZBar/*.pod
344 # not rm -r to ensure it's empty after .pod removal
345 rmdir $RPM_BUILD_ROOT%{perl_vendorarch}/Barcode/ZBar
346 %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/Barcode/ZBar/.packlist
347 %{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
348
349 %if %{with npapi}
350 install -d $RPM_BUILD_ROOT%{_browserpluginsdir}
351 %{__mv} $RPM_BUILD_ROOT%{_libdir}/libzbarplugin.so* $RPM_BUILD_ROOT%{_browserpluginsdir}
352 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libzbarplugin.{la,a}
353 %endif
354
355 %clean
356 rm -rf $RPM_BUILD_ROOT
357
358 %post   -p /sbin/ldconfig
359 %postun -p /sbin/ldconfig
360
361 %post   gtk -p /sbin/ldconfig
362 %postun gtk -p /sbin/ldconfig
363
364 %post   qt -p /sbin/ldconfig
365 %postun qt -p /sbin/ldconfig
366
367 %post   -n browser-plugin-zbar
368 %update_browser_plugins
369
370 %postun -n browser-plugin-zbar
371 if [ "$1" = 0 ]; then
372         %update_browser_plugins
373 fi
374
375 %files
376 %defattr(644,root,root,755)
377 # COPYING contains license summary, not LGPL text
378 %doc COPYING ChangeLog NEWS.md README.md TODO.md
379 %attr(755,root,root) %{_bindir}/zbarcam
380 %attr(755,root,root) %{_bindir}/zbarimg
381 %attr(755,root,root) %{_libdir}/libzbar.so.*.*.*
382 %attr(755,root,root) %ghost %{_libdir}/libzbar.so.0
383 %{_libdir}/girepository-1.0/ZBar-1.0.typelib
384 # for zbarcam
385 /etc/dbus-1/system.d/org.linuxtv.Zbar.conf
386 %dir %{_datadir}/%{name}
387 %{_mandir}/man1/zbarcam.1*
388 %{_mandir}/man1/zbarimg.1*
389
390 %files devel
391 %defattr(644,root,root,755)
392 %attr(755,root,root) %{_libdir}/libzbar.so
393 %{_datadir}/gir-1.0/ZBar-1.0.gir
394 # C
395 %{_includedir}/zbar.h
396 %dir %{_includedir}/zbar
397 # C++
398 %{_includedir}/zbar/Decoder.h
399 %{_includedir}/zbar/Exception.h
400 %{_includedir}/zbar/Image.h
401 %{_includedir}/zbar/ImageScanner.h
402 %{_includedir}/zbar/Processor.h
403 %{_includedir}/zbar/Scanner.h
404 %{_includedir}/zbar/Symbol.h
405 %{_includedir}/zbar/Video.h
406 %{_includedir}/zbar/Window.h
407 %{_pkgconfigdir}/zbar.pc
408
409 %files static
410 %defattr(644,root,root,755)
411 %{_libdir}/libzbar.a
412
413 %files gtk
414 %defattr(644,root,root,755)
415 %attr(755,root,root) %{_bindir}/zbarcam-gtk
416 %attr(755,root,root) %{_libdir}/libzbargtk.so.*.*.*
417 %attr(755,root,root) %ghost %{_libdir}/libzbargtk.so.0
418
419 %files gtk-devel
420 %defattr(644,root,root,755)
421 %attr(755,root,root) %{_libdir}/libzbargtk.so
422 %{_includedir}/zbar/zbargtk.h
423 %{_pkgconfigdir}/zbar-gtk.pc
424
425 %files gtk-static
426 %defattr(644,root,root,755)
427 %{_libdir}/libzbargtk.a
428
429 %if %{with qt}
430 %files qt
431 %defattr(644,root,root,755)
432 %attr(755,root,root) %{_bindir}/zbarcam-qt
433 %attr(755,root,root) %{_libdir}/libzbarqt.so.*.*.*
434 %attr(755,root,root) %ghost %{_libdir}/libzbarqt.so.0
435
436 %files qt-devel
437 %defattr(644,root,root,755)
438 %attr(755,root,root) %{_libdir}/libzbarqt.so
439 %{_includedir}/zbar/QZBar.h
440 %{_includedir}/zbar/QZBarImage.h
441 %{_pkgconfigdir}/zbar-qt.pc
442
443 %files qt-static
444 %defattr(644,root,root,755)
445 %{_libdir}/libzbarqt.a
446 %endif
447
448 %files -n perl-Barcode-ZBar
449 %defattr(644,root,root,755)
450 %dir %{perl_vendorarch}/Barcode
451 %{perl_vendorarch}/Barcode/ZBar.pm
452 %dir %{perl_vendorarch}/auto/Barcode
453 %dir %{perl_vendorarch}/auto/Barcode/ZBar
454 %attr(755,root,root) %{perl_vendorarch}/auto/Barcode/ZBar/ZBar.so
455 %{_mandir}/man3/Barcode::ZBar*.3pm*
456
457 %if %{with python2}
458 %files -n python-zbar
459 %defattr(644,root,root,755)
460 %attr(755,root,root) %{py_sitedir}/zbar.so
461
462 %files -n python-zbar-pygtk
463 %defattr(644,root,root,755)
464 %attr(755,root,root) %{py_sitedir}/zbarpygtk.so
465 %endif
466
467 %if %{with python3}
468 %files -n python3-zbar
469 %defattr(644,root,root,755)
470 %attr(755,root,root) %{py3_sitedir}/zbar.so
471 %endif
472
473 %if %{with npapi}
474 %files -n browser-plugin-zbar
475 %defattr(644,root,root,755)
476 %attr(755,root,root) %{_browserpluginsdir}/libzbarplugin.so*
477 %endif
This page took 0.104733 seconds and 2 git commands to generate.