sane-backends: import from oldpackages

Changes since oldpackages:
- cups dependency was completely removed
  * This also happened in sane trunk version
- small musl patch
- added detection of inb,outb (link error with musl)
  * this also removes hack 020-non-i386-qcam.patch
- fix for segfault when using sane-test backend
- removed link to extra libraries in libsane (used only
  for preload backends)
- added format-security fix
- sane-libs and sane-backends merged and exploded into
  individual packages for each backend:
  * libsane for sane library (which backends should dep on)
  * sane-daemon for saned daemon
  * sane-xxx for sane backend for xxx
  ** each backend has its own custom dep libraries
  * sane-backends-all (with no files) that deps on all backends
  * sane-qcam is only available for x86/x86_64
  ** other archs does not implement inb/outb (at least in musl)

Now it is possible to use SANE with much less FS space (KB
instead of MB).

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
This commit is contained in:
Luiz Angelo Daros de Luca 2015-08-21 15:07:01 -03:00
parent 99ba6415d9
commit e11fbf71f7
10 changed files with 791 additions and 0 deletions

View File

@ -0,0 +1,345 @@
#
# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=sane-backends
PKG_VERSION:=1.0.24
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://fossies.org/linux/misc \
https://alioth.debian.org/frs/download.php/3958
PKG_MD5SUM:=1ca68e536cd7c1852322822f5f6ac3a4
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
PKG_LICENSE:=GPL-2.0 GPL-2.0+
PKG_LICENSE_FILES:=COPYING LICENSE
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=aclocal.m4
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
SANE_BACKENDS:=
define Package/sane-backends/Default
TITLE:=Scanner Access Now Easy
URL:=http://www.sane-project.org/
endef
define Package/sane-backends/Default/description
SANE (Scanner Access Now Easy) is a universal scanner interface.
endef
define Package/sane-backends
$(call Package/sane-backends/Default)
SECTION:=utils
CATEGORY:=Utilities
TITLE+= (drivers)
endef
define Package/sane-backends/description
$(call Package/sane-backends/Default/description)
.
This
endef
define Package/sane-backends/config
menu "Select SANE backends"
depends on PACKAGE_sane-backends
config PACKAGE_sane-backends-all
depends on PACKAGE_sane-backends
prompt "Include all SANE backends (sane-backends-all)"
comment "Modules"
$(foreach backend,$(SANE_BACKENDS), \
$(eval $(Package/Default)
$(Package/sane-$(backend))
)\
config PACKAGE_sane-$(backend)
prompt "$(TITLE)"
$(foreach config_dep,\
$(filter @%,
$(foreach v, $(DEPENDS), $(if $(findstring :,$v),,$v))
),\
depends on $(strip $(subst @,,$(config_dep)))
)
)
endmenu
endef
# returns conditional dependency on sane backend
# 1: short name
#
# If there is no config deps on $(1), returns +sane-$(1).
# Otherwise, +(CONFIG1||CONFIG2||..):sane-$(1)
define SaneBackendDependency
$(eval $(Package/Default)
)$(eval $(Package/sane-$(1))
)$(eval FILTER_CONFIG:=$(foreach config_dep,$(filter @%,$(foreach v,$(DEPENDS),$(if $(findstring :,$v),,$v))),$(strip $(subst @,,$(config_dep))))
)$(eval
ifneq ($(FILTER_CONFIG),)
FILTER_CONFIG:=($(subst $(space),||,$(FILTER_CONFIG))):
endif
) \
+$(FILTER_CONFIG)sane-$(1)
endef
define Package/sane-backends-all
$(eval SANE_DEPENDS:=$(foreach backend,$(SANE_BACKENDS),$(call SaneBackendDependency,$(backend))))
$(call Package/sane-backends/Default)
SECTION:=utils
CATEGORY:=Utilities
TITLE+= (all backends)
DEPENDS:= $(SANE_DEPENDS)
HIDDEN:=1
endef
define Package/sane-backends/description
$(call Package/sane-backends/Default/description)
.
Metapackage for selecting all SANE Backends
endef
define Package/sane-daemon
$(call Package/sane-backends/Default)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libsane
TITLE+= (network daemon)
endef
define Package/sane-daemon/description
$(call Package/sane-backends/Default/description)
This package contains the SANE daemon.
endef
define Package/libsane
$(call Package/sane-backends/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libusb-compat
TITLE+= (libraries)
endef
define Package/libsane/description
$(call Package/sane-backends/Default/description)
This package contains the SANE shared libraries.
endef
define Package/sane-frontends
$(call Package/sane-backends/Default)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libsane
TITLE+= (frontends)
endef
define Package/sane-frontends/description
$(call Package/sane-backends/Default/description)
This package contains the SANE frontends.
endef
TARGET_LDFLAGS += \
-Wl,-rpath-link $(STAGING_DIR)/usr/lib \
-Wl,-rpath-link $(PKG_BUILD_DIR)/backend/.libs
CONFIGURE_ARGS+= \
--enable-shared \
--enable-static \
--disable-translations \
--disable-latex \
--without-gphoto2 \
--without-snmp
define Build/Configure
mkdir -p $(PKG_BUILD_DIR)/backend/.libs
$(Build/Configure/Default)
endef
define Package/libsane/install
$(INSTALL_DIR) $(1)/usr/lib/sane/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.so.* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-dll.so.* $(1)/usr/lib/sane/
$(INSTALL_DIR) $(1)/etc/sane.d/dll.d
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/dll.conf $(1)/etc/sane.d/
endef
define Package/libsane/conffiles
/etc/sane.d/dll.conf
endef
define Package/sane-daemon/install
$(INSTALL_DIR) $(1)/etc/sane.d
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/xinetd.d
$(CP) ./files/xinet.d_sane-port $(1)/etc/xinetd.d/sane-port
endef
define Package/sane-daemon/conffiles
/etc/sane.d/saned.conf
endef
define Package/sane-frontends/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
endef
define Package/sane-backends-all/install
/bin/true
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/sane $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsane.{a,so*} $(1)/usr/lib/
endef
# 1: short name
# 2: description
# 3: dependencies on other packages
define SaneBackend
SANE_BACKENDS+= $(1)
define Package/sane-$(1)
$(call Package/sane-backends/Default)
TITLE:=SANE backend (sane-$(1)) for $(2)
DEPENDS+= +libsane $(3)
HIDDEN:=1
endef
define Package/sane-$(1)/description
$(call Package/sane-backends/Default/description)
.
This package contains the SANE backend for $(2).
endef
define Package/sane-$(1)/install
if [ -f "$(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf" ]; then \
$(INSTALL_DIR) $$(1)/etc/sane.d ; \
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/$(1).conf $$(1)/etc/sane.d/; \
fi
$(INSTALL_DIR) $$(1)/usr/lib/sane
$(CP) $(PKG_INSTALL_DIR)/usr/lib/sane/libsane-$(1).so.* $$(1)/usr/lib/sane/
if [ -d "$(PKG_INSTALL_DIR)/usr/share/sane/$(1)" ]; then \
$(INSTALL_DIR) $$(1)/usr/share/sane/ ; \
$(CP) -a $(PKG_INSTALL_DIR)/usr/share/sane/$(1) $$(1)/usr/share/sane/ ; \
fi
endef
define Package/sane-$(1)/conffiles
/etc/sane.d/$(1).conf
endef
$$(eval $$(call BuildPackage,sane-$(1)))
endef
# This scriptlet creates stub backend call based on local machine man files
# for BACKEND in abaton agfafocus apple artec artec_eplus48u as6e avision bh canon canon630u canon_dr canon_pp cardscan coolscan coolscan2 coolscan3 dell1600n_net epjitsu epson epson2 fujitsu genesys gt68xx hp hp3500 hp3900 hp4200 hp5400 hp5590 hpljm1005 hpsj5s hs2p ibm kodak kodakaio kvs20xx kvs40xx kvs1025 leo lexmark ma1509 magicolor matsushita microtek microtek2 mustek mustek_pp mustek_usb mustek_usb2 nec niash p5 pie pixma plustek plustek_pp ricoh rts8891 s9036 sceptre sharp sm3600 sm3840 snapscan sp15c st400 tamarack teco1 teco2 teco3 u12 umax umax1220u umax_pp xerox_mfp; do DESC=$(man sane-$BACKEND | sed -r -n '/^[[:blank:]]*sane-[[:alnum:]_]+ - SANE backend for /{s///;s/,//g;p;q}'); echo "\$(eval \$(call SaneBackend,$BACKEND,$DESC,))"; done
$(eval $(call BuildPackage,libsane))
$(eval $(call BuildPackage,sane-daemon))
$(eval $(call SaneBackend,abaton,Abaton flatbed scanners))
$(eval $(call SaneBackend,agfafocus,AGFA Focus flatbed scanners))
$(eval $(call SaneBackend,apple,Apple flatbed scanners))
$(eval $(call SaneBackend,artec,Artec flatbed scanners))
$(eval $(call SaneBackend,artec_eplus48u,Artec E+ 48U and re-badged models))
$(eval $(call SaneBackend,as6e,Artec AS6E parallel port interface scanner))
$(eval $(call SaneBackend,avision,Avision and Avision OEM scanners and possibly more flatbed and film scanners))
$(eval $(call SaneBackend,bh,Bell+Howell Copiscan II series document scanners))
$(eval $(call SaneBackend,canon,Canon SCSI scanners))
$(eval $(call SaneBackend,canon630u,the Canon 630u USB flatbed scanner))
$(eval $(call SaneBackend,canon_dr,Canon DR-series scanners))
# Depends on libieee1284
#$(eval $(call SaneBackend,canon_pp,Canon CanoScan Parallel Port flatbed scanners,+libieee1284))
$(eval $(call SaneBackend,cardscan,Corex CardScan usb scanners))
$(eval $(call SaneBackend,coolscan,Nikon film-scanners))
$(eval $(call SaneBackend,coolscan2,Nikon Coolscan film scanners))
$(eval $(call SaneBackend,coolscan3,Nikon Coolscan film scanners))
$(eval $(call SaneBackend,dc210,Kodak DC210 Digital Camera,+libjpeg))
$(eval $(call SaneBackend,dc240,Kodak DC240 Digital Camera,+libjpeg))
$(eval $(call SaneBackend,dc25,Kodak DC20/DC25 Digital Cameras))
$(eval $(call SaneBackend,dell1600n_net,Dell 1600n,+libtiff))
$(eval $(call SaneBackend,dmc,Polaroid Digital Microscope Camera))
$(eval $(call SaneBackend,epjitsu,Epson-based Fujitsu USB scanners))
$(eval $(call SaneBackend,epson,EPSON scanners))
$(eval $(call SaneBackend,epson2,EPSON scanners))
$(eval $(call SaneBackend,fujitsu,Fujitsu flatbed and ADF scanners))
$(eval $(call SaneBackend,genesys,GL646 GL841 GL843 GL847 and GL124 based USB flatbed scanners))
#$(eval $(call SaneBackend,gphoto2,digital cameras supported by gphoto2,+libjpeg))
$(eval $(call SaneBackend,gt68xx,GT-68XX based USB flatbed scanners))
$(eval $(call SaneBackend,hp,HP ScanJet scanners))
$(eval $(call SaneBackend,hp3500,Hewlett-Packard ScanJet 3500 series scanners))
$(eval $(call SaneBackend,hp3900,RTS8822 chipset based scanners,+libtiff))
$(eval $(call SaneBackend,hp4200,Hewlett-Packard 4200 scanners))
$(eval $(call SaneBackend,hp5400,Hewlett-Packard 54XX scanners))
$(eval $(call SaneBackend,hp5590,Hewlett-Packard 4500C/4570C/5500C/5550C/5590/7650 Workgroup/Document scanners))
$(eval $(call SaneBackend,hpljm1005,Hewlett-Packard LaserJet M1005 MFP Scanner))
# Depends on libieee1284
#$(eval $(call SaneBackend,hpsj5s,HP ScanJet 5S sheet-fed scanner,+libieee1284))
$(eval $(call SaneBackend,hs2p,Ricoh SCSI flatbed/ADF scanners))
$(eval $(call SaneBackend,ibm,IBM and Ricoh SCSI flatbed scanners))
$(eval $(call SaneBackend,kodak,big Kodak flatbed and ADF scanners))
$(eval $(call SaneBackend,kodakaio,Kodak aio printer / scanners))
$(eval $(call SaneBackend,kvs20xx,Panasonic KV-S20xxC USB/SCSI ADF scanners))
$(eval $(call SaneBackend,kvs40xx,Panasonic KV-S40xxC USB/SCSI ADF scanners))
$(eval $(call SaneBackend,kvs1025,Panasonic KV-S102xC USB ADF scanners))
$(eval $(call SaneBackend,leo,LEO Technologies scanners))
$(eval $(call SaneBackend,lexmark,Lexmark X1100/X1200 Series scanners))
$(eval $(call SaneBackend,ma1509,Mustek BearPaw 1200F USB scanner))
$(eval $(call SaneBackend,magicolor,KONICA MINOLTA magicolor scanners))
$(eval $(call SaneBackend,matsushita,Panasonic KV-SS high speed scanners))
$(eval $(call SaneBackend,microtek,Microtek scanners))
$(eval $(call SaneBackend,microtek2,Microtek scanners with SCSI-2 command set))
$(eval $(call SaneBackend,mustek,Mustek SCSI flatbed scanners and some other devices))
# Depends on libieee1284
#$(eval $(call SaneBackend,mustek_pp,Mustek parallel port flatbed scanners,+libieee1284))
$(eval $(call SaneBackend,mustek_usb,Mustek USB flatbed scanners))
$(eval $(call SaneBackend,mustek_usb2,SQ113 based USB flatbed scanners))
$(eval $(call SaneBackend,nec,NEC scanners))
$(eval $(call SaneBackend,net,network backend))
$(eval $(call SaneBackend,niash,scanners based on the NIASH chipset))
$(eval $(call SaneBackend,p5,the Primax PagePartner))
$(eval $(call SaneBackend,pie,PIE Devcom and AdLib SCSI flatbed scanners))
$(eval $(call SaneBackend,pixma,Canon Multi-Function Printers and CanoScan Scanners))
$(eval $(call SaneBackend,plustek,LM983[1/2/3] based USB flatbed scanners))
$(eval $(call SaneBackend,plustek_pp,Plustek parallel port flatbed scanners))
$(eval $(call SaneBackend,qcam,Connectix QuickCam cameras,@(TARGET_x86||TARGET_x86_64)))
$(eval $(call SaneBackend,ricoh,Ricoh flatbed scanners))
$(eval $(call SaneBackend,rts8891,rts8891 based scanners))
$(eval $(call SaneBackend,s9036,Siemens 9036 flatbed scanners))
$(eval $(call SaneBackend,sceptre,SCEPTRE scanners))
$(eval $(call SaneBackend,sharp,SHARP scanners))
$(eval $(call SaneBackend,sm3600,Microtek scanners with M011 USB chip))
$(eval $(call SaneBackend,sm3840,Microtek scanners with SCAN08 USB chip))
$(eval $(call SaneBackend,snapscan,AGFA SnapScan flatbed scanners))
$(eval $(call SaneBackend,sp15c,Fujitsu ScanPartner 15C flatbed scanner))
$(eval $(call SaneBackend,st400,Siemens ST/Highscan flatbed scanners))
$(eval $(call SaneBackend,stv680,STV680 cameras))
$(eval $(call SaneBackend,tamarack,Tamarack flatbed scanners))
$(eval $(call SaneBackend,teco1,TECO / RELISYS scanners))
$(eval $(call SaneBackend,teco2,TECO / RELISYS scanners))
$(eval $(call SaneBackend,teco3,TECO / RELISYS scanners))
$(eval $(call SaneBackend,test,testing frontends))
$(eval $(call SaneBackend,u12,Plustek USB flatbed scanners based on older parport designs))
$(eval $(call SaneBackend,umax,UMAX scanners))
$(eval $(call SaneBackend,umax1220u,the UMAX Astra 1220U and similar scanners))
$(eval $(call SaneBackend,umax_pp,Umax Astra parallel port flatbed scanners))
$(eval $(call SaneBackend,v4l,Video for Linux API,+libv4l +libjpeg))
$(eval $(call SaneBackend,xerox_mfp,Xerox Phaser 3200MFP device))
$(eval $(call BuildPackage,sane-backends))
$(eval $(call BuildPackage,sane-backends-all))
$(eval $(call BuildPackage,sane-frontends))

View File

@ -0,0 +1,14 @@
# default: off
# description: The saned provides scanner service via the network. \
# Applications like kooka, xsane or xscanimage can use the remote \
# scanner.
service sane-port
{
socket_type = stream
port = 6566
wait = no
user = root
group = root
server = /usr/sbin/saned
disable = yes
}

View File

@ -0,0 +1,11 @@
--- a/Makefile.in
+++ b/Makefile.in
@@ -396,7 +396,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = include lib sanei backend frontend tools doc po testsuite
+SUBDIRS = include lib sanei backend frontend
DIST_SUBDIRS = include lib sanei backend frontend tools doc po japi testsuite
dist_doc_DATA = AUTHORS ChangeLog COPYING LICENSE NEWS PROBLEMS PROJECTS \
README README.aix README.beos README.darwin README.djpeg README.freebsd \

View File

@ -0,0 +1,55 @@
--- a/configure.in
+++ b/configure.in
@@ -82,8 +82,6 @@ AM_CONDITIONAL(CROSS_COMPILING, test x$c
dnl ***********************************************************************
dnl set compiler/linker flags
dnl ***********************************************************************
-INCLUDES="${INCLUDES} -I/usr/local/include"
-AC_SUBST(INCLUDES)
SANE_SET_CFLAGS([$is_release])
SANE_SET_LDFLAGS
SANE_LINKER_RPATH
@@ -332,30 +330,22 @@ if test -c /dev/urandom ; then
AC_DEFINE(HAVE_DEV_URANDOM, 1, [Is /dev/urandom available?])
fi
-dnl added by PN 3/2/12 to detect cups
-$as_echo "checking for cups"
-if test -e /usr/include/cups/cups.h ; then
- AC_DEFINE(HAVE_CUPS, 1, [Is /usr/include/cups/cups.h available?])
- with_cups="yes"
- LIBS="-lcups $LIBS"
-else
- $as_echo "cups.h not found, you may want to install a cups development package"
- $as_echo "in order to autodetect network scanners in kodakaio."
- with_cups="no"
+AC_CHECK_HEADERS([cups/cups.h], [with_cups=yes], [with_cups=no])
+if test "x${with_cups}" = "xyes"; then
+ AC_DEFINE(HAVE_CUPS,[1],[Is cups/cups.h available?])
+ AC_PATH_PROG(CUPS_CONFIG, cups-config)
+ if test "x${CUPS_CONFIG}" != "x"; then
+ LIBS="$LIBS `$CUPS_CONFIG --libs`"
+ fi
fi
-dnl added by llagendijk 12/7/2012 to detect systemd for saned
-$as_echo_n "Checking for systemd..."
-if test -e /usr/include/systemd/sd-daemon.h ; then
- AC_DEFINE(HAVE_SYSTEMD, 1, [Is /usr/include/systemd/sd-daemon.h available?])
- with_systemd="yes"
- SYSTEMD_LIBS=" -lsystemd-daemon"
- AC_SUBST(SYSTEMD_LIBS)
- $as_echo "yes"
-else
- with_systemd="no"
- $as_echo "no"
+AC_CHECK_HEADERS([systemd/sd-daemon.h])
+PKG_CHECK_MODULES([HAVE_SYSTEMD], [libsystemd-daemon], [with_systemd=yes], [with_systemd=no])
+if test "x${with_systemd}" = "xyes"; then
+ AC_DEFINE(HAVE_SYSTEMD,[1],[Is systemd/sd-daemon.h available?])
+ SYSTEMD_LIBS="-lsystemd-daemon"
fi
+AC_SUBST(SYSTEMD_LIBS)
dnl ***********
dnl USB Support

View File

@ -0,0 +1,104 @@
--- a/configure.in
+++ b/configure.in
@@ -312,6 +312,25 @@ AC_CHECK_FUNCS(atexit ioperm i386_set_io
AC_REPLACE_FUNCS(getenv isfdtype sigprocmask snprintf \
strcasestr strdup strndup strsep usleep sleep syslog vsyslog)
+dnl sys/io.h might provide ioperm but not inb,outb (like for
+dnl non i386/x32/x86_64 with musl libc)
+if test "${ac_cv_header_sys_io_h}" = "yes"; then
+ AC_MSG_CHECKING([for inb,outb (provided by sys/io.h)])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <sys/io.h>]],
+ [[inb(0);outb(0,0);]])],
+ [AC_MSG_RESULT([yes])
+ sane_cv_have_sys_io_h_with_inb_outb="yes"],
+ [AC_MSG_RESULT([no])
+ sane_cv_have_sys_io_h_with_inb_outb="no"
+ AC_MSG_WARN([sys/io.h does not provide inb,outb (non i386/x32/x86_64 arch?)])])
+ if test "$sane_cv_have_sys_io_h_with_inb_outb" = "yes"; then
+ AC_DEFINE(SANE_HAVE_SYS_IO_H_WITH_INB_OUTB, 1, [Define to 1 if you have the <sys/io.h> providing inb,outb.])
+ fi
+else
+ sane_cv_have_sys_io_h_with_inb_outb="no"
+fi
+
SANE_PROTOTYPES
if test "$ac_cv_header_os2_h" = "yes" ; then
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -490,6 +484,9 @@
/* SANE DLL minor number */
#undef SANE_DLL_V_MINOR
+/* Define to 1 if you have the <sys/io.h> providing inb,outb. */
+#undef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+
/* SCSI command buffer size */
#undef SCSIBUFFERSIZE
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -620,9 +620,9 @@ for be in ${BACKENDS}; do
;;
qcam)
- if test "${ac_cv_func_ioperm}" = "no" \
+ if ( test "${ac_cv_func_ioperm}" = "no" || test "${sane_cv_have_sys_io_h_with_inb_outb}" = "no" )\
&& test "${ac_cv_func__portaccess}" = "no"; then
- echo "*** $be backend requires ioperm and portaccess functions - $DISABLE_MSG"
+ echo "*** $be backend requires (ioperm, inb and outb) or portaccess functions - $DISABLE_MSG"
backend_supported="no"
fi
;;
--- a/sanei/sanei_pio.c
+++ b/sanei/sanei_pio.c
@@ -61,6 +61,9 @@
#ifdef HAVE_SYS_IO_H
# include <sys/io.h> /* use where available (glibc 2.x, for example) */
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
#elif HAVE_ASM_IO_H
# include <asm/io.h> /* ugly, but backwards compatible */
#elif HAVE_SYS_HW_H
--- a/sanei/sanei_ab306.c
+++ b/sanei/sanei_ab306.c
@@ -51,6 +51,9 @@
#ifdef HAVE_SYS_IO_H
# include <sys/io.h> /* use where available (glibc 2.x, for example) */
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
#elif HAVE_ASM_IO_H
# include <asm/io.h> /* ugly, but backwards compatible */
#elif defined (__i386__) && defined (__GNUC__)
--- a/sanei/sanei_pa4s2.c
+++ b/sanei/sanei_pa4s2.c
@@ -72,7 +72,10 @@
# if defined (__ICC) && __ICC >= 700
# define __GNUC__ 2
# endif
-# include <sys/io.h>
+# include <sys/io.h>
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
# if defined (__ICC) && __ICC >= 700
# undef __GNUC__
# elif defined(__ICC) && defined(HAVE_ASM_IO_H)
--- a/sanei/sanei_pp.c
+++ b/sanei/sanei_pp.c
@@ -94,6 +94,9 @@
# define __GNUC__ 2
# endif
# include <sys/io.h>
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
# if defined (__ICC) && __ICC >= 700
# undef __GNUC__
# elif defined(__ICC) && defined(HAVE_ASM_IO_H)

