shithub: libdvdcss

Download patch

ref: 50899042baa76832eeead4ab35fe0d49c4dd0b85
parent: 80e3a9ea47d8d5358e4012e830bc500f0a1bb45e
author: Sam Hocevar <[email protected]>
date: Thu Dec 19 07:37:30 EST 2002

* Ported the library build to Cygwin.


--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,7 @@
     ;;
   x*cygwin*)
     AC_DEFINE(SYS_CYGWIN, 1, Have a Cygwin system.)
+    AC_DEFINE(WIN32, 1, Using Win32.)
     ;;
   xbeos*)
     AC_DEFINE(SYS_BEOS, 1, Have a BeOS system.)
@@ -46,8 +47,15 @@
 CAN_BUILD_LIBDVDCSS=0
 
 dnl  for windoze
-AC_CHECK_HEADERS(winioctl.h,[
-  CAN_BUILD_LIBDVDCSS=1
+AC_CHECK_HEADERS(windows.h,[
+  AC_CHECK_HEADERS(direct.h,,,[
+  #include <windows.h>
+  ])
+  AC_CHECK_HEADERS(winioctl.h,[
+    CAN_BUILD_LIBDVDCSS=1
+  ],,[
+  #include <windows.h>
+  ])
 ])
 
 dnl  for Un*x and BeOS
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -7,6 +7,7 @@
 /* #undef DVD_STRUCT_IN_SYS_CDIO_H */
 /* #undef DVD_STRUCT_IN_SYS_DVDIO_H */
 /* #undef HAVE_BSD_DVD_STRUCT */
+#define HAVE_DIRECT_H 1
 #define HAVE_DLFCN_H 1
 /* #undef HAVE_DVD_H */
 /* #undef HAVE_INTTYPES_H */
@@ -25,6 +26,7 @@
 #define HAVE_SYS_STAT_H 1
 #define HAVE_SYS_TYPES_H 1
 /* #undef HAVE_UNISTD_H */
+#define HAVE_WINDOWS_H 1
 #define HAVE_WINIOCTL_H 1
 /* #undef HAVE__SYS_DEV_SCSI_SCSI_IOCTL_H */
 /* #undef HPUX_SCTL_IO */
--- a/src/device.c
+++ b/src/device.c
@@ -2,7 +2,7 @@
  * device.h: DVD device access
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: device.c,v 1.11 2002/12/11 13:12:10 sam Exp $
+ * $Id: device.c,v 1.12 2002/12/19 12:37:30 sam Exp $
  *
  * Authors: St�phane Borel <[email protected]>
  *          Samuel Hocevar <[email protected]>
@@ -46,7 +46,7 @@
 #   include <limits.h>
 #endif
 
-#if defined( WIN32 )
+#if defined( WIN32 ) && !defined( SYS_CYGWIN )
 #   include <io.h>                                                 /* read() */
 #else
 #   include <sys/uio.h>                                      /* struct iovec */
--- a/src/device.h
+++ b/src/device.h
@@ -2,7 +2,7 @@
  * device.h: DVD device access
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: device.h,v 1.6 2002/12/05 10:24:42 sam Exp $
+ * $Id: device.h,v 1.7 2002/12/19 12:37:30 sam Exp $
  *
  * Authors: St�phane Borel <[email protected]>
  *          Samuel Hocevar <[email protected]>
@@ -26,7 +26,7 @@
 /*****************************************************************************
  * iovec structure: vectored data entry
  *****************************************************************************/
-#if defined( WIN32 )
+#if defined( WIN32 ) && !defined( SYS_CYGWIN )
 #   include <io.h>                                                 /* read() */
 #else
 #   include <sys/types.h>
@@ -33,7 +33,7 @@
 #   include <sys/uio.h>                                      /* struct iovec */
 #endif
 
-#if defined( WIN32 )
+#if defined( WIN32 ) && !defined( SYS_CYGWIN )
 struct iovec
 {
     void *iov_base;     /* Pointer to data. */
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -5,7 +5,7 @@
  *          H�kan Hjort <[email protected]>
  *
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libdvdcss.c,v 1.24 2002/12/11 13:12:10 sam Exp $
+ * $Id: libdvdcss.c,v 1.25 2002/12/19 12:37:30 sam Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,7 +110,7 @@
 #   include <limits.h>
 #endif
 
-#ifdef WIN32
+#ifdef HAVE_DIRECT_H
 #   include <direct.h>
 #endif
 
@@ -361,7 +361,7 @@
 
         /* We have a disc name or ID, we can create the cache dir */
         i = sprintf( dvdcss->psz_cachefile, "%s", psz_cache );
-#ifndef WIN32
+#if !defined( WIN32 ) || defined( SYS_CYGWIN )
         i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
 #else
         i_ret = mkdir( dvdcss->psz_cachefile );
@@ -374,7 +374,7 @@
         }
 
         i += sprintf( dvdcss->psz_cachefile + i, "/%s/", psz_data );
-#ifndef WIN32
+#if !defined( WIN32 ) || defined( SYS_CYGWIN )
         i_ret = mkdir( dvdcss->psz_cachefile, 0755 );
 #else
         i_ret = mkdir( dvdcss->psz_cachefile );
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -1,8 +1,8 @@
 /*****************************************************************************
- * private.h: private DVD reading library data
+ * libdvdcss.h: private DVD reading library data
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.h,v 1.7 2002/12/05 10:24:42 sam Exp $
+ * $Id: libdvdcss.h,v 1.8 2002/12/19 12:37:30 sam Exp $
  *
  * Authors: St�phane Borel <[email protected]>
  *          Samuel Hocevar <[email protected]>