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