View File

@ -0,0 +1,51 @@
--- a/include/sane/sanei_udp.h
+++ b/include/sane/sanei_udp.h
@@ -27,6 +27,7 @@
#include <netinet/in.h>
#include <netdb.h>
#endif
+#include <sys/types.h>
extern SANE_Status sanei_udp_open(const char *host, int port, int *fdp);
extern SANE_Status sanei_udp_open_broadcast(int *fdp);
--- a/backend/kvs20xx_cmd.h
+++ b/backend/kvs20xx_cmd.h
@@ -9,6 +9,8 @@
Panasonic KV-S20xx USB-SCSI scanners.
*/
+#include <sys/types.h>
+
#define COMMAND_BLOCK 1
#define DATA_BLOCK 2
#define RESPONSE_BLOCK 3
--- a/backend/kvs40xx.h
+++ b/backend/kvs40xx.h
@@ -10,6 +10,7 @@
#include "../include/sane/config.h"
#include <semaphore.h>
+#include <sys/types.h>
#undef BACKEND_NAME
#define BACKEND_NAME kvs40xx
--- a/backend/hp5400.c
+++ b/backend/hp5400.c
@@ -67,6 +67,7 @@
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memcpy */
#include <stdio.h>
+#include <sys/types.h>
#define HP5400_CONFIG_FILE "hp5400.conf"
--- a/backend/hp5590.c
+++ b/backend/hp5590.c
@@ -48,6 +48,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <sys/types.h>
#include "../include/sane/sane.h"
#define BACKEND_NAME hp5590

