From f4c4811a301237d822d1e7f16fece63abd0c232cd9d235a86942a16df1bdd679 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 9 Aug 2023 17:56:35 +0000 Subject: [PATCH] Accepting request 1103183 from LibreOffice:Factory Clean up and fix build on SLE15SP5 OBS-URL: https://build.opensuse.org/request/show/1103183 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/zxing-cpp?expand=0&rev=31 --- cmake.patch | 35 +++++++++++++++++++++++++++++++++++ zxing-cpp.changes | 9 +++++++++ zxing-cpp.spec | 20 ++++++++++++++++---- 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 cmake.patch diff --git a/cmake.patch b/cmake.patch new file mode 100644 index 0000000..52b8abc --- /dev/null +++ b/cmake.patch @@ -0,0 +1,35 @@ +--- zxing-cpp-2.0.0/CMakeLists.txt 2023-08-08 13:26:51.918694430 +0200 ++++ zxing-cpp-2.0.0/CMakeLists.txt 2023-08-08 13:38:00.669700216 +0200 +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.14) ++cmake_minimum_required (VERSION 3.5) + + project(ZXing) + +@@ -42,8 +42,7 @@ + set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + endif() + +-set (CMAKE_CXX_STANDARD 17) +-set (CMAKE_CXX_EXTENSIONS OFF) ++set (CMAKE_CXX_EXTENSIONS ON) + + if (NOT (BUILD_READERS OR BUILD_WRITERS)) + message(FATAL_ERROR "At least one of BUILD_READERS/BUILD_WRITERS must be enabled.") +--- zxing-cpp-2.0.0/core/CMakeLists.txt 2023-08-08 13:26:51.918694430 +0200 ++++ zxing-cpp-2.0.0/core/CMakeLists.txt 2023-08-08 13:32:23.494204854 +0200 +@@ -1,4 +1,4 @@ +-cmake_minimum_required (VERSION 3.14) ++cmake_minimum_required (VERSION 3.5) + + project (ZXing VERSION "2.0.0") + set (ZXING_SONAME 3) # see https://github.com/zxing-cpp/zxing-cpp/issues/333 +@@ -457,8 +457,6 @@ + ) + endif() + +-target_compile_features(ZXing PUBLIC cxx_std_17) +- + target_link_libraries (ZXing PRIVATE Threads::Threads) + + add_library(ZXing::ZXing ALIAS ZXing) diff --git a/zxing-cpp.changes b/zxing-cpp.changes index f426ead..6039edf 100644 --- a/zxing-cpp.changes +++ b/zxing-cpp.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Aug 9 15:07:38 UTC 2023 - Fridrich Strba + +- Restore support for building on SLE12 +- Build with gcc7-c++ or gcc-c++ >= 7 because of C++17 requirements +- Added patch: + * cmake.patch + + allow building with cmake 3.5 on SLE12SP5 + ------------------------------------------------------------------- Tue Apr 25 08:56:24 UTC 2023 - Frederic Crozat diff --git a/zxing-cpp.spec b/zxing-cpp.spec index b21d524..a6c0b10 100644 --- a/zxing-cpp.spec +++ b/zxing-cpp.spec @@ -26,10 +26,16 @@ Group: Development/Languages/C and C++ URL: https://github.com/nu-book/zxing-cpp/ Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz Source99: baselibs.conf - -BuildRequires: cmake >= 3.10 -BuildRequires: gcc-c++ +Patch1: cmake.patch +BuildRequires: cmake >= 3.5 BuildRequires: pkgconfig +%if 0%{?suse_version} < 1500 +BuildRequires: gcc7 +BuildRequires: gcc7-c++ +%else +BuildRequires: gcc >= 7 +BuildRequires: gcc-c++ >= 7 +%endif # only TW has fmt %if 0%{?suse_version} > 1500 # For blackbox tests @@ -65,6 +71,11 @@ other applications. %autosetup -p1 %build +%if 0%{?suse_version} < 1500 +export CC="gcc-7" +export CXX="g++-7" +%endif +export CXXFLAGS="-std=c++17" # Examples require QT5-base/multimedia, but doing so creates a cycle # Blackbox tests require fmt %cmake \ @@ -84,7 +95,8 @@ export LD_LIBRARY_PATH=%{buildroot}%{_libdir} %endif %ctest -%ldconfig_scriptlets -n libZXing%{sover} +%post -n libZXing%{sover} -p /sbin/ldconfig +%postun -n libZXing%{sover} -p /sbin/ldconfig %files -n libZXing%{sover} %doc README.md