sane-backends: import from oldpackages and update
authorLuiz Angelo Daros de Luca <luizluca@gmail.com>
Fri, 21 Aug 2015 18:07:01 +0000 (15:07 -0300)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 14 Jan 2016 15:43:00 +0000 (16:43 +0100)
Changes since oldpackages:
- updated to 1.0.25
  * most of openwrt patches are upstreamed now
- cups dependency was completely removed
- small musl patch
- small uclibc patch
- removed link to extra libraries in libsane (used only
  for preload backends)
- 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>
utils/sane-backends/Makefile [new file with mode: 0644]
utils/sane-backends/files/xinet.d_sane-port [new file with mode: 0644]
utils/sane-backends/patches/002-remove-uneeded.patch [new file with mode: 0644]
utils/sane-backends/patches/020-fix_pieusb.patch [new file with mode: 0644]
utils/sane-backends/patches/030-musl.patch [new file with mode: 0644]
utils/sane-backends/patches/031-fix_uclibc.patch [new file with mode: 0644]
utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch [new file with mode: 0644]

diff --git a/utils/sane-backends/Makefile b/utils/sane-backends/Makefile
new file mode 100644 (file)
index 0000000..7c79db0
--- /dev/null
@@ -0,0 +1,356 @@
+#
+# 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.25
+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/file/4146/
+PKG_MD5SUM:=f9ed5405b3c12f07c6ca51ee60225fe7
+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 \
+      $(call Package/Default)
+      $(call 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: backend name
+#
+# If there is no config deps on $(1), returns +sane-$(1).
+# Otherwise, +(CONFIG1&&CONFIG2&&..):sane-$(1)
+define SaneBackendDependency
+    $(eval \
+        $(call Package/Default)
+        $(call Package/sane-$(1))
+        FILTER_CONFIG:=$$(strip \
+            $$(foreach config_dep, \
+                $$(filter @%, \
+                    $$(foreach v, \
+                        $$(DEPENDS), \
+                        $$(if $$(findstring :,$$v),,$$v) \
+                    ) \
+                ), \
+                $$(subst @,,$$(config_dep)) \
+            ) \
+        )
+        ifneq (,$$(FILTER_CONFIG))
+           FILTER_CONFIG:=($$(subst $$(space),&&,$$(FILTER_CONFIG))):
+        endif
+    ) \
+    +$(FILTER_CONFIG)sane-$(1)
+endef
+
+define Package/sane-backends-all
+$(call Package/sane-backends/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+= (all backends)
+  DEPENDS:=$(foreach backend,$(SANE_BACKENDS),$(strip $(call SaneBackendDependency,$(backend))))
+  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 +libjpeg +libpng
+  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
+
+CONFIGURE_VARS+= \
+    ac_cv_func_mmap_fixed_mapped="yes" \
+
+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
+
+$(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,epsonds,EPSON scanners,+libjpeg)) ####
+$(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,pieusb,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))
diff --git a/utils/sane-backends/files/xinet.d_sane-port b/utils/sane-backends/files/xinet.d_sane-port
new file mode 100644 (file)
index 0000000..9119973
--- /dev/null
@@ -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
+}
diff --git a/utils/sane-backends/patches/002-remove-uneeded.patch b/utils/sane-backends/patches/002-remove-uneeded.patch
new file mode 100644 (file)
index 0000000..8348058
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -400,7 +400,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 \
diff --git a/utils/sane-backends/patches/020-fix_pieusb.patch b/utils/sane-backends/patches/020-fix_pieusb.patch
new file mode 100644 (file)
index 0000000..ae97040
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/backend/pieusb_buffer.c
++++ b/backend/pieusb_buffer.c
+@@ -104,11 +104,13 @@
+ /* When creating the release backend, make complains about unresolved external
+  * le16toh, although it finds the include <endian.h> */
++#ifndef le16toh
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
+  #define le16toh(x) (x)
+ #else
+  #define le16toh(x) __bswap_16 (x)
+ #endif
++#endif
+ static void buffer_update_read_index(struct Pieusb_Read_Buffer* buffer, int increment);
diff --git a/utils/sane-backends/patches/030-musl.patch b/utils/sane-backends/patches/030-musl.patch
new file mode 100644 (file)
index 0000000..b8dd50e
--- /dev/null
@@ -0,0 +1,61 @@
+--- 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
+--- a/backend/epsonds-io.c
++++ b/backend/epsonds-io.c
+@@ -16,6 +16,7 @@
+ #include "sane/config.h"
+ #include <ctype.h>
+ #include <unistd.h>     /* sleep */
++#include <sys/types.h>
+ #include "epsonds.h"
+ #include "epsonds-io.h"
diff --git a/utils/sane-backends/patches/031-fix_uclibc.patch b/utils/sane-backends/patches/031-fix_uclibc.patch
new file mode 100644 (file)
index 0000000..b7495a5
--- /dev/null
@@ -0,0 +1,38 @@
+--- a/configure.in
++++ b/configure.in
+@@ -279,6 +279,9 @@ dnl ************************************
+ dnl Checks for library functions
+ dnl ***********************************************************************
++dnl Check mkostemp (missing in uclibc)
++AC_CHECK_FUNC(mkostemp)
++
+ dnl Define SOCKET_LIB, NSL_LIB, BIND_LIB, and RESOLV_LIB  when required 
+ dnl for functions we use.
+ AC_CHECK_FUNC(gethostbyaddr,, [AC_CHECK_LIB(bind, gethostbyaddr, BIND_LIB="-lbind")])
+--- a/include/sane/config.h.in
++++ b/include/sane/config.h.in
+@@ -207,6 +207,9 @@
+ /* Define to 1 if you have the `mkdir' function. */
+ #undef HAVE_MKDIR
++/* Define to 1 if you have a working `mkostemp' function. */
++#undef HAVE_MKOSTEMP
++
+ /* Define to 1 if you have a working `mmap' system call. */
+ #undef HAVE_MMAP
+--- a/backend/pieusb_buffer.c
++++ b/backend/pieusb_buffer.c
+@@ -112,6 +112,11 @@
+ #endif
+ #endif
++#ifndef HAVE_MKOSTEMP
++/* uclibc might not implement mkostemp GNU extension */
++#define mkostemp(template, flags) mkstemp(template)
++#endif
++
+ static void buffer_update_read_index(struct Pieusb_Read_Buffer* buffer, int increment);
+ /* READER */
diff --git a/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch b/utils/sane-backends/patches/050-remove_linked_libs_for_unused_preload.patch
new file mode 100644 (file)
index 0000000..bb01dd9
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/backend/Makefile.am
++++ b/backend/Makefile.am
+@@ -1142,7 +1142,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@