View File

@ -0,0 +1,45 @@
From efb04936b8ad3bf313c289a522ae5832e22c1b7e Mon Sep 17 00:00:00 2001
From: Paul Newall <quandry@ntlworld.com>
Date: Tue, 15 Oct 2013 22:20:15 +0100
Subject: detection of cups commented out in configure.in it is no longer used
by kodakaio.
---
ChangeLog | 4 ++++
configure.in | 24 ++++++++++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
--- a/configure.in
+++ b/configure.in
@@ -349,14 +349,14 @@ if test -c /dev/urandom ; then
AC_DEFINE(HAVE_DEV_URANDOM, 1, [Is /dev/urandom available?])
fi
-AC_CHECK_HEADERS([cups/cups.h], [with_cups=yes], [with_cups=no])
-if test "x${with_cups}" = "xyes"; then
- AC_DEFINE(HAVE_CUPS,[1],[Is cups/cups.h available?])
- AC_PATH_PROG(CUPS_CONFIG, cups-config)
- if test "x${CUPS_CONFIG}" != "x"; then
- LIBS="$LIBS `$CUPS_CONFIG --libs`"
- fi
-fi
+dnl AC_CHECK_HEADERS([cups/cups.h], [with_cups=yes], [with_cups=no])
+dnl if test "x${with_cups}" = "xyes"; then
+dnl AC_DEFINE(HAVE_CUPS,[1],[Is cups/cups.h available?])
+dnl AC_PATH_PROG(CUPS_CONFIG, cups-config)
+dnl if test "x${CUPS_CONFIG}" != "x"; then
+dnl LIBS="$LIBS `$CUPS_CONFIG --libs`"
+dnl fi
+dnl fi
AC_CHECK_HEADERS([systemd/sd-daemon.h])
PKG_CHECK_MODULES([HAVE_SYSTEMD], [libsystemd-daemon], [with_systemd=yes], [with_systemd=no])
@@ -825,7 +825,7 @@ fi
echo "IPv6 support: `eval eval echo ${ipv6}`"
echo "Avahi support: `eval eval echo ${enable_avahi}`"
echo "SNMP support: `eval eval echo ${with_snmp}`"
-echo "CUPS support: `eval eval echo ${with_cups}`"
+dnl echo "CUPS support: `eval eval echo ${with_cups}`"
echo "-> The following backends will be built:"
for backend in ${BACKENDS} ; do
echo $ECHO_N "${backend} "

