Package: qpxtool / 0.7.2-4

06-make-port-for-hurd-i386.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Description: Make port for Debian GNU/Hurd
Author: Boris Pek <tehnick-8@mail.ru>
Last-Update: 2014-04-12

--- a/configure
+++ b/configure
@@ -784,6 +784,12 @@
 		OSLIBS_THREAD="-lpthread"
 		__defprefix="/usr/local"
 		;;
+	gnu)
+		OSDEFS="-fPIC"
+		OSLIBS_DL="-ldl"
+		OSLIBS_THREAD="-lpthread"
+		__defprefix="/usr"
+		;;
 	darwin)
 		OSDEFS="-D__unix -fPIC"
 		OSLIBS_THREAD="-lpthread"
@@ -828,7 +841,7 @@
 BHOST=`uname -srv`
 
 case "$OSL" in
-	linux|gnu/kfreebsd)
+	linux|gnu/kfreebsd|gnu)
 		__bindir=$__prefix/bin
 		__sbindir=$__prefix/sbin
 		if test "$ARCH" = "x86_64" ; then
--- a/lib/qpxtransport/include/qpx_transport.h
+++ b/lib/qpxtransport/include/qpx_transport.h
@@ -90,14 +90,20 @@
 	operator unsigned char *()		{ return ptr; }
 };
 
-#if defined(__linux)
+#if defined(__linux) || defined(__GNU__)
 
 //#include <sys/ioctl.h>
+#if defined(__linux)
 #include <linux/cdrom.h>
+#elif defined(__GNU__)
+#include <sys/cdrom.h>
+#endif
 //#include <mntent.h>
 //#include <sys/wait.h>
 //#include <sys/utsname.h>
+#if defined(__linux)
 #include <scsi/sg.h>
+#endif
 #if !defined(SG_FLAG_LUN_INHIBIT)
 # if defined(SG_FLAG_UNUSED_LUN_INHIBIT)
 #  define SG_FLAG_LUN_INHIBIT SG_FLAG_UNUSED_LUN_INHIBIT
--- a/lib/qpxtransport/qpx_transport.cpp
+++ b/lib/qpxtransport/qpx_transport.cpp
@@ -133,16 +136,22 @@ autofree::autofree()
 autofree::~autofree()
 	{ if (ptr) free(ptr); }
 
-#if defined(__linux)
+#if defined(__linux) || defined(__GNU__)
 
 #include <limits.h>
-#include <sys/ioctl.h>
+#if defined(__linux)
 #include <linux/cdrom.h>
+#elif defined(__GNU__)
+#include <sys/cdrom.h>
+#endif
+#include <sys/ioctl.h>
 #include <mntent.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/utsname.h>
+#if defined(__linux)
 #include <scsi/sg.h>
+#endif
 #if !defined(SG_FLAG_LUN_INHIBIT)
 # if defined(SG_FLAG_UNUSED_LUN_INHIBIT)
 #  define SG_FLAG_LUN_INHIBIT SG_FLAG_UNUSED_LUN_INHIBIT
@@ -235,11 +246,13 @@ int Scsi_Command::transport(Direction dir,void *buf,size_t sz)
 		cgc.buffer		= (unsigned char *)buf;
 		cgc.buflen		= sz;
 		cgc.data_direction	= dir;
+#if !defined(__GNU__)
 		if (ioctl (fd,CDROM_SEND_PACKET,&cgc))
 		{
 			ret = ERRCODE(_sense.u);
 			if (ret==0) ret=-1;
 		}
+#endif
 	}
 	return ret;
 }