zbar: unbreak cross due to old v4l1

v4l1 is not a thing since Linux 2.6.38.
This commit is contained in:
Alessio Sergi 2017-05-07 16:07:50 +02:00
parent 96494d1771
commit e7b1aa7297
4 changed files with 96 additions and 26 deletions

View file

@ -0,0 +1,16 @@
--- configure.ac.orig
+++ configure.ac
@@ -1,9 +1,11 @@
dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ([2.61])
+AC_PREREQ([2.68])
+m4_ifndef([AC_LANG_DEFINES_PROVIDED],
+ [m4_define([AC_LANG_DEFINES_PROVIDED])])
AC_INIT([zbar], [0.10], [spadix@users.sourceforge.net])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
-AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects std-options dist-bzip2])
+AM_INIT_AUTOMAKE([1.13 foreign subdir-objects std-options dist-bzip2])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR(zbar/scanner.c)
LT_PREREQ([2.2])

View file

@ -0,0 +1,74 @@
--- configure.ac.orig
+++ configure.ac
@@ -147,19 +147,13 @@
with_video="no"
AS_IF([test "x$enable_video" != "xno"],
[AS_IF([test "x$win32" = "xno"],
- [AC_CHECK_HEADERS([linux/videodev.h], [with_video="v4l1"],
- [AC_MSG_FAILURE([test for video support failed!
-rebuild your kernel to include video4linux support or
-configure --disable-video to skip building video support.])])
- AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
+ [AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
[AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])],
[AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
[AC_MSG_FAILURE([test for VfW video support failed!
configure --disable-video to skip building vidoe support.])])])
])
AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
-AM_CONDITIONAL([HAVE_V4L1],
- [test "x$with_video" = "xv4l1" || test "x$with_video" = "xv4l2"])
AM_CONDITIONAL([HAVE_V4L2], [test "x$with_video" = "xv4l2"])
dnl X
--- zbar/Makefile.am.inc.orig
+++ zbar/Makefile.am.inc
@@ -53,12 +53,9 @@
zbar_libzbar_la_SOURCES += zbar/processor/posix.h zbar/processor/posix.c
endif
-if HAVE_V4L1
-zbar_libzbar_la_SOURCES += zbar/video/v4l1.c
if HAVE_V4L2
zbar_libzbar_la_SOURCES += zbar/video/v4l2.c
endif
-endif
if WIN32
if HAVE_VIDEO
zbar_libzbar_la_SOURCES += zbar/video/vfw.c
--- zbar/video/v4l2.c.orig
+++ zbar/video/v4l2.c
@@ -39,6 +39,9 @@
# include <sys/mman.h>
#endif
#include <linux/videodev2.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "video.h"
#include "image.h"
@@ -507,3 +507,23 @@
vdo->dq = v4l2_dq;
return(0);
}
+
+int _zbar_video_open (zbar_video_t *vdo,
+ const char *dev)
+{
+ vdo->fd = open(dev, O_RDWR);
+ if(vdo->fd < 0)
+ return(err_capture_str(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
+ "opening video device '%s'", dev));
+ zprintf(1, "opened camera device %s (fd=%d)\n", dev, vdo->fd);
+
+ int rc = -1;
+ if(vdo->intf != VIDEO_V4L1)
+ rc = _zbar_v4l2_probe(vdo);
+
+ if(rc && vdo->fd >= 0) {
+ close(vdo->fd);
+ vdo->fd = -1;
+ }
+ return(rc);
+}

View file

@ -1,24 +0,0 @@
Thanks to Andy Weidenbaum <archbaum@gmail.com> for providing this patch!
--- ./zbar/video/v4l1.c 2013-03-06 23:24:22.996336417 -0800
+++ ./zbar/video/v4l1.c 2013-03-06 23:29:29.789662369 -0800
@@ -41,7 +41,7 @@
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include "video.h"
#include "image.h"
--- ./configure 2009-10-23 11:17:24.000000000 -0700
+++ ./configure 2013-03-06 23:47:33.902966990 -0800
@@ -18709,7 +18709,7 @@
if test "x$enable_video" != "xno"; then
if test "x$win32" = "xno"; then
-for ac_header in linux/videodev.h
+for ac_header in libv4l1-videodev.h
do
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then

View file

@ -4,7 +4,7 @@ version=0.10
revision=1
build_style=gnu-configure
configure_args="--with-qt --with-gtk"
hostmakedepends="pkg-config qt-qmake qt-host-tools glib-devel"
hostmakedepends="automake pkg-config libtool gettext-devel python qt-qmake qt-host-tools glib-devel"
makedepends="libmagick-devel libXv-devel pygtk-devel qt-devel v4l-utils-devel"
short_desc="A barcode reading library and application"
maintainer="Jürgen Buchmüller <pullmoll@t-online.de>"
@ -13,10 +13,14 @@ homepage="https://zbar.sourceforge.net/"
distfiles="$SOURCEFORGE_SITE/zbar/${version}/${pkgname}-${version}.tar.bz2"
checksum=234efb39dbbe5cef4189cc76f37afbe3cfcfb45ae52493bfe8e191318bdbadc6
depends="libzbar-${version}_${revision}"
nocross="https://build.voidlinux.eu/builders/armv7l_builder/builds/2508/steps/shell_3/logs/stdio"
CFLAGS="-DNDEBUG"
pre_configure() {
export PYTHON_CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/python2.7"
autoreconf -fi
}
libzbar_package() {
short_desc+=" - library files"
pkg_install() {