View File

@ -0,0 +1,11 @@
--- a/backend/Makefile.am
+++ b/backend/Makefile.am
@@ -1120,7 +1120,7 @@ EXTRA_DIST += dll.aliases
nodist_libsane_la_SOURCES = dll-s.c
libsane_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=dll
libsane_la_LDFLAGS = $(DIST_LIBS_LDFLAGS)
-libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(DL_LIBS) $(LIBV4L_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(TIFF_LIBS) $(JPEG_LIBS) $(GPHOTO2_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(AVAHI_LIBS) $(SCSI_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS)
+libsane_la_LIBADD = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo $(DL_LIBS) $(MATH_LIB) $(IEEE1284_LIBS) $(SOCKET_LIBS) $(USB_LIBS) $(PTHREAD_LIBS) $(RESMGR_LIBS)
# WARNING: Automake is getting this wrong so have to do it ourselves.
libsane_la_DEPENDENCIES = $(COMMON_LIBS) @PRELOADABLE_BACKENDS_ENABLED@ libdll_preload.la sane_strstatus.lo ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_pv8630.lo ../sanei/sanei_pp.lo ../sanei/sanei_thread.lo ../sanei/sanei_lm983x.lo ../sanei/sanei_access.lo ../sanei/sanei_net.lo ../sanei/sanei_wire.lo ../sanei/sanei_codec_bin.lo ../sanei/sanei_pa4s2.lo ../sanei/sanei_ab306.lo ../sanei/sanei_pio.lo ../sanei/sanei_tcp.lo ../sanei/sanei_udp.lo ../sanei/sanei_magic.lo @SANEI_SANEI_JPEG_LO@

View File

@ -0,0 +1,14 @@
--- a/sanei/sanei_thread.c
+++ b/sanei/sanei_thread.c
@@ -512,11 +512,6 @@ sanei_thread_waitpid( SANE_Pid pid, int
DBG(2, "* result = %d (%p)\n", stat, (void*)status );
result = pid;
}
- /* call detach in any case to make sure that the thread resources
- * will be freed, when the thread has terminated
- */
- DBG(2, "* detaching thread(%ld)\n", pid );
- pthread_detach((pthread_t)pid);
if (status)
*status = stat;

View File

@ -0,0 +1,141 @@
http://pkgs.fedoraproject.org/cgit/sane-backends.git/plain/sane-backends-1.0.24-format-security.patch
From d1c0b7d119bb9dd2c51143b44cc86a369f453746 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Wed, 4 Dec 2013 15:21:19 +0100
Subject: [PATCH] patch: format-security
Squashed commit of the following:
commit 19e071b9f6d477462a0f4afbbd17acd15268ddfa
Author: Nils Philippsen <nils@redhat.com>
Date: Wed Dec 4 15:04:12 2013 +0100
avoid using string formats insecurely with "-f"
In the process, simplify processing the device list format: don't copy
the format string for writing \0 into it, just iterate over chunks in
the original string.
(cherry picked from commit 8082a42ec4f3b3cf2cffc30a45dda5fc41d55576)
---
frontend/scanimage.c | 52 ++++++++++++++++++++--------------------------------
1 file changed, 20 insertions(+), 32 deletions(-)
diff --git a/frontend/scanimage.c b/frontend/scanimage.c
index d41c849..9e1bcfb 100644
--- a/frontend/scanimage.c
+++ b/frontend/scanimage.c
@@ -1826,23 +1826,16 @@ main (int argc, char **argv)
else
{
int i = 0, int_arg = 0;
- char *percent, *start, *fmt;
+ const char *percent, *start;
const char *text_arg = 0;
- char cc, ftype;
-
- fmt = malloc (strlen (optarg) + 1);
- if (fmt == 0)
- {
- fprintf (stderr, "%s: not enough memory\n", prog_name);
- exit (1);
- }
+ char ftype;
for (i = 0; device_list[i]; ++i)
{
- strcpy (fmt, optarg);
- start = fmt;
+ start = optarg;
while (*start && (percent = strchr (start, '%')))
{
+ int start_len = percent - start;
percent++;
if (*percent)
{
@@ -1850,19 +1843,19 @@ main (int argc, char **argv)
{
case 'd':
text_arg = device_list[i]->name;
- ftype = *percent = 's';
+ ftype = 's';
break;
case 'v':
text_arg = device_list[i]->vendor;
- ftype = *percent = 's';
+ ftype = 's';
break;
case 'm':
text_arg = device_list[i]->model;
- ftype = *percent = 's';
+ ftype = 's';
break;
case 't':
text_arg = device_list[i]->type;
- ftype = *percent = 's';
+ ftype = 's';
break;
case 'i':
int_arg = i;
@@ -1870,45 +1863,40 @@ main (int argc, char **argv)
break;
case 'n':
text_arg = "\n";
- ftype = *percent = 's';
+ ftype = 's';
break;
case '%':
- ftype = 0;
+ text_arg = "%";
+ ftype = 's';
break;
default:
fprintf (stderr,
"%s: unknown format specifier %%%c\n",
prog_name, *percent);
- *percent = '%';
- ftype = 0;
+ text_arg = "%";
+ ftype = 's';
}
- percent++;
- cc = *percent;
- *percent = 0;
+ printf ("%.*s", start_len, start);
switch (ftype)
{
case 's':
- printf (start, text_arg);
+ printf ("%s", text_arg);
break;
case 'i':
- printf (start, int_arg);
- break;
- case 0:
- printf (start);
+ printf ("%i", int_arg);
break;
}
- *percent = cc;
- start = percent;
+ start = percent + 1;
}
else
{
- /* last char of the string is a '%', suppress it */
- *start = 0;
+ /* last char of the string is a '%', ignore it */
+ start++;
break;
}
}
if (*start)
- printf (start);
+ printf ("%s", start);
}
}
if (i == 0 && ch != 'f')
--
1.8.4.2