Subject: pkg/21106: graphics/sane-backends doesn't work on m68k/ELF
To: None <gnats-bugs@gnats.netbsd.org>
From: None <khym@azeotrope.org>
List: netbsd-bugs
Date: 04/11/2003 18:53:32
>Number:         21106
>Category:       pkg
>Synopsis:       graphics/sane-backends doesn't work on m68k/ELF
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 11 16:55:00 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Dave Huang
>Release:        NetBSD 1.6, current pkgsrc
>Organization:
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 27 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Environment:
	
	
System: NetBSD gedd.azeotrope.org 1.6 NetBSD 1.6 (GEDD) #2: Tue Sep 24 04:50:14 CDT 2002 khym@yerfable.azeotrope.org:/usr2/obj.mac68k/GEDD mac68k
Architecture: m68k
Machine: mac68k
>Description:
	sane-backends stopped working after mac68k switched from a.out
to ELF--it claimed that no scanners could be found. Turns out the
problem is that the new ABI changed how function return values are
returned. Integral types are returned in the D0 register, but pointers
are returned in A0 (with a.out, everything was returned in D0). SANE
uses function pointers to call functions in the various scanner driver
shared libs, but the caller declares the functions are returning a
(void *), whereas the actual functions usually return an int. This
causes problems since the driver functions are returning their results
in D0, but the caller is looking for the results in A0.
>How-To-Repeat:
	Try to run sane on NetBSD 1.6/mac68k (or any other m68k ELF
port).
>Fix:
	This updates the package to sane-backends-1.0.11, and includes
patch-ab to fix the problem (that patch has also been sent to the
sane-devel mailing list).

NOTE: This breaks the sane-frontends package! Sane-frontends is only
at version 1.0.10, and has been split off into its own directory on
the ftp site, so perhaps having a Makefile.common no longer makes any
sense?

Index: Makefile.common
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/sane-backends/Makefile.common,v
retrieving revision 1.6
diff -u -r1.6 Makefile.common
--- Makefile.common	2002/12/16 17:59:05	1.6
+++ Makefile.common	2003/04/11 23:35:51
@@ -1,17 +1,17 @@
 # $NetBSD: Makefile.common,v 1.6 2002/12/16 17:59:05 tron Exp $
 
 CATEGORIES?=	graphics
-MASTER_SITES?=	ftp://ftp.mostang.com/pub/sane/sane-${SANE_VERSION}/ \
-		ftp://ftp.mostang.com/pub/sane/old-versions/sane-${SANE_VERSION}/ \
-		ftp://gd.tuwien.ac.at/hci/sane/sane-${SANE_VERSION}/ \
-		ftp://ftp.informatik.uni-oldenburg.de/pub/sane/sane-${SANE_VERSION}/
+MASTER_SITES?=	ftp://ftp.mostang.com/pub/sane/sane-backends-${SANE_VERSION}/ \
+		ftp://ftp.mostang.com/pub/sane/old-versions/sane-backends-${SANE_VERSION}/ \
+		ftp://gd.tuwien.ac.at/hci/sane/sane-backends-${SANE_VERSION}/ \
+		ftp://ftp.informatik.uni-oldenburg.de/pub/sane/sane-backends-${SANE_VERSION}/
 
 MAINTAINER?=	packages@netbsd.org
 HOMEPAGE?=	http://www.mostang.com/sane/
 
 SANE_MAJOR=	1
 SANE_MINOR=	0
-SANE_MICRO=	9
+SANE_MICRO=	11
 SANE_VERSION=	${SANE_MAJOR}.${SANE_MINOR}.${SANE_MICRO}
 PLIST_SUBST+=	SANE_MAJOR=${SANE_MAJOR}
 PLIST_SUBST+=	SANE_MINOR=${SANE_MINOR}
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/sane-backends/PLIST,v
retrieving revision 1.6
diff -u -r1.6 PLIST
--- PLIST	2002/12/16 17:59:05	1.6
+++ PLIST	2003/04/11 23:35:52
@@ -7,6 +7,7 @@
 etc/sane.d/agfafocus.conf
 etc/sane.d/apple.conf
 etc/sane.d/artec.conf
+etc/sane.d/artec_eplus48u.conf
 etc/sane.d/avision.conf
 etc/sane.d/bh.conf
 etc/sane.d/canon.conf
