This commit is contained in:
QwQ 2022-11-09 07:26:40 +00:00
parent 776c4184a0
commit b0cf172557
5 changed files with 174 additions and 34 deletions

35
py311.patch Normal file
View File

@ -0,0 +1,35 @@
--- python/enum.c~ 2022-01-12 10:07:02.151116991 -0600
+++ python/enum.c 2022-01-12 10:14:04.093001534 -0600
@@ -23,6 +23,12 @@
#include "zbarmodule.h"
+#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)
+static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)
+{ ob->ob_size = size; }
+#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)
+#endif
+
static char enumitem_doc[] = PyDoc_STR(
"simple enumeration item.\n"
"\n"
--- python/enum.c~ 2022-01-12 10:16:29.670271662 -0600
+++ python/enum.c 2022-01-12 10:52:11.671258442 -0600
@@ -58,7 +58,7 @@
/* we assume the "fast path" for a single-digit ints (see longobject.c) */
/* this also holds if we get a small_int preallocated long */
- Py_SIZE(&self->val) = Py_SIZE(longval);
+ Py_SET_SIZE(&self->val, longval);
self->val.ob_digit[0] = longval->ob_digit[0];
Py_DECREF(longval);
#else
@@ -148,7 +148,7 @@
/* we assume the "fast path" for a single-digit ints (see longobject.c) */
/* this also holds if we get a small_int preallocated long */
- Py_SIZE(&self->val) = Py_SIZE(longval);
+ Py_SET_SIZE(&self->val, longval);
self->val.ob_digit[0] = longval->ob_digit[0];
Py_DECREF(longval);

View File

@ -0,0 +1,10 @@
diff --git a/test/test_python.py b/test/test_python.py
index 252c51a97256..8388d9a5aa36 100755
--- a/test/test_python.py
+++ b/test/test_python.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#------------------------------------------------------------------------
# Copyright 2019 (c) Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
#

Binary file not shown.

BIN
zbar-0.23.90.tar.bz2 Normal file

Binary file not shown.

163
zbar.spec
View File

@ -1,93 +1,171 @@
%ifarch %{java_arches}
%global JAVA 1
%else
%global JAVA 0
%endif
Name: zbar Name: zbar
Version: 0.22 Version: 0.23.90
Release: 2 Release: 1
Summary: Bar code reader Summary: Bar code reader
License: LGPLv2+ License: LGPLv2+
URL: http://zbar.sourceforge.net/ URL: https://zbar.sourceforge.net/
Source0: https://linuxtv.org/downloads/zbar/zbar-%{version}.tar.bz2 Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2
Patch0: use_python3_on_python_script.patch
Patch1: py311.patch
BuildRequires: autoconf automake libtool gettext-devel BuildRequires: autoconf
BuildRequires: qt5-qtbase-devel qt5-qtx11extras-devel gtk2-devel GraphicsMagick-c++-devel BuildRequires: automake
BuildRequires: libv4l-devel libXv-devel xmlto dbus-devel BuildRequires: dbus-devel
BuildRequires: gettext-devel
BuildRequires: GraphicsMagick-devel
BuildRequires: gtk3-devel
BuildRequires: libSM-devel
BuildRequires: libtool
BuildRequires: libv4l-devel
BuildRequires: libXv-devel
BuildRequires: make
BuildRequires: pygobject3-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtx11extras-devel
BuildRequires: xmlto
%if %{JAVA}
BuildRequires: java-11-openjdk-devel
%endif
BuildRequires: python3-devel
%description %description
A layered bar code scanning and decoding library. Supports EAN, UPC, Code 128, ZBar Bar Code Reader is an open source software suite for reading bar
Code 39 and Interleaved 2 of 5. codes from various sources, such as video streams, image files and raw
Includes applications for decoding captured bar code images and using a video intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128,
device (e. g., webcam) as a bar code scanner. Code 93, Code 39, Codabar, Interleaved 2 of 5, QR Code and SQ Code.
%package devel %package devel
Summary: Bar code library extra development files Summary: Bar code reader library extra development files
Requires: pkgconfig, zbar = %{version}-%{release} Requires: %{name}-libs%{_isa} = %{version}-%{release}
%description devel %description devel
This package contains header files and additional libraries used for This package contains header files and additional libraries used for
developing applications that read bar codes with this library. developing applications that read bar codes with this library.
%package libs
Summary: Bar code reader library
%description libs
This package contains the ZBar Bar Code Reader library.
%package gtk %package gtk
Summary: Bar code reader GTK widget Summary: Bar code reader GTK widget
Requires: zbar = %{version}-%{release} Requires: %{name}-libs%{_isa} = %{version}-%{release}
# Obsoleted in F37
Obsoletes: %{name}-gi < %{version}-%{release}
%description gtk %description gtk
This package contains a bar code scanning widget for use with GUI This package contains a bar code scanning widget for use with GUI
applications based on GTK+-2.0. applications based on GTK 3.
%package gtk-devel %package gtk-devel
Summary: Bar code reader GTK widget extra development files Summary: Bar code reader GTK widget extra development files
Requires: pkgconfig, zbar-gtk = %{version}-%{release}, zbar-devel = %{version}-%{release} Requires: %{name}-devel%{_isa} = %{version}-%{release}
Requires: %{name}-gtk%{_isa} = %{version}-%{release}
%description gtk-devel %description gtk-devel
This package contains header files and additional libraries used for This package contains header files and additional libraries used for
developing GUI applications based on GTK+-2.0 that include a bar code developing GUI applications based on GTK 3 that include a bar code
scanning widget. scanning widget.
%package qt %package qt
Summary: Bar code reader Qt widget Summary: Bar code reader Qt widget
Requires: zbar = %{version}-%{release} Requires: %{name}-libs%{_isa} = %{version}-%{release}
%description qt %description qt
This package contains a bar code scanning widget for use with GUI This package contains a bar code scanning widget for use with GUI
applications based on Qt4. applications based on Qt4.
%package qt-devel %package qt-devel
Summary: Bar code reader Qt widget extra development files Summary: Bar code reader Qt widget extra development files
Requires: pkgconfig, zbar-qt = %{version}-%{release}, zbar-devel = %{version}-%{release} Requires: %{name}-devel%{_isa} = %{version}-%{release}
Requires: %{name}-qt%{_isa} = %{version}-%{release}
%description qt-devel %description qt-devel
This package contains header files and additional libraries used for This package contains header files and additional libraries used for
developing GUI applications based on Qt4 that include a bar code developing GUI applications based on Qt5 that include a bar code
scanning widget. scanning widget.
%package -n python3-zbar
Summary: Bar code reader PyGTK widget
Requires: %{name}-libs%{_isa} = %{version}-%{release}
Requires: python3-pillow
# Renamed in F37
Obsoletes: %{name}-python3 < %{version}-%{release}
%description -n python3-zbar
This package contains a bar code scanning widget for use on
python applications that work with images.
%if %{JAVA}
%package java
Summary: Bar code reader Java library
Requires: %{name}-devel%{_isa} = %{version}-%{release}
Requires: %{name}-gtk%{_isa} = %{version}-%{release}
%description java
This package contains header files and additional libraries used for
on Java Native Interface (JNI) applications using ZBar.
%endif
%prep %prep
%setup -q %setup -q
%patch0 -p1
%patch1 -p0
%build %build
%configure --without-java --with-graphicsmagick --without-python2 --docdir=%{_docdir}/zbar-%{version} %configure --with-python=python3 --with-gtk=auto --docdir=%{_docdir}/%{name}-%{version} --with-graphicsmagick --without-xshm --without-xv --enable-codes=ean,databar,code128,code93,code39,codabar,i25,qrcode,sqcode,pdf417
# rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}
%make_build
%install %install
rm -rf $RPM_BUILD_ROOT %make_install
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" %if %{JAVA}
install -d %{buildroot}%{_jnidir}
mv %{buildroot}%{_datadir}/zbar/lib/zbar.jar %{buildroot}%{_jnidir}
mv %{buildroot}%{_datadir}/zbar/lib/libzbarjni.so* %{buildroot}%{_libdir}
%endif
cp test/test_python.py %{buildroot}%{_docdir}
#Remove .la and .a files
find ${RPM_BUILD_ROOT} -name '*.la' -or -name '*.a' | xargs rm -f find ${RPM_BUILD_ROOT} -name '*.la' -or -name '*.a' | xargs rm -f
# Remove installed doc
rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/ rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/
%ldconfig_scriptlets %ldconfig_scriptlets
%ldconfig_scriptlets devel %ldconfig_scriptlets devel
%ldconfig_scriptlets gtk %ldconfig_scriptlets gtk
%ldconfig_scriptlets qt %ldconfig_scriptlets qt
%find_lang zbar
%files %files
%doc NEWS README.md INSTALL.md %doc NEWS.md README.md INSTALL.md
%license COPYING LICENSE
%{_bindir}/zbarimg %{_bindir}/zbarimg
%{_bindir}/zbarcam %{_bindir}/zbarcam
%{_libdir}/libzbar.so.*
%{_mandir}/man1/* %{_mandir}/man1/*
%{_sysconfdir}/dbus-1/system.d/org.linuxtv.Zbar.conf %{_sysconfdir}/dbus-1/system.d/org.linuxtv.Zbar.conf
%files libs -f zbar.lang
%license COPYING LICENSE.md
%{_libdir}/libzbar.so.0*
%files devel %files devel
%doc HACKING TODO %doc HACKING.md TODO.md
%{_libdir}/libzbar.so %{_libdir}/libzbar.so
%{_libdir}/pkgconfig/zbar.pc %{_libdir}/pkgconfig/zbar.pc
%dir %{_includedir}/zbar %dir %{_includedir}/zbar
@ -105,11 +183,15 @@ rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/
%files gtk %files gtk
%{_libdir}/libzbargtk.so.* %{_libdir}/libzbargtk.so.*
%{_bindir}/zbarcam-gtk %{_bindir}/zbarcam-gtk
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/ZBar-1.0.typelib
%files gtk-devel %files gtk-devel
%{_libdir}/libzbargtk.so %{_libdir}/libzbargtk.so
%{_libdir}/pkgconfig/zbar-gtk.pc %{_libdir}/pkgconfig/zbar-gtk.pc
%{_includedir}/zbar/zbargtk.h %{_includedir}/zbar/zbargtk.h
%dir %{_datadir}/gir-1.0
%{_datadir}/gir-1.0/ZBar-1.0.gir
%files qt %files qt
%{_libdir}/libzbarqt.so.* %{_libdir}/libzbarqt.so.*
@ -120,11 +202,24 @@ rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/
%{_libdir}/pkgconfig/zbar-qt.pc %{_libdir}/pkgconfig/zbar-qt.pc
%{_includedir}/zbar/QZBar*.h %{_includedir}/zbar/QZBar*.h
%if %{JAVA}
%files java
%{_jnidir}/zbar.jar
%{_libdir}/libzbarjni.so*
%endif
%files -n python3-zbar
%{python3_sitearch}/zbar.so
%{_docdir}/test_python.py
%changelog %changelog
* Sat Jan 15 2022 Chen Chen <chen_aka_jan@163.com> - 0.22-2 * Wed Nov 9 2022 hkgy <kaguyahatu@outlook.com> - 0.23.90-1
- Upgrade to v0.23.90
* Sat Jan 15 2022 Chen Chen <chen_aka_jan@163.com> - 0.22.0-2
- remove autoreconf for fix build error - remove autoreconf for fix build error
* Thu Oct 22 2020 caodongxia <caodongxia@huawei.com> - 0.22-1 * Thu Oct 22 2020 caodongxia <caodongxia@huawei.com> - 0.22.0-1
- update package from 0.20.1 to 0.22 - update package from 0.20.1 to 0.22
* Tue Dec 3 2019 lingsheng <lingsheng@huawei.com> - 0.20.1-4 * Tue Dec 3 2019 lingsheng <lingsheng@huawei.com> - 0.20.1-4