commit 0aa887d3f7125fb94a7f41878b9056bc59c08345 Author: MSVSphere Packaging Team Date: Sun Dec 22 23:14:15 2024 +0300 import zxing-cpp-2.0.0-6.el10 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93806d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/zxing-cpp-2.0.0.tar.gz diff --git a/.zxing-cpp.metadata b/.zxing-cpp.metadata new file mode 100644 index 0000000..3c6a23e --- /dev/null +++ b/.zxing-cpp.metadata @@ -0,0 +1 @@ +2ab94270c20303f77883ddd67f7ea268312026f5 SOURCES/zxing-cpp-2.0.0.tar.gz diff --git a/SOURCES/README.md b/SOURCES/README.md new file mode 100644 index 0000000..624d15a --- /dev/null +++ b/SOURCES/README.md @@ -0,0 +1,3 @@ +# zxing-cpp + +The zxing-cpp package diff --git a/SOURCES/zxing-cpp-1.2.0-system-pybind11.patch b/SOURCES/zxing-cpp-1.2.0-system-pybind11.patch new file mode 100644 index 0000000..dfea017 --- /dev/null +++ b/SOURCES/zxing-cpp-1.2.0-system-pybind11.patch @@ -0,0 +1,37 @@ +diff -Naur zxing-cpp-1.2.0-original/wrappers/python/CMakeLists.txt zxing-cpp-1.2.0/wrappers/python/CMakeLists.txt +--- zxing-cpp-1.2.0-original/wrappers/python/CMakeLists.txt 2021-05-28 06:47:09.000000000 -0400 ++++ zxing-cpp-1.2.0/wrappers/python/CMakeLists.txt 2021-12-13 20:31:22.286170793 -0500 +@@ -1,8 +1,7 @@ + cmake_minimum_required(VERSION 3.14) + project(ZXingPython) + +-set (pybind11_git_repo https://github.com/pybind/pybind11.git) +-set (pybind11_git_rev v2.10.2) ++find_package(pybind11) + + # check if we are called from the top-level ZXing project + get_directory_property(hasParent PARENT_DIRECTORY) +@@ -21,14 +20,8 @@ + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../core ZXing EXCLUDE_FROM_ALL) + + include(${CMAKE_CURRENT_SOURCE_DIR}/../../zxing.cmake) +- zxing_add_package(pybind11 pybind11 ${pybind11_git_repo} ${pybind11_git_rev}) + else() + # we don't have access to the top-level cmake helpers -> simply fetch it unconditional +- include(FetchContent) +- FetchContent_Declare (pybind11 +- GIT_REPOSITORY ${pybind11_git_repo} +- GIT_TAG ${pybind11_git_rev}) +- FetchContent_MakeAvailable (pybind11) + + # Building from python source distribution (which does not include the whole repository but only python part) + # so we need to get c++ source git to build the python extension. The python distribution version (given in +@@ -54,8 +47,6 @@ + add_subdirectory(${zxing-cpp_SOURCE_DIR}/core ZXing EXCLUDE_FROM_ALL) + endif() + endif() +-else() +- zxing_add_package(pybind11 pybind11 ${pybind11_git_repo} ${pybind11_git_rev}) + endif() + + # build the python module diff --git a/SPECS/zxing-cpp.spec b/SPECS/zxing-cpp.spec new file mode 100644 index 0000000..83c1d31 --- /dev/null +++ b/SPECS/zxing-cpp.spec @@ -0,0 +1,160 @@ +Name: zxing-cpp +Version: 2.0.0 +Release: 6%{?dist} +Summary: C++ port of the ZXing ("Zebra Crossing") barcode scanning library + +# The entire source is ASL 2.0, except: +# - wrappers/wasm/base64ArrayBuffer.js is MIT (but is not used) +License: Apache-2.0 AND MIT +Url: https://github.com/nu-book/zxing-cpp +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: gcc-c++ +BuildRequires: cmake +BuildRequires: cmake(fmt) +# Use the system copy of pybind11 rather than trying to download a copy. This +# patch is unconditional, so it is not, as-is, suitable for sending upstream. +Patch0: zxing-cpp-1.2.0-system-pybind11.patch + +%description +ZXing-C++ ("zebra crossing") is an open-source, multi-format 1D/2D barcode +image processing library implemented in C++. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%package -n python3-%{name} +Summary: Python bindings for the %{name} barcode library + +BuildRequires: python3-devel +BuildRequires: pybind11-devel +BuildRequires: chrpath + +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description -n python3-%{name} +%{summary}. + +%prep +%autosetup -p1 + +# don’t use unversioned “python” interpreter in tests +sed -r -i 's@(COMMAND )python@\1%{python3}@' wrappers/python/CMakeLists.txt +# we don’t need cmake as a python dependency +sed -r -i '/cmake/d' wrappers/python/pyproject.toml +# build verbosely: + +%generate_buildrequires +pushd wrappers/python &>/dev/null +%pyproject_buildrequires -r +popd &>/dev/null + +%build +# Setting BUILD_PYTHON_MODULE builds a Python extension shared library module, +# but we don’t get any metadata (dist-info), so it’s not terribly useful for +# packaging purposes. Instead, it seems we must re-build the whole library +# through setuptools to get that. +# CMAKE_BUILD_TYPE=RelWithDebInfo prevents the build from stripping the +# python module after it is built. The stripping happens in +# pybind11_add_module. +%cmake -DBUILD_EXAMPLES=OFF -DBUILD_PYTHON_MODULE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo +%cmake_build +pushd wrappers/python +# CMake respects this environment variable. We need to see the compiler +# invocations to verify the distro build flags are respected. Unfortunately, +# pybind11 does add -O3, and there doesn’t seem to be a way to turn that off. +# It’s a global pybind11 decision, not something in this package’s sources. +export VERBOSE=1 +%pyproject_wheel +popd + +%install +%cmake_install +pushd wrappers/python +%pyproject_install +# Now we do something sneaky: we substitute the Python extension that was built +# in the original CMake invocation, replacing the one built with setuptools. It +# is dynamically linked against the main libZXing.so, which makes it smaller, +# and it was not built with that pesky -O3 that was added by pybind11, so it +# better complies with packaging guidelines. The only problem is it contains an +# rpath that we need to remove. +popd +install -t '%{buildroot}%{python3_sitearch}' -p \ + %{_vpath_builddir}/wrappers/python/zxingcpp.*.so +chrpath --delete %{buildroot}%{python3_sitearch}/zxingcpp.*.so +pushd wrappers/python +%pyproject_save_files zxingcpp +popd + +%check +%ctest + +%files +%license LICENSE +%{_libdir}/libZXing.so.3 +%{_libdir}/libZXing.so.%{version} + +%files devel +%doc README.md +%{_includedir}/ZXing/ +%{_libdir}/libZXing.so +%{_libdir}/cmake/ZXing/ +%{_libdir}/pkgconfig/zxing.pc + +%files -n python3-%{name} -f %{pyproject_files} +%{_libdir}/zxingcpp%{python3_ext_suffix} + +%changelog +* Sun Dec 22 2024 MSVSphere Packaging Team - 2.0.0-6 +- Rebuilt for MSVSphere 10 + +* Sat Jan 27 2024 Fedora Release Engineering - 2.0.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jul 22 2023 Fedora Release Engineering - 2.0.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Sat Jul 01 2023 Python Maint - 2.0.0-4 +- Rebuilt for Python 3.12 + +* Wed Jun 28 2023 Vitaly Zaitsev - 2.0.0-3 +- Rebuilt due to fmt 10 update. + +* Tue Jun 13 2023 Python Maint - 2.0.0-2 +- Rebuilt for Python 3.12 + +* Fri Feb 24 2023 Caolán McNamara 2.0.0-1 +- latest release +- migrated to SPDX license + +* Sat Jan 21 2023 Fedora Release Engineering - 1.2.0-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Oct 26 2022 Tom Stellard - 1.2.0-8 +- Prevent stripping of python module + +* Tue Aug 02 2022 Caolán McNamara 1.2.0-7 +- Resolves: rhbz#2113772 FTBFS in Fedora rawhide/f37 + +* Sat Jul 23 2022 Fedora Release Engineering - 1.2.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 1.2.0-5 +- Rebuilt for Python 3.11 + +* Sat Apr 23 2022 Benjamin A. Beasley - 1.2.0-4 +- Security fix for CVE-2022-28041 + +* Sat Jan 22 2022 Fedora Release Engineering - 1.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Tue Dec 14 2021 Caolán McNamara 1.2.0-2 +- build python bindings + +* Fri Dec 10 2021 Caolán McNamara 1.2.0-1 +- initial import