@@ -20,6 +21,7 @@
 etc/sane.d/dmc.conf
 etc/sane.d/epson.conf
 etc/sane.d/fujitsu.conf
+etc/sane.d/gt68xx.conf
 etc/sane.d/hp.conf
 etc/sane.d/leo.conf
 etc/sane.d/matsushita.conf
@@ -75,6 +77,11 @@
 lib/sane/libsane-artec.so
 lib/sane/libsane-artec.so.${SANE_MAJOR}
 lib/sane/libsane-artec.so.${SANE_MAJOR}.${SANE_MICRO}
+lib/sane/libsane-artec_eplus48u.a
+lib/sane/libsane-artec_eplus48u.la
+lib/sane/libsane-artec_eplus48u.so
+lib/sane/libsane-artec_eplus48u.so.${SANE_MAJOR}
+lib/sane/libsane-artec_eplus48u.so.${SANE_MAJOR}.${SANE_MICRO}
 lib/sane/libsane-as6e.a
 lib/sane/libsane-as6e.la
 lib/sane/libsane-as6e.so
@@ -145,6 +152,11 @@
 lib/sane/libsane-fujitsu.so
 lib/sane/libsane-fujitsu.so.${SANE_MAJOR}
 lib/sane/libsane-fujitsu.so.${SANE_MAJOR}.${SANE_MICRO}
+lib/sane/libsane-gt68xx.a
+lib/sane/libsane-gt68xx.la
+lib/sane/libsane-gt68xx.so
+lib/sane/libsane-gt68xx.so.${SANE_MAJOR}
+lib/sane/libsane-gt68xx.so.${SANE_MAJOR}.${SANE_MICRO}
 lib/sane/libsane-hp.a
 lib/sane/libsane-hp.la
 lib/sane/libsane-hp.so
@@ -355,7 +367,6 @@
 share/doc/sane-${SANE_VERSION}/AUTHORS
 share/doc/sane-${SANE_VERSION}/COPYING
 share/doc/sane-${SANE_VERSION}/ChangeLog
-share/doc/sane-${SANE_VERSION}/LEVEL2
 share/doc/sane-${SANE_VERSION}/LICENSE
 share/doc/sane-${SANE_VERSION}/NEWS
 share/doc/sane-${SANE_VERSION}/PROBLEMS
@@ -377,10 +388,16 @@
 share/doc/sane-${SANE_VERSION}/backend-writing.txt
 share/doc/sane-${SANE_VERSION}/canon/canon.changes
 share/doc/sane-${SANE_VERSION}/canon/canon.install2700F.txt
+share/doc/sane-${SANE_VERSION}/gt68xx/gt68xx.CHANGES
+share/doc/sane-${SANE_VERSION}/leo/leo.txt
 share/doc/sane-${SANE_VERSION}/matsushita/matsushita.txt
 share/doc/sane-${SANE_VERSION}/mustek/mustek.CHANGES
 share/doc/sane-${SANE_VERSION}/mustek_usb/mustek_usb.CHANGES
 share/doc/sane-${SANE_VERSION}/mustek_usb/mustek_usb.TODO
+share/doc/sane-${SANE_VERSION}/plustek/Plustek-PARPORT.txt
+share/doc/sane-${SANE_VERSION}/plustek/Plustek-USB-TODO.txt
+share/doc/sane-${SANE_VERSION}/plustek/Plustek-USB.txt
+share/doc/sane-${SANE_VERSION}/plustek/Plustek.changes
 share/doc/sane-${SANE_VERSION}/sceptre/s1200.txt
 share/doc/sane-${SANE_VERSION}/teco/teco1.txt
 share/doc/sane-${SANE_VERSION}/teco/teco2.txt
@@ -418,12 +435,21 @@
 share/doc/sane-${SANE_VERSION}/umax/umax.CHANGES
 share/doc/sane-${SANE_VERSION}/umax/umax.FAQ
 share/doc/sane-${SANE_VERSION}/umax/umax.TODO
