Re: [linux-minidisc] using libusal for scsi access
On Fri, Apr 30, 2010 at 01:41:55PM +0200, Adrian Glaubitz wrote:
> On Sun, Apr 25, 2010 at 06:44:33PM +0200, Adrian Glaubitz wrote:
> > > Here is a thread of the cdrkit mailing list which might help you compiling
> > > cdrkit/libusal on mac.
> > > http://lists.alioth.debian.org/pipermail/debburn-devel/2008-October/000600.html
> >
> > Hmm, unfortunately I still get a lot of erros during compilation. I
> > will try getting in contact with the patch author, maybe he knows
> > what's wrong. I presume that his patch was written for an earlier
> > version of cdrkit. I will report back once I got a reply from him.
>
> Ok, finally managed to get it compile after patching the cdrkit
> sources in several places. I'm attaching the appropriate
> patch.
> (...)
I have updated my patch so it won't break the build on Linux. Tested
it with Debian Squeeze. Furthermore, I reported the issue with the
build on MacOS X to the Debian bug tracker [1].
Adrian
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580615
diff -ru cdrkit-1.1.10/genisoimage/sha256.c cdrkit-1.1.10-mac/genisoimage/sha256.c
--- cdrkit-1.1.10/genisoimage/sha256.c 2009-10-11 20:27:59.000000000 +0200
+++ cdrkit-1.1.10-mac/genisoimage/sha256.c 2010-05-07 09:29:21.000000000 +0200
@@ -24,7 +24,11 @@
/* Written by Ulrich Drepper <drepper@redhat.com>, 2007. */
+#if defined(__APPLE__)
+#include <machine/endian.h>
+#else
#include <endian.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
diff -ru cdrkit-1.1.10/genisoimage/sha256.h cdrkit-1.1.10-mac/genisoimage/sha256.h
--- cdrkit-1.1.10/genisoimage/sha256.h 2009-05-10 23:49:54.000000000 +0200
+++ cdrkit-1.1.10-mac/genisoimage/sha256.h 2010-05-07 09:31:21.000000000 +0200
@@ -28,7 +28,9 @@
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
-
+#if defined(__APPLE__)
+#define __THROW
+#endif
/* Structure to save state of computation between the single steps. */
struct sha256_ctx
diff -ru cdrkit-1.1.10/genisoimage/sha512.c cdrkit-1.1.10-mac/genisoimage/sha512.c
--- cdrkit-1.1.10/genisoimage/sha512.c 2009-10-11 20:27:59.000000000 +0200
+++ cdrkit-1.1.10-mac/genisoimage/sha512.c 2010-05-07 09:29:39.000000000 +0200
@@ -24,7 +24,11 @@
/* Written by Ulrich Drepper <drepper@redhat.com>, 2007. */
+#if defined(__APPLE__)
+#include <machine/endian.h>
+#else
#include <endian.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
diff -ru cdrkit-1.1.10/genisoimage/sha512.h cdrkit-1.1.10-mac/genisoimage/sha512.h
--- cdrkit-1.1.10/genisoimage/sha512.h 2009-05-10 23:49:54.000000000 +0200
+++ cdrkit-1.1.10-mac/genisoimage/sha512.h 2010-05-07 09:31:41.000000000 +0200
@@ -28,7 +28,9 @@
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
-
+#if defined(__APPLE__)
+#define __THROW
+#endif
/* Structure to save state of computation between the single steps. */
struct sha512_ctx
diff -ru cdrkit-1.1.10/include/AddScgBits.cmake cdrkit-1.1.10-mac/include/AddScgBits.cmake
--- cdrkit-1.1.10/include/AddScgBits.cmake 2006-11-23 19:57:28.000000000 +0100
+++ cdrkit-1.1.10-mac/include/AddScgBits.cmake 2010-05-07 09:32:43.000000000 +0200
@@ -1,5 +1,5 @@
-IF(NOT GUARD_SCGCONFIG)
+If(NOT GUARD_SCGCONFIG)
SET(GUARD_SCGCONFIG 1)
@@ -58,8 +58,18 @@
CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBC_SCHED)
IF(NOT LIBC_SCHED)
- LIST(APPEND EXTRA_LIBS -lrt)
- #MESSAGE("Using librt for realtime functions")
+ SET(CMAKE_REQUIRED_LIBRARIES librt)
+ CHECK_C_SOURCE_COMPILES("${TESTSRC}" LIBRT_SCHED)
+ IF(LIBRT_SCHED)
+ LIST(APPEND EXTRA_LIBS -lrt)
+ #MESSAGE("Using librt for realtime functions")
+ ENDIF(LIBRT_SCHED)
ENDIF(NOT LIBC_SCHED)
+IF(APPLE)
+ FIND_LIBRARY(COREFOUNDATION CoreFoundation)
+ FIND_LIBRARY(IOKIT IOKit)
+ LIST(APPEND EXTRA_LIBS ${COREFOUNDATION} ${IOKIT})
+ENDIF(APPLE)
+
ENDIF(NOT GUARD_SCGCONFIG)
diff -ru cdrkit-1.1.10/libusal/scsi-mac-iokit.c cdrkit-1.1.10-mac/libusal/scsi-mac-iokit.c
--- cdrkit-1.1.10/libusal/scsi-mac-iokit.c 2006-12-08 14:38:43.000000000 +0100
+++ cdrkit-1.1.10-mac/libusal/scsi-mac-iokit.c 2010-05-07 09:32:43.000000000 +0200
@@ -62,7 +62,7 @@
#include <Carbon/Carbon.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/IOCFPlugIn.h>
-#include <IOKit/scsi-commands/SCSITaskLib.h>
+#include <IOKit/scsi/SCSITaskLib.h>
#include <mach/mach_error.h>
struct usal_local {