From e7b1aa72978dbe394621b196d7035a4d219a5a1f Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Sun, 7 May 2017 16:07:50 +0200 Subject: [PATCH] zbar: unbreak cross due to old v4l1 v4l1 is not a thing since Linux 2.6.38. --- .../patches/new_autotools_build_fix.patch | 16 ++++ srcpkgs/zbar/patches/no-v4l1-check.patch | 74 +++++++++++++++++++ srcpkgs/zbar/patches/v4l1.patch | 24 ------ srcpkgs/zbar/template | 8 +- 4 files changed, 96 insertions(+), 26 deletions(-) create mode 100644 srcpkgs/zbar/patches/new_autotools_build_fix.patch create mode 100644 srcpkgs/zbar/patches/no-v4l1-check.patch delete mode 100644 srcpkgs/zbar/patches/v4l1.patch diff --git a/srcpkgs/zbar/patches/new_autotools_build_fix.patch b/srcpkgs/zbar/patches/new_autotools_build_fix.patch new file mode 100644 index 00000000000..4ab34e3f19c --- /dev/null +++ b/srcpkgs/zbar/patches/new_autotools_build_fix.patch @@ -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]) diff --git a/srcpkgs/zbar/patches/no-v4l1-check.patch b/srcpkgs/zbar/patches/no-v4l1-check.patch new file mode 100644 index 00000000000..45a494323b1 --- /dev/null +++ b/srcpkgs/zbar/patches/no-v4l1-check.patch @@ -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 + #endif + #include ++#include ++#include ++#include + + #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); ++} diff --git a/srcpkgs/zbar/patches/v4l1.patch b/srcpkgs/zbar/patches/v4l1.patch deleted file mode 100644 index 150b0e69520..00000000000 --- a/srcpkgs/zbar/patches/v4l1.patch +++ /dev/null @@ -1,24 +0,0 @@ -Thanks to Andy Weidenbaum 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 - #endif --#include -+#include - - #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 diff --git a/srcpkgs/zbar/template b/srcpkgs/zbar/template index b0737d9a997..a58ee5072f0 100644 --- a/srcpkgs/zbar/template +++ b/srcpkgs/zbar/template @@ -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 " @@ -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() {