+# TODO: both python2 and python3 in same build?
#
# Conditional build:
%bcond_with java # Java interface [some file missing]
%bcond_with npapi # NPAPI plugin for Firefox/OpenOffice [nothing really yet]
-%bcond_with gtk3 # GTK+ 3.x instead of 2.x
-%bcond_with python3 # Python 3.x instead of 2.x
+%bcond_with gtk2 # GTK+ 2.x instead of 2.x
+%bcond_with python2 # Python 2.x module
+%bcond_without python3 # Python 3.x module
%bcond_without qt # Qt widget (Qt5 or Qt4)
%bcond_with qt4 # Qt4 instead of Qt5
%bcond_with tests # "make test" for Perl module [needs X display]
#
+%if %{with python2}
+%undefine with_python3
+%endif
Summary: ZBar Bar Code Reader
Summary(pl.UTF-8): ZBar - czytnik kodów paskowych
Name: zbar
-Version: 0.23
-Release: 3
+Version: 0.23.1
+Release: 1
License: LGPL v2.1+
Group: Libraries
# no releases since 2009
#Source0: http://downloads.sourceforge.net/zbar/%{name}-%{version}.tar.bz2
# non-maintainer release
Source0: https://linuxtv.org/downloads/zbar/%{name}-%{version}.tar.bz2
-# Source0-md5: 99d16dd6ce4d3a180aeb88b8a0880653
+# Source0-md5: 5f8fc224e5ee924b6dd1032b944d0b3a
Patch0: %{name}-sh.patch
Patch1: %{name}-link.patch
Patch2: %{name}-npapi.patch
+Patch3: %{name}-missing-files.patch
+Patch4: %{name}-no-gettext.h.patch
URL: http://zbar.sourceforge.net/
BuildRequires: ImageMagick-devel >= 1:6.2.6
BuildRequires: autoconf >= 2.68
BuildRequires: automake >= 1:1.13
BuildRequires: dbus-devel >= 1.0
-BuildRequires: gettext-tools
+BuildRequires: gettext-tools >= 0.18
BuildRequires: glib2-devel >= 2.0
BuildRequires: gobject-introspection-devel >= 0.6.7
-%{!?with_gtk3:BuildRequires: gtk+2-devel >= 2.0}
-%{?with_gtk3:BuildRequires: gtk+3-devel >= 3.0}
+%{?with_gtk2:BuildRequires: gtk+2-devel >= 2.0}
+%{!?with_gtk2:BuildRequires: gtk+3-devel >= 3.0}
%{?with_java:BuildRequires: jdk}
BuildRequires: libjpeg-devel
BuildRequires: libstdc++-devel
BuildRequires: perl-devel >= 1:5.8.0
BuildRequires: pkgconfig
%{?with_npapi:BuildRequires: pkgconfig(mozilla-plugin)}
+%if %{with python2}
+BuildRequires: python-devel >= 1:2.7.0
+BuildRequires: python-pygtk-devel >= 2:2.0
+%endif
%if %{with python3}
BuildRequires: python3-devel >= 1:3.2
-%else
-BuildRequires: python-devel >= 1:2.7.0
-%{!?with_gtk3:BuildRequires: python-pygtk-devel >= 2:2.0}
%endif
BuildRequires: rpm-perlprov >= 4.1-13
BuildRequires: rpm-pythonprov
Group: X11/Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-gtk = %{version}-%{release}
-%{!?with_gtk3:Requires: gtk+2-devel >= 2.0}
-%{?with_gtk3:Requires: gtk+3-devel >= 3.0}
+%{?with_gtk2:Requires: gtk+2-devel >= 2.0}
+%{!?with_gtk2:Requires: gtk+3-devel >= 3.0}
%description gtk-devel
Header file for bar code scanning and decoding GTK+ widget.
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
+%patch4 -p1
%build
%{__libtoolize}
CXXFLAGS="%{rpmcxxflags} -std=c++11"
%configure \
--disable-silent-rules \
- %{?with_gtk3:--with-gtk=gtk3} \
+ %{?with_gtk2:--with-gtk=gtk2} \
%{!?with_java:--without-java} \
- %{?with_python3:--with-python=python3} \
+ --with-python=%{?with_python2:python2}%{?with_python3:python3}%{!?with_python2:%{!?with_python3:no}} \
%{!?with_qt:--without-qt} \
%{?with_qt4:--without-qt5} \
%{?with_npapi:--with-npapi}
# packaged as %doc
%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/zbar
+%if %{with python2}
+%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/*.la
+%endif
%if %{with python3}
%{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/*.la
-%else
-%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/*.la
%endif
%{__make} -C perl install \
%attr(755,root,root) %{perl_vendorarch}/auto/Barcode/ZBar/ZBar.so
%{_mandir}/man3/Barcode::ZBar*.3pm*
-%if %{without python3}
+%if %{with python2}
%files -n python-zbar
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/zbar.so
-%if %{without gtk3}
%files -n python-zbar-pygtk
%defattr(644,root,root,755)
%attr(755,root,root) %{py_sitedir}/zbarpygtk.so
%endif
-%endif
%if %{with python3}
%files -n python3-zbar