Accepting request 704079 from home:luca_b:zxing
New package: zxing-cpp, a C++ port of the Java ZXing library This will be required by some KDE packages (kitinerary) to provide barcode processing. NOTE: there are multiple forks of this library around. This one is at least officially sanctioned by the original ZXing developers, provides proper library versioning (after some poking upstream) and has actual releases. This is also the one required by the KDE package mentioned above. See https://github.com/nu-book/zxing-cpp/issues/44 for details. OBS-URL: https://build.opensuse.org/request/show/704079 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/zxing-cpp?expand=0&rev=1
This commit is contained in:
commit
b18c9a8d13
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
235
fix-library-installation-and-versioning.patch
Normal file
235
fix-library-installation-and-versioning.patch
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
From 26fd669538f7c77bad1057b75e06184420ec0269 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Huy Cuong Nguyen <huycn@users.noreply.github.com>
|
||||||
|
Date: Sun, 19 May 2019 10:21:03 -0400
|
||||||
|
Subject: [PATCH] Fixes #70 and fixes #71; shared library with version number
|
||||||
|
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 77 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
core/CMakeLists.txt | 69 +++++++++++++---------------------------
|
||||||
|
core/ZXVersion.h.in | 21 +++++++++++++
|
||||||
|
core/src/ZXConfig.h | 5 ---
|
||||||
|
4 files changed, 119 insertions(+), 53 deletions(-)
|
||||||
|
create mode 100644 core/ZXVersion.h.in
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index b8b00bf..4e38433 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -1,2 +1,77 @@
|
||||||
|
cmake_minimum_required (VERSION 3.1.3)
|
||||||
|
-add_subdirectory(core)
|
||||||
|
+
|
||||||
|
+set (ZXING_VERSION_MAJOR 1)
|
||||||
|
+set (ZXING_VERSION_MINOR 0)
|
||||||
|
+set (ZXING_VERSION_PATCH 5)
|
||||||
|
+
|
||||||
|
+project (ZXingCpp VERSION ${ZXING_VERSION_MAJOR}.${ZXING_VERSION_MINOR}.${ZXING_VERSION_PATCH})
|
||||||
|
+
|
||||||
|
+set (ENABLE_ENCODERS ON CACHE BOOL "Check to include encoders")
|
||||||
|
+set (ENABLE_DECODERS ON CACHE BOOL "Check to include decoders")
|
||||||
|
+set (LINK_CPP_STATICALLY OFF CACHE BOOL "MSVC only, check to link statically standard library (/MT and /MTd)")
|
||||||
|
+set (BUILD_SHARED_LIBRARY OFF CACHE BOOL "Check to build ZXingCore as shared library")
|
||||||
|
+
|
||||||
|
+add_definitions (-DUNICODE -D_UNICODE)
|
||||||
|
+
|
||||||
|
+if (MSVC)
|
||||||
|
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GS-")
|
||||||
|
+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GS-")
|
||||||
|
+ if (LINK_CPP_STATICALLY)
|
||||||
|
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||||
|
+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||||
|
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
|
||||||
|
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||||
|
+ endif()
|
||||||
|
+else()
|
||||||
|
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||||
|
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
+set (DEFAULT_BUILD_TYPE "Release")
|
||||||
|
+
|
||||||
|
+if (NOT CMAKE_BUILD_TYPE)
|
||||||
|
+ message (STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
|
||||||
|
+ set (CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
+ set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
+add_subdirectory (core)
|
||||||
|
+
|
||||||
|
+set_target_properties (ZXingCore PROPERTIES VERSION ${PROJECT_VERSION})
|
||||||
|
+set_target_properties (ZXingCore PROPERTIES SOVERSION ${ZXING_VERSION_MAJOR})
|
||||||
|
+
|
||||||
|
+set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/ZXing")
|
||||||
|
+
|
||||||
|
+install (
|
||||||
|
+ EXPORT ZXingTargets
|
||||||
|
+ DESTINATION ${CMAKECONFIG_INSTALL_DIR} NAMESPACE ZXing::
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+install (
|
||||||
|
+ DIRECTORY core/src/
|
||||||
|
+ DESTINATION include/ZXing
|
||||||
|
+ FILES_MATCHING PATTERN "*.h"
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+configure_file (
|
||||||
|
+ core/ZXVersion.h.in
|
||||||
|
+ ZXVersion.h
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+install (
|
||||||
|
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/ZXVersion.h"
|
||||||
|
+ DESTINATION include/ZXing
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+include (CMakePackageConfigHelpers)
|
||||||
|
+
|
||||||
|
+configure_package_config_file (
|
||||||
|
+ core/ZXingConfig.cmake.in
|
||||||
|
+ ZXingConfig.cmake
|
||||||
|
+ INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
|
||||||
|
+)
|
||||||
|
+
|
||||||
|
+install (
|
||||||
|
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/ZXingConfig.cmake"
|
||||||
|
+ DESTINATION ${CMAKECONFIG_INSTALL_DIR}
|
||||||
|
+)
|
||||||
|
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
|
||||||
|
index d566843..d383b12 100644
|
||||||
|
--- a/core/CMakeLists.txt
|
||||||
|
+++ b/core/CMakeLists.txt
|
||||||
|
@@ -1,32 +1,5 @@
|
||||||
|
cmake_minimum_required (VERSION 3.1.3)
|
||||||
|
|
||||||
|
-if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
- # this is the top level project
|
||||||
|
- project (ZXingCpp)
|
||||||
|
-
|
||||||
|
- set (ENABLE_ENCODERS OFF CACHE BOOL "Check to include encoders")
|
||||||
|
- set (ENABLE_DECODERS ON CACHE BOOL "Check to include decoders")
|
||||||
|
- set (LINK_CPP_STATICALLY OFF CACHE BOOL "MSVC only, check to link statically standard library (/MT and /MTd)")
|
||||||
|
- set (BUILD_SHARED_LIBRARY OFF CACHE BOOL "Check to build ZXingCore as shared library")
|
||||||
|
-
|
||||||
|
- add_definitions (-DUNICODE -D_UNICODE)
|
||||||
|
-
|
||||||
|
- if (MSVC)
|
||||||
|
- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GS-")
|
||||||
|
- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GS-")
|
||||||
|
- if (LINK_CPP_STATICALLY)
|
||||||
|
- set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||||
|
- set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||||
|
- set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
|
||||||
|
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||||
|
- endif()
|
||||||
|
- else()
|
||||||
|
- set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||||
|
- set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||||
|
- endif()
|
||||||
|
-
|
||||||
|
-endif()
|
||||||
|
-
|
||||||
|
if (NOT DEFINED ENABLE_ENCODERS)
|
||||||
|
set (ENABLE_ENCODERS OFF)
|
||||||
|
endif()
|
||||||
|
@@ -473,14 +446,24 @@ target_compile_options (ZXingCore
|
||||||
|
PRIVATE ${ZXING_CORE_LOCAL_DEFINES}
|
||||||
|
)
|
||||||
|
|
||||||
|
-if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||||
|
- target_compile_options (ZXingCore PRIVATE
|
||||||
|
+include (CheckCXXCompilerFlag)
|
||||||
|
+
|
||||||
|
+CHECK_CXX_COMPILER_FLAG ("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||||
|
+if (COMPILER_SUPPORTS_CXX11)
|
||||||
|
+ target_compile_options(ZXingCore PRIVATE
|
||||||
|
-std=c++11
|
||||||
|
+ )
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
+CHECK_CXX_COMPILER_FLAG ("-ffloat-store" COMPILER_NEEDS_FLOAT_STORE)
|
||||||
|
+if (COMPILER_NEEDS_FLOAT_STORE)
|
||||||
|
+ target_compile_options(ZXingCore PRIVATE
|
||||||
|
-ffloat-store # same floating point precision in all optimization levels
|
||||||
|
)
|
||||||
|
-elseif (APPLE)
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
+if (APPLE)
|
||||||
|
target_compile_options (ZXingCore PRIVATE
|
||||||
|
- -std=c++11
|
||||||
|
-stdlib=libc++
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
@@ -490,21 +473,13 @@ target_link_libraries (ZXingCore PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
add_library(ZXing::Core ALIAS ZXingCore)
|
||||||
|
set_target_properties(ZXingCore PROPERTIES EXPORT_NAME Core)
|
||||||
|
|
||||||
|
-set(CMAKECONFIG_INSTALL_DIR "lib/cmake/ZXing")
|
||||||
|
-install(TARGETS ZXingCore EXPORT ZXingTargets
|
||||||
|
- LIBRARY DESTINATION lib
|
||||||
|
- RUNTIME DESTINATION bin
|
||||||
|
- ARCHIVE DESTINATION lib
|
||||||
|
- INCLUDES DESTINATION include
|
||||||
|
-)
|
||||||
|
-install(EXPORT ZXingTargets DESTINATION ${CMAKECONFIG_INSTALL_DIR} NAMESPACE ZXing::)
|
||||||
|
+include (GNUInstallDirs)
|
||||||
|
|
||||||
|
-install(
|
||||||
|
- DIRECTORY src/
|
||||||
|
- DESTINATION include/ZXing
|
||||||
|
- FILES_MATCHING PATTERN "*.h"
|
||||||
|
+# Once we can require cmake 1.13, then we can move this to ../CMakeLists.txt, see: https://gitlab.kitware.com/cmake/cmake/merge_requests/2152
|
||||||
|
+install (
|
||||||
|
+ TARGETS ZXingCore EXPORT ZXingTargets
|
||||||
|
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
+ INCLUDES DESTINATION include
|
||||||
|
)
|
||||||
|
-
|
||||||
|
-include(CMakePackageConfigHelpers)
|
||||||
|
-configure_package_config_file(ZXingConfig.cmake.in ZXingConfig.cmake INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
|
||||||
|
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ZXingConfig.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR})
|
||||||
|
diff --git a/core/ZXVersion.h.in b/core/ZXVersion.h.in
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..7846d20
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/core/ZXVersion.h.in
|
||||||
|
@@ -0,0 +1,21 @@
|
||||||
|
+#pragma once
|
||||||
|
+/*
|
||||||
|
+* Copyright 2019 Nu-book Inc.
|
||||||
|
+*
|
||||||
|
+* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
+* you may not use this file except in compliance with the License.
|
||||||
|
+* You may obtain a copy of the License at
|
||||||
|
+*
|
||||||
|
+* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
+*
|
||||||
|
+* Unless required by applicable law or agreed to in writing, software
|
||||||
|
+* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
+* See the License for the specific language governing permissions and
|
||||||
|
+* limitations under the License.
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+// Version numbering
|
||||||
|
+#define ZXING_VERSION_MAJOR @ZXING_VERSION_MAJOR@
|
||||||
|
+#define ZXING_VERSION_MINOR @ZXING_VERSION_MINOR@
|
||||||
|
+#define ZXING_VERSION_PATCH @ZXING_VERSION_PATCH@
|
||||||
|
diff --git a/core/src/ZXConfig.h b/core/src/ZXConfig.h
|
||||||
|
index 34918d1..62cad97 100644
|
||||||
|
--- a/core/src/ZXConfig.h
|
||||||
|
+++ b/core/src/ZXConfig.h
|
||||||
|
@@ -21,11 +21,6 @@
|
||||||
|
|
||||||
|
#define ZX_HAVE_CONFIG
|
||||||
|
|
||||||
|
-// Version numbering
|
||||||
|
-#define ZXING_VERSION_MAJOR 1
|
||||||
|
-#define ZXING_VERSION_MINOR 0
|
||||||
|
-#define ZXING_VERSION_PATCH 5
|
||||||
|
-
|
||||||
|
#if !__has_attribute(cxx_rtti) && !defined(__RTTI) && !defined(_CPPRTTI) && !defined(__GXX_RTTI) && !defined(__INTEL_RTTI__)
|
||||||
|
#define ZX_NO_RTTI
|
||||||
|
#endif
|
3
zxing-cpp-1.0.5.tar.gz
Normal file
3
zxing-cpp-1.0.5.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:65bf1e7c45cc5330f8e399b6cff5a3e4e9190ce6fe389b9cc5c8fc180838c60a
|
||||||
|
size 128809943
|
7
zxing-cpp.changes
Normal file
7
zxing-cpp.changes
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri May 17 05:22:57 UTC 2019 - Luca Beltrame <lbeltrame@kde.org>
|
||||||
|
|
||||||
|
- Initial package for openSUSE
|
||||||
|
- Add upstream patch to add proper installability and library
|
||||||
|
versioning:
|
||||||
|
* fix-library-installation-and-versioning.patch
|
80
zxing-cpp.spec
Normal file
80
zxing-cpp.spec
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#
|
||||||
|
# spec file for package zxing-cpp
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define sover 1
|
||||||
|
Name: zxing-cpp
|
||||||
|
Version: 1.0.5
|
||||||
|
Release: 0
|
||||||
|
Summary: Library for processing 1D and 2D barcodes
|
||||||
|
License: Apache-2.0 AND Zlib AND LGPL-2.1-with-Qt-Company-Qt-exception-1.1
|
||||||
|
Group: Development/Languages/C and C++
|
||||||
|
URL: https://github.com/nu-book/zxing-cpp/releases/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
|
Source0: %{name}-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM
|
||||||
|
Patch1: fix-library-installation-and-versioning.patch
|
||||||
|
BuildRequires: cmake
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
|
||||||
|
%description
|
||||||
|
ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image
|
||||||
|
processing library. This package provides a C++ implementation.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%cmake -DBUILD_SHARED_LIBRARY=ON
|
||||||
|
%make_jobs
|
||||||
|
|
||||||
|
%install
|
||||||
|
%cmake_install
|
||||||
|
|
||||||
|
%package -n libZXingCore%{sover}
|
||||||
|
Summary: Library for processing 1D and 2D barcodes
|
||||||
|
Group: System/Libraries
|
||||||
|
|
||||||
|
%description -n libZXingCore%{sover}
|
||||||
|
ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image
|
||||||
|
processing library. This package provides a C++ implementation.
|
||||||
|
|
||||||
|
%post -n libZXingCore%{sover} -p /sbin/ldconfig
|
||||||
|
%postun -n libZXingCore%{sover} -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%files -n libZXingCore%{sover}
|
||||||
|
%doc README.md
|
||||||
|
%license LICENSE.*
|
||||||
|
%{_libdir}/libZXingCore.so.%{sover}
|
||||||
|
%{_libdir}/libZXingCore.so.%{sover}.*
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Header files for zxing, a library for processing 1D and 2D barcodes
|
||||||
|
Group: Development/Languages/C and C++
|
||||||
|
Requires: libZXingCore%{sover} = %{version}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image
|
||||||
|
processing library. This package provides header files to use ZXing in
|
||||||
|
other applications.
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%license LICENSE.*
|
||||||
|
%{_includedir}/ZXing/
|
||||||
|
%{_libdir}/cmake/ZXing/
|
||||||
|
%{_libdir}/libZXingCore.so
|
||||||
|
|
||||||
|
%changelog
|
Loading…
Reference in New Issue
Block a user