Package: libinklevel
Version: 0.6.6~rc5-2
Severity: important
Tags: patch

Hi,

please find attached a patch to fix the FTBFS of your package on
GNU/kFreeBSD:
> gcc -Wall -g -O2 -fPIC -DPIC -I.   -c -o linux.o linux.c
> linux.c: In function 'get_device_id':
> linux.c:75: error: '_IOC_READ' undeclared (first use in this function)
> linux.c:75: error: (Each undeclared identifier is reported only once
> linux.c:75: error: for each function it appears in.)
> make[1]: *** [linux.o] Error 1
> make[1]: Leaving directory `/build/buildd/libinklevel-0.6.6~rc5'
> make: *** [build-stamp] Error 2

Full build logs are available at
<http://experimental.ftbfs.de/build.php?&pkg=libinklevel>.

I've based my patch on the following defines:

,---[linux: /usr/include/asm-generic/ioctl.h]---
| /*
|  * Direction bits.
|  */
| #define _IOC_NONE       0U
| #define _IOC_WRITE      1U
| #define _IOC_READ       2U
| 
| #define _IOC(dir,type,nr,size) \
|         (((dir)  << _IOC_DIRSHIFT) | \
|          ((type) << _IOC_TYPESHIFT) | \
|          ((nr)   << _IOC_NRSHIFT) | \
|          ((size) << _IOC_SIZESHIFT))
|
`---

,---[kfreebsd: /usr/include/sys/ioccom.h]---
| #define IOCPARM_MAX     PAGE_SIZE               /* max size of ioctl, mult. 
of PAGE_SIZE */
| #define IOC_VOID        0x20000000      /* no parameters */
| #define IOC_OUT         0x40000000      /* copy out parameters */
| #define IOC_IN          0x80000000      /* copy in parameters */
| #define IOC_INOUT       (IOC_IN|IOC_OUT)
| #define IOC_DIRMASK     (IOC_VOID|IOC_OUT|IOC_IN)
| 
| #define _IOC(inout,group,num,len) \
|         ((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 
8) | (num)))
| #define _IO(g,n)        _IOC(IOC_VOID,  (g), (n), 0)
| #define _IOWINT(g,n)    _IOC(IOC_VOID,  (g), (n), sizeof(int))
| #define _IOR(g,n,t)     _IOC(IOC_OUT,   (g), (n), sizeof(t))
| #define _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
| /* this should be _IORW, but stdio got there first */
| #define _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
`---

Cheers,

-- 
Cyril Brulebois
--- libinklevel-0.6.6~rc5~/linux.c	2006-09-10 17:41:52.000000000 +0200
+++ libinklevel-0.6.6~rc5/linux.c	2007-03-27 02:24:42.000000000 +0200
@@ -18,6 +18,10 @@
 #include <string.h>
 #include <sys/ioctl.h>
 
+#if defined(__FreeBSD_kernel__)
+#define _IOC_READ IOC_OUT
+#endif
+
 #define IOCNR_GET_DEVICE_ID 1
 #define LPIOC_GET_DEVICE_ID _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, BUFLEN)
 

Reply via email to