#
# Conditional build:
-%bcond_with opencv # OpenCV interface
+%bcond_without opencv # OpenCV interface
%define rel 1
Summary: C++ port of ZXing - 1D/2D barcode image processing library
Patch0: %{name}-cmake.patch
Patch1: no-opencv.patch
URL: https://github.com/glassechidna/zxing-cpp
-BuildRequires: cmake >= 2.8.0
+BuildRequires: cmake >= 3.0
BuildRequires: libstdc++-devel >= 6:4.7
%{?with_opencv:BuildRequires: opencv-devel >= 2}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description opencv -l pl.UTF-8
Program do rozpoznawania kodów QR oparty na bibliotekach OpenCV/ZXing.
+%package opencv-devel
+Summary: Header file for ZXing OpenCV library
+Summary(pl.UTF-8): Plik nagłówkowy biblioteki ZXing OpenCV
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+Requires: %{name}-opencv = %{version}-%{release}
+Requires: opencv-devel >= 2
+
+%description opencv-devel
+Header file for ZXing OpenCV library.
+
+%description opencv-devel -l pl.UTF-8
+Plik nagłówkowy biblioteki ZXing OpenCV.
+
%prep
%setup -q -n %{name}-%{gitref}
%patch0 -p1
%{__make} -C build install \
DESTDIR=$RPM_BUILD_ROOT
-%if %{with opencv}
-# API (opencv/src/zxing/MatSource.h) not installed
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libzxing-cv.so
-%endif
+# disable completeness check incompatible with split packaging
+%{__sed} -i -e '/^foreach(target .*IMPORT_CHECK_TARGETS/,/^endforeach/d; /^unset(_IMPORT_CHECK_TARGETS)/d' $RPM_BUILD_ROOT%{_libdir}/zxing/cmake/zxing-targets.cmake
%clean
rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libzxing.so
-%{_includedir}/zxing
+%dir %{_includedir}/zxing
+%{_includedir}/zxing/aztec
+%{_includedir}/zxing/common
+%{_includedir}/zxing/datamatrix
+%{_includedir}/zxing/multi
+%{_includedir}/zxing/oned
+%{_includedir}/zxing/pdf417
+%{_includedir}/zxing/qrcode
+%{_includedir}/zxing/[!M]*.h
+%{_includedir}/zxing/MultiFormatReader.h
%dir %{_libdir}/zxing
%{_libdir}/zxing/cmake
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/zxing-cv
%attr(755,root,root) %{_libdir}/libzxing-cv.so.0
+
+%files opencv-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libzxing-cv.so
+%{_includedir}/zxing/MatSource.h
%endif