[packages/zxing-cpp] - adjust cmake target files install path (in cmake patch) - enabled opencv by default, added -opencv

qboosh qboosh at pld-linux.org
Sat Jun 19 11:08:44 CEST 2021


commit 8c2a4d1b1696d8ea34960b197935dda5c0c261fb
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Jun 19 11:11:41 2021 +0200

    - adjust cmake target files install path (in cmake patch)
    - enabled opencv by default, added -opencv-devel package

 zxing-cpp-cmake.patch | 18 ++++++++++++++++--
 zxing-cpp.spec        | 40 +++++++++++++++++++++++++++++++++-------
 2 files changed, 49 insertions(+), 9 deletions(-)
---
diff --git a/zxing-cpp.spec b/zxing-cpp.spec
index 916a2ac..49a25f2 100644
--- a/zxing-cpp.spec
+++ b/zxing-cpp.spec
@@ -1,6 +1,6 @@
 #
 # 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
@@ -18,7 +18,7 @@ Source0:	https://github.com/glassechidna/zxing-cpp/archive/%{gitref}/%{name}-%{s
 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)
@@ -54,6 +54,20 @@ OpenCV/ZXing based QR code recognizer.
 %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
@@ -73,10 +87,8 @@ rm -rf $RPM_BUILD_ROOT
 %{__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
@@ -96,7 +108,16 @@ 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
 
@@ -105,4 +126,9 @@ rm -rf $RPM_BUILD_ROOT
 %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
diff --git a/zxing-cpp-cmake.patch b/zxing-cpp-cmake.patch
index 4a7668e..caf9e34 100644
--- a/zxing-cpp-cmake.patch
+++ b/zxing-cpp-cmake.patch
@@ -1,5 +1,5 @@
 --- zxing-cpp-e0e40ddec63f38405aca5c8c1ff60b85ec8b1f10/CMakeLists.txt.orig	2019-03-20 14:52:05.000000000 +0100
-+++ zxing-cpp-e0e40ddec63f38405aca5c8c1ff60b85ec8b1f10/CMakeLists.txt	2021-06-19 09:59:00.886700396 +0200
++++ zxing-cpp-e0e40ddec63f38405aca5c8c1ff60b85ec8b1f10/CMakeLists.txt	2021-06-19 11:01:17.905319270 +0200
 @@ -44,21 +44,9 @@
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  endif()
@@ -58,7 +58,7 @@
  endif()
  
  # Add cli executable.
-@@ -88,9 +94,9 @@
+@@ -88,13 +94,13 @@
  target_link_libraries(zxing libzxing)
  
  install(TARGETS zxing libzxing EXPORT zxing-targets
@@ -70,3 +70,17 @@
      INCLUDES DESTINATION include
  )
  
+-install(EXPORT zxing-targets DESTINATION lib/zxing/cmake NAMESPACE zxing::)
++install(EXPORT zxing-targets DESTINATION lib${LIB_SUFFIX}/zxing/cmake NAMESPACE zxing::)
+ 
+ install(
+     DIRECTORY core/src/zxing/
+@@ -114,7 +120,7 @@
+ endif()
+ 
+ configure_file(cmake/zxing-config.cmake.in zxing-config.cmake @ONLY)
+-install(FILES ${CMAKE_BINARY_DIR}/zxing-config.cmake DESTINATION lib/zxing/cmake)
++install(FILES ${CMAKE_BINARY_DIR}/zxing-config.cmake DESTINATION lib${LIB_SUFFIX}/zxing/cmake)
+ 
+ if(BUILD_TESTING)
+     # Add testrunner executable.
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zxing-cpp.git/commitdiff/8c2a4d1b1696d8ea34960b197935dda5c0c261fb



More information about the pld-cvs-commit mailing list