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
@@ -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 \
@@ -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
@@ -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)
@@ -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
@@ -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} "
@@ -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@
@@ -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;
@@ -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