+share/locale/de/LC_MESSAGES/sane-backends.mo
+share/locale/es/LC_MESSAGES/sane-backends.mo
+share/locale/fr/LC_MESSAGES/sane-backends.mo
+share/locale/pt/LC_MESSAGES/sane-backends.mo
+share/locale/ru/LC_MESSAGES/sane-backends.mo
+share/locale/sv/LC_MESSAGES/sane-backends.mo
 @dirrm share/doc/sane-${SANE_VERSION}/umax
 @dirrm share/doc/sane-${SANE_VERSION}/teco
 @dirrm share/doc/sane-${SANE_VERSION}/sceptre
+@dirrm share/doc/sane-${SANE_VERSION}/plustek
 @dirrm share/doc/sane-${SANE_VERSION}/mustek_usb
 @dirrm share/doc/sane-${SANE_VERSION}/mustek
 @dirrm share/doc/sane-${SANE_VERSION}/matsushita
+@dirrm share/doc/sane-${SANE_VERSION}/leo
+@dirrm share/doc/sane-${SANE_VERSION}/gt68xx
 @dirrm share/doc/sane-${SANE_VERSION}/canon
 @dirrm share/doc/sane-${SANE_VERSION}
 @dirrm lib/sane
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/sane-backends/distinfo,v
retrieving revision 1.11
diff -u -r1.11 distinfo
--- distinfo	2002/12/16 17:59:05	1.11
+++ distinfo	2003/04/11 23:35:52
@@ -1,5 +1,6 @@
 $NetBSD: distinfo,v 1.11 2002/12/16 17:59:05 tron Exp $
 
-SHA1 (sane-backends-1.0.9.tar.gz) = cbfcf4abb805065821f4c9aef64765b0563255aa
-Size (sane-backends-1.0.9.tar.gz) = 2289976 bytes
-SHA1 (patch-aa) = 32070ca6afef7f96a1fa291857598cf116cbeeae
+SHA1 (sane-backends-1.0.11.tar.gz) = 33d534b140506d695eb8acb5040bd24be585288b
+Size (sane-backends-1.0.11.tar.gz) = 2541246 bytes
+SHA1 (patch-aa) = 9f7e71130edb3409f69dffebd7d10cb7d65bc8d2
+SHA1 (patch-ab) = adfba4b663bd42ff352d46290c4f890a2b090ab7
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/sane-backends/patches/patch-aa,v
retrieving revision 1.7
diff -u -r1.7 patch-aa
--- patches/patch-aa	2002/12/16 17:59:06	1.7
+++ patches/patch-aa	2003/04/11 23:35:52
@@ -1,8 +1,6 @@
-$NetBSD: patch-aa,v 1.7 2002/12/16 17:59:06 tron Exp $
-
---- doc/Makefile.in.orig	Tue Oct 15 13:52:38 2002
-+++ doc/Makefile.in	Mon Dec 16 18:15:37 2002
-@@ -24,7 +24,7 @@
+--- doc/Makefile.in.orig	Fri Jan 31 14:10:23 2003
++++ doc/Makefile.in	Fri Apr 11 18:11:14 2003
+@@ -25,7 +25,7 @@
  includedir = @includedir@
  oldincludedir = /usr/include
  configdir = ${sysconfdir}/sane.d
@@ -11,21 +9,21 @@
  
  MKDIR = $(top_srcdir)/mkinstalldirs
  INSTALL = @INSTALL@
-@@ -56,7 +56,7 @@
+@@ -57,7 +57,7 @@
            PROJECTS README README.aix README.beos README.darwin README.freebsd \
            README.hp-ux README.linux README.netbsd README.openbsd README.os2 \
            README.solaris README.unixware2 README.unixware7 TODO
 -DOCS    = backend-writing.txt sane.ps sane.dvi
 +DOCS    = backend-writing.txt
- BACKDIRS= canon matsushita mustek mustek_usb umax sceptre teco
+ BACKDIRS= canon leo matsushita mustek mustek_usb plustek umax sceptre teco gt68xx
  LATEX	= TEXINPUTS=$(srcdir):$$TEXINPUTS latex
  DLH	= TEXINPUTS=$(srcdir):$$TEXINPUTS dlh
-@@ -92,7 +92,7 @@
+@@ -93,7 +93,7 @@
  .PHONY: all clean depend dist distclean html html-man install \
    install-mostang sane-html uninstall
  
--all: sane.ps $(MANPAGES) 
-+all: $(MANPAGES) 
+-all: sane.ps $(MANPAGES)
++all: $(MANPAGES)
  
  %.1 %.5 %.7: %.man
  	@sed -e 's|@DATADIR@|$(datadir)|g' \
