summaryrefslogtreecommitdiff
path: root/zxing-cpp.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-09-13 11:01:54 +0000
committerCoprDistGit <infra@openeuler.org>2023-09-13 11:01:54 +0000
commit37369853c01c77b8dd73a1bfd558c04da9d1b56d (patch)
tree796db1bf4adfb7ba9ef1e5236504ab00f5e7cddf /zxing-cpp.spec
parent9f817a58d7073dca2818435a78a59fdbf6509f53 (diff)
automatic import of zxing-cpp
Diffstat (limited to 'zxing-cpp.spec')
-rw-r--r--zxing-cpp.spec100
1 files changed, 100 insertions, 0 deletions
diff --git a/zxing-cpp.spec b/zxing-cpp.spec
new file mode 100644
index 0000000..d49a9ac
--- /dev/null
+++ b/zxing-cpp.spec
@@ -0,0 +1,100 @@
+Name: zxing-cpp
+Version: 1.2.0
+Release: 1
+Summary: C++ port of the ZXing ("Zebra Crossing") barcode scanning library
+
+License: LGPLv2 with exceptions or LGPLv3 with exceptions
+Url: https://github.com/nu-book/zxing-cpp
+Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+
+BuildRequires: gcc-c++ cmake cmake(fmt)
+BuildRequires: stb_image-devel >= 2.27^20210910gitaf1a5bc-0.2
+BuildRequires: stb_image-static stb_image_write-devel stb_image_write-static
+# https://github.com/nu-book/zxing-cpp/issues/248
+Patch0: 0001-Add-a-mode-to-build-against-system-versions-of-depen.patch
+# Update stb_image/stb_image_write
+# https://github.com/nu-book/zxing-cpp/pull/269
+Patch1: %{url}/pull/269.patch
+# 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.
+Patch2: zxing-cpp-1.2.0-system-pybind11.patch
+# fix for recent libfmt
+Patch3: 0001-test-update-to-libfmt-v9.0.0.patch
+# fix for gcc 13
+Patch4: 0001-include-cstdint.patch
+
+%description
+ZXing-C++ ("zebra crossing") is an open-source, multi-format 1D/2D barcode
+image processing library implemented in C++.
+
+%package devel
+License: ASL 2.0 and (LGPLv2 with exceptions or LGPLv3 with exceptions)
+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 python3-pip python3-hatchling python3-hatch-vcs python3-wheel
+BuildRequires: pybind11-devel cmake chrpath
+
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description -n python3-%{name}
+%{summary}.
+
+%prep
+%autosetup -p1
+# remove bundled stb libraries:
+rm -v thirdparty/stb/stb_image_write.h thirdparty/stb/stb_image.h
+# stb_image.h is trivially forked: reconstruct the changes with the latest
+# unbundled copy
+cp -p /usr/include/stb/stb_image.h thirdparty/stb/
+pushd thirdparty/stb
+patch -p1 < stb_image.patch
+popd
+
+# don’t use unversioned “python” interpreter in tests
+sed -r -i 's@(COMMAND )python@\1%{python3}@' wrappers/python/CMakeLists.txt
+
+%build
+%cmake -DBUILD_EXAMPLES=OFF -DBUILD_PYTHON_MODULE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
+%make_build
+pushd wrappers/python
+export VERBOSE=1
+%pyproject_build
+popd
+
+%install
+%make_install
+pushd wrappers/python
+%pyproject_install
+popd
+install -t '%{buildroot}%{python3_sitearch}' -p \
+ wrappers/python/zxingcpp.*.so
+chrpath --delete %{buildroot}%{python3_sitearch}/zxingcpp.*.so
+
+%check
+
+%files
+%license LICENSE LICENSE.ZXing LICENSE.Qt LGPL_EXCEPTION.Qt NOTICE
+%{_libdir}/libZXing.so.1
+%{_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}
+%{python3_sitearch}/*
+
+%changelog
+* Wed Sep 06 2023 Darssin <2020303249@mail.nwpu.edu.cn> - 1.2.0-1
+- Package init