wok-current rev 12330

sane-backends: Clean up. Add support for libv4l 0.8.3+.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Apr 19 08:51:41 2012 +0000 (2012-04-19)
parents 66e4194f3966
children 78a8f90f5204
files sane-backends-dev/receipt sane-backends/receipt sane-backends/stuff/libv4l-0.8.3.patch sane-backends/stuff/xerox_mfp_fix_usb_devices.patch
line diff
     1.1 --- a/sane-backends-dev/receipt	Thu Apr 19 08:29:48 2012 +0000
     1.2 +++ b/sane-backends-dev/receipt	Thu Apr 19 08:51:41 2012 +0000
     1.3 @@ -5,6 +5,7 @@
     1.4  CATEGORY="development"
     1.5  SHORT_DESC="Sane devel files."
     1.6  MAINTAINER="pankso@slitaz.org"
     1.7 +DEPENDS="sane-backends"
     1.8  WANTED="sane-backends"
     1.9  WEB_SITE="http://www.sane-project.org/"
    1.10  
     2.1 --- a/sane-backends/receipt	Thu Apr 19 08:29:48 2012 +0000
     2.2 +++ b/sane-backends/receipt	Thu Apr 19 08:51:41 2012 +0000
     2.3 @@ -7,25 +7,29 @@
     2.4  MAINTAINER="pankso@slitaz.org"
     2.5  TARBALL="$PACKAGE-$VERSION.tar.gz"
     2.6  WEB_SITE="http://www.sane-project.org/"
     2.7 -WGET_URL="ftp://ftp.sane-project.org/pub/sane/$PACKAGE-$VERSION/$TARBALL"
     2.8 +WGET_URL="ftp://ftp2.sane-project.org/pub/sane/$PACKAGE-$VERSION/$TARBALL"
     2.9  
    2.10  DEPENDS="libusb-compat jpeg tiff zlib libgphoto2 libv4l libltdl"
    2.11 +BUILD_DEPENDS="libusb-compat-dev jpeg-dev tiff-dev zlib-dev libv4l-dev libgphoto2-dev"
    2.12  
    2.13  # Rules to configure and make the package.
    2.14  compile_rules()
    2.15  {
    2.16  	cd $src
    2.17 +	patch -Np1 -i $stuff/libv4l-0.8.3.patch
    2.18 +	# fix https://bugs.archlinux.org/task/26114
    2.19 +	patch -Np1 -i $stuff/xerox_mfp_fix_usb_devices.patch
    2.20  	./configure \
    2.21  		--prefix=/usr \
    2.22  		--sysconfdir=/etc \
    2.23  		--mandir=/usr/share/man \
    2.24  		$CONFIGURE_ARGS &&
    2.25  	make &&
    2.26 -	make -j 1 DESTDIR=$PWD/_pkg install
    2.27 +	make -j 1 DESTDIR=$DESTDIR install
    2.28  
    2.29  	# copy the missing udev rule
    2.30 -	[ ! -d $PWD/_pkg/etc/udev/rules.d ] && mkdir -p $PWD/_pkg/etc/udev/rules.d
    2.31 -	cp -a $src/tools/udev/libsane.rules $PWD/_pkg/etc/udev/rules.d/55-sane.rules
    2.32 +	[ ! -d $DESTDIR/etc/udev/rules.d ] && mkdir -p $DESTDIR/etc/udev/rules.d
    2.33 +	cp -a $src/tools/udev/libsane.rules $DESTDIR/etc/udev/rules.d/55-sane.rules
    2.34  }
    2.35  
    2.36  # Rules to gen a SliTaz package suitable for Tazpkg.
    2.37 @@ -54,11 +58,11 @@
    2.38  	local root
    2.39  	root=$1
    2.40  	
    2.41 -	tazpkg reconfigure udev --root=$1
    2.42 +	tazpkg reconfigure udev --root=$root
    2.43  	
    2.44  	# add group scanner
    2.45  	if ! grep -q scanner $root/etc/group ; then
    2.46 -		addgroup -g 96 scanner
    2.47 +		chroot "$root/" addgroup -g 96 scanner
    2.48  	fi
    2.49  	
    2.50  	echo " ADD yourself to group scanner to use sane: addgroup tux scanner"
    2.51 @@ -66,5 +70,5 @@
    2.52  
    2.53  post_remove()
    2.54  {
    2.55 -	delgroup scanner & >/dev/null
    2.56 +	chroot "$1/" delgroup scanner & >/dev/null
    2.57  }
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/sane-backends/stuff/libv4l-0.8.3.patch	Thu Apr 19 08:51:41 2012 +0000
     3.3 @@ -0,0 +1,64 @@
     3.4 +From 26c69b228b29f612faf4b0cc85db969ee7cc4ea6 Mon Sep 17 00:00:00 2001
     3.5 +From: Nils Philippsen <nils@redhat.com>
     3.6 +Date: Mon, 14 Mar 2011 13:35:05 +0100
     3.7 +Subject: [PATCH] patch: v4l
     3.8 +
     3.9 +Squashed commit of the following:
    3.10 +
    3.11 +commit 23381932c76846191b42a48e505b37cd74711265
    3.12 +Author: Julien BLACHE <jb@jblache.org>
    3.13 +Date:   Wed Feb 16 19:37:43 2011 +0100
    3.14 +
    3.15 +    Fix v4l build with libv4l 0.8.3+
    3.16 +
    3.17 +    (cherry picked from commit c5ca46c2d1be78c651afb843cc834cf2b5b24953)
    3.18 +
    3.19 +    Conflicts:
    3.20 +
    3.21 +    	ChangeLog
    3.22 +
    3.23 +    Signed-off-by: Nils Philippsen <nils@redhat.com>
    3.24 +---
    3.25 + backend/v4l.c |    3 +--
    3.26 + backend/v4l.h |    3 ++-
    3.27 + 2 files changed, 3 insertions(+), 3 deletions(-)
    3.28 +
    3.29 +diff --git a/backend/v4l.c b/backend/v4l.c
    3.30 +index 6510ef0..38595ed 100644
    3.31 +--- a/backend/v4l.c
    3.32 ++++ b/backend/v4l.c
    3.33 +@@ -84,9 +84,8 @@
    3.34 + #include "../include/sane/sanei_config.h"
    3.35 + #define V4L_CONFIG_FILE "v4l.conf"
    3.36 + 
    3.37 +-#include "v4l.h"
    3.38 +-
    3.39 + #include <libv4l1.h>
    3.40 ++#include "v4l.h"
    3.41 + 
    3.42 + static const SANE_Device **devlist = NULL;
    3.43 + static int num_devices;
    3.44 +diff --git a/backend/v4l.h b/backend/v4l.h
    3.45 +index 588b96e..6aee586 100644
    3.46 +--- a/backend/v4l.h
    3.47 ++++ b/backend/v4l.h
    3.48 +@@ -29,6 +29,7 @@
    3.49 + #ifndef v4l_h
    3.50 + #define v4l_h
    3.51 + 
    3.52 ++#ifndef __LINUX_VIDEODEV_H
    3.53 + /* Kernel interface */
    3.54 + /* Only the stuff we need. For more features, more defines are needed */
    3.55 + 
    3.56 +@@ -165,7 +166,7 @@ struct video_channel
    3.57 + 
    3.58 + 
    3.59 + /* end of kernel interface */
    3.60 +-
    3.61 ++#endif /* !__LINUX_VIDEODEV_H */
    3.62 + 
    3.63 + #include <../include/sane/sane.h>
    3.64 + 
    3.65 +-- 
    3.66 +1.7.4
    3.67 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/sane-backends/stuff/xerox_mfp_fix_usb_devices.patch	Thu Apr 19 08:51:41 2012 +0000
     4.3 @@ -0,0 +1,67 @@
     4.4 +commit 5ea227caeacd504b64eef301e83fa63e0a25b3f7
     4.5 +Author: Alex Belkin <abc@telekom.ru>
     4.6 +Date:   Tue Mar 8 17:57:19 2011 +0300
     4.7 +
     4.8 +    keep usb device by default (correct for bug introduced by tcp sub-backend
     4.9 +
    4.10 +diff --git a/backend/xerox_mfp.c b/backend/xerox_mfp.c
    4.11 +index e08b50f..d4672a7 100644
    4.12 +--- a/backend/xerox_mfp.c
    4.13 ++++ b/backend/xerox_mfp.c
    4.14 +@@ -37,10 +37,10 @@
    4.15 + static const SANE_Device **devlist = NULL;	/* sane_get_devices array */
    4.16 + static struct device *devices_head = NULL;	/* sane_get_devices list */
    4.17 +
    4.18 +-transport available_transports[] = {
    4.19 ++enum { TRANSPORT_USB, TRANSPORT_TCP, TRANSPORTS_MAX };
    4.20 ++transport available_transports[TRANSPORTS_MAX] = {
    4.21 +     { "usb", usb_dev_request, usb_dev_open, usb_dev_close, usb_configure_device },
    4.22 +     { "tcp", tcp_dev_request, tcp_dev_open, tcp_dev_close, tcp_configure_device },
    4.23 +-    { 0 }
    4.24 + };
    4.25 +
    4.26 + static int resolv_state(int state)
    4.27 +@@ -824,7 +824,13 @@ free_devices (void)
    4.28 +   devices_head = NULL;
    4.29 + }
    4.30 +
    4.31 +-/* SANE API ignores return code of this callback */
    4.32 ++static transport *tr_from_devname(SANE_String_Const devname)
    4.33 ++{
    4.34 ++  if (strncmp("tcp", devname, 3) == 0)
    4.35 ++    return &available_transports[TRANSPORT_TCP];
    4.36 ++  return &available_transports[TRANSPORT_USB];
    4.37 ++}
    4.38 ++
    4.39 + static SANE_Status
    4.40 + list_one_device (SANE_String_Const devname)
    4.41 + {
    4.42 +@@ -839,12 +845,7 @@ list_one_device (SANE_String_Const devname)
    4.43 +       return SANE_STATUS_GOOD;
    4.44 +   }
    4.45 +
    4.46 +-  for (tr = available_transports; tr->ttype; tr++) {
    4.47 +-    if (!strncmp (devname, tr->ttype, strlen(tr->ttype)))
    4.48 +-      break;
    4.49 +-  }
    4.50 +-  if (!tr->ttype)
    4.51 +-    return SANE_STATUS_INVAL;
    4.52 ++  tr = tr_from_devname(devname);
    4.53 +
    4.54 +   dev = calloc (1, sizeof (struct device));
    4.55 +   if (dev == NULL)
    4.56 +@@ -878,13 +879,7 @@ list_one_device (SANE_String_Const devname)
    4.57 + static SANE_Status
    4.58 + list_conf_devices (UNUSED (SANEI_Config * config), const char *devname)
    4.59 + {
    4.60 +-    transport *tr;
    4.61 +-
    4.62 +-    for (tr = available_transports; tr->ttype; tr++) {
    4.63 +-	if (!strncmp (devname, tr->ttype, strlen(tr->ttype)))
    4.64 +-	    return tr->configure_device(devname, list_one_device);
    4.65 +-    }
    4.66 +-    return	SANE_STATUS_INVAL;
    4.67 ++  return tr_from_devname(devname)->configure_device(devname, list_one_device);
    4.68 + }
    4.69 +
    4.70 + SANE_Status