--- /dev/null	Fri Apr 11 18:35:56 2003
+++ patches/patch-ab	Fri Apr 11 17:50:37 2003
@@ -0,0 +1,81 @@
+--- backend/dll.c.orig	Wed Dec  4 14:30:26 2002
++++ backend/dll.c	Fri Apr 11 17:50:23 2003
+@@ -481,7 +481,7 @@
+ 
+   DBG (3, "init: initializing backend `%s'\n", be->name);
+ 
+-  status = (long) (*be->op[OP_INIT]) (&version, auth_callback);
++  status = (*(SANE_Status(*)())be->op[OP_INIT]) (&version, auth_callback);
+   if (status != SANE_STATUS_GOOD)
+     return status;
+ 
+@@ -790,7 +790,7 @@
+ 	if (init (be) != SANE_STATUS_GOOD)
+ 	  continue;
+ 
+-      status = (long) (*be->op[OP_GET_DEVS]) (&be_list, local_only);
++      status = (*(SANE_Status(*)())be->op[OP_GET_DEVS]) (&be_list, local_only);
+       if (status != SANE_STATUS_GOOD || !be_list)
+ 	continue;
+ 
+@@ -929,7 +929,7 @@
+ 	return status;
+     }
+ 
+-  status = (long) (*be->op[OP_OPEN]) (dev_name, &handle);
++  status = (*(SANE_Status(*)())be->op[OP_OPEN]) (dev_name, &handle);
+   if (status != SANE_STATUS_GOOD)
+     return status;
+ 
+@@ -973,7 +973,7 @@
+   DBG (3,
+        "sane_control_option(handle=%p,option=%d,action=%d,value=%p,info=%p)\n",
+        handle, option, action, value, info);
+-  return (long) (*s->be->op[OP_CTL_OPTION]) (s->handle, option, action, value,
++  return (*(SANE_Status(*)())s->be->op[OP_CTL_OPTION]) (s->handle, option, action, value,
+ 					     info);
+ }
+ 
+@@ -983,7 +983,7 @@
+   struct meta_scanner *s = handle;
+ 
+   DBG (3, "sane_get_parameters(handle=%p,params=%p)\n", handle, params);
+-  return (long) (*s->be->op[OP_GET_PARAMS]) (s->handle, params);
++  return (*(SANE_Status(*)())s->be->op[OP_GET_PARAMS]) (s->handle, params);
+ }
+ 
+ SANE_Status
+@@ -992,7 +992,7 @@
+   struct meta_scanner *s = handle;
+ 
+   DBG (3, "sane_start(handle=%p)\n", handle);
+-  return (long) (*s->be->op[OP_START]) (s->handle);
++  return (*(SANE_Status(*)())s->be->op[OP_START]) (s->handle);
+ }
+ 
+ SANE_Status
+@@ -1003,7 +1003,7 @@
+ 
+   DBG (3, "sane_read(handle=%p,data=%p,maxlen=%d,lenp=%p)\n",
+        handle, data, max_length, length);
+-  return (long) (*s->be->op[OP_READ]) (s->handle, data, max_length, length);
++  return (*(SANE_Status(*)())s->be->op[OP_READ]) (s->handle, data, max_length, length);
+ }
+ 
+ void
+@@ -1022,7 +1022,7 @@
+ 
+   DBG (3, "sane_set_io_mode(handle=%p,nonblocking=%d)\n", handle,
+        non_blocking);
+-  return (long) (*s->be->op[OP_SET_IO_MODE]) (s->handle, non_blocking);
++  return (*(SANE_Status(*)())s->be->op[OP_SET_IO_MODE]) (s->handle, non_blocking);
+ }
+ 
+ SANE_Status
+@@ -1031,5 +1031,5 @@
+   struct meta_scanner *s = handle;
+ 
+   DBG (3, "sane_get_select_fd(handle=%p,fdp=%p)\n", handle, fd);
+-  return (long) (*s->be->op[OP_GET_SELECT_FD]) (s->handle, fd);
++  return (*(SANE_Status(*)())s->be->op[OP_GET_SELECT_FD]) (s->handle, fd);
+ }
>Release-Note:
>Audit-Trail:
>Unformatted: