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