Contribs: add dvdread
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 6 Aug 2011 15:05:39 +0000 (17:05 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 6 Aug 2011 15:15:50 +0000 (17:15 +0200)
contrib/src/dvdread/dvdread-css-static.patch [new file with mode: 0644]
contrib/src/dvdread/dvdread-win32.patch [new file with mode: 0644]
contrib/src/dvdread/rules.mak [new file with mode: 0644]

diff --git a/contrib/src/dvdread/dvdread-css-static.patch b/contrib/src/dvdread/dvdread-css-static.patch
new file mode 100644 (file)
index 0000000..e94b23e
--- /dev/null
@@ -0,0 +1,84 @@
+Index: dvdread/configure.ac
+===================================================================
+--- dvdread/configure.ac       (revision 1162)
++++ dvdread/configure.ac       (working copy)
+@@ -137,27 +137,59 @@
+ dnl ---------------------------------------------
+ dnl dynamic linker
+ dnl ---------------------------------------------
+-case $host in
+-  *mingw32*)
+-    CFLAGS="-idirafter \$(top_srcdir)/msvc/include $CFLAGS"
+-    LDFLAGS="-no-undefined $LDFLAGS"
+-    ;;
+-  *cygwin*)
+-    LDFLAGS="-no-undefined $LDFLAGS"
+-    ;;
+-  *os2*)
+-    LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
+-    ;;
+-  *)
+-    AC_CHECK_LIB(c, dlopen,
+-                 DYNAMIC_LD_LIBS="",
+-                 AC_CHECK_LIB(dl, dlopen,
+-                              DYNAMIC_LD_LIBS="-ldl",
+-                              AC_MSG_ERROR(dynamic linker needed)))
+-    AC_SUBST(DYNAMIC_LD_LIBS)
+-    ;;
+-esac
++AC_ARG_WITH( [libdvdcss],
++    [  --with-libdvdcss[=PATH]    force linking against libdvdcss],
++    [if test x"$withval" != xno; then
++       link_dvdcss=yes
++     fi
++     if test x"$withval" != xyes; then
++       dvdcss_path=$withval
++     fi])
++if test x"$link_dvdcss" != xyes; then
++dnl dlopen libdvdcss
++  AC_CHECK_FUNC( dlopen,
++    [DL_LIBS="" ],
++    AC_CHECK_LIB( dl, dlopen,
++      [DL_LIBS=-ld ],
++      AC_MSG_ERROR(You need libdl (dlopen))
++    )
++  )
++else
++dnl link with libdvdcss
++  if test -z "$dvdcss_path"; then
++    AC_CHECK_LIB(dvdcss, dvdcss_interface_2,
++      [ CSS_LIBS=-ldvdcss ],
++      AC_MSG_ERROR(You need libdvdcss.so.2 or later)
++    )
++    AC_CHECK_HEADERS(dvdcss/dvdcss.h,
++      [ ],
++      AC_MSG_ERROR(You need libdvdcss (dvdcss.h))
++    )
++  else
++    saved_CFLAGS=$CFLAGS
++    CFLAGS="$CFLAGS -L$dvdcss_path/lib"
++    AC_CHECK_LIB(dvdcss, dvdcss_interface_2,
++      [ CSS_LIBS="-L$dvdcss_path/lib -R$dvdcss_path/lib -ldvdcss"
++        CSS_CFLAGS=-I$dvdcss_path/include ],
++      AC_MSG_ERROR(You need libdvdcss.so.2 or later)
++    )
++    CFLAGS=$saved_CFLAGS
++    dnl -w added to shutup GCC3.1's cpp warning about -I/usr/local
++    saved_CPPFLAGS=$CPPFLAGS
++    CPPFLAGS="-w $CPPFLAGS -I$dvdcss_path/include"
++    AC_CHECK_HEADERS(dvdcss/dvdcss.h,
++      [ ],
++      AC_MSG_ERROR(You need libdvdcss (dvdcss.h))
++    )
++    CPPFLAGS=$saved_CPPFLAGS
++  fi
++fi
++
++AC_SUBST(DL_LIBS)
++AC_SUBST(CSS_LIBS)
++AC_SUBST(CSS_CFLAGS)
++
+ dnl ---------------------------------------------
+ dnl cflags
+ dnl ---------------------------------------------
diff --git a/contrib/src/dvdread/dvdread-win32.patch b/contrib/src/dvdread/dvdread-win32.patch
new file mode 100644 (file)
index 0000000..94d714d
--- /dev/null
@@ -0,0 +1,33 @@
+Index: dvdread/src/dvd_reader.c
+===================================================================
+--- dvdread/src/dvd_reader.c   (revision 1157)
++++ dvdread/src/dvd_reader.c   (working copy)
+@@ -34,6 +34,7 @@
+ #include <limits.h>
+ #include <dirent.h>
++#if 0
+ /* misc win32 helpers */
+ #ifdef WIN32
+ #ifndef HAVE_GETTIMEOFDAY
+@@ -52,6 +53,7 @@
+ #include <io.h> /* read() */
+ #define lseek64 _lseeki64
+ #endif
++#endif
+ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DARWIN__)
+ #define SYS_BSD 1
+Index: dvdread/src/dvdread/ifo_types.h
+===================================================================
+--- dvdread/src/dvdread/ifo_types.h    (rĂ©vision 1188)
++++ dvdread/src/dvdread/ifo_types.h    (copie de travail)
+@@ -32,7 +32,7 @@
+ #if defined(__GNUC__)
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+-#define ATTRIBUTE_PACKED __attribute__ ((packed))
++#define ATTRIBUTE_PACKED __attribute__ ((packed,gcc_struct))
+ #define PRAGMA_PACK 0
+ #endif
+ #endif
diff --git a/contrib/src/dvdread/rules.mak b/contrib/src/dvdread/rules.mak
new file mode 100644 (file)
index 0000000..e3f8bf4
--- /dev/null
@@ -0,0 +1,26 @@
+# DVDREAD
+
+$(TARBALLS)/dvdread-svn.tar.xz:
+       rm -Rf dvdread-svn
+       $(SVN) export svn://svn.mplayerhq.hu/dvdnav/trunk/libdvdread dvdread-svn
+       tar cvJ dvdread-svn > $@
+
+.sum-dvdread: dvdread-svn.tar.xz
+       $(warning Integrity check skipped.)
+       touch $@
+
+dvdread: dvdread-svn.tar.xz .sum-dvdread
+       $(UNPACK)
+       $(APPLY) $(SRC)/dvdread/dvdread-css-static.patch
+ifdef HAVE_WIN32
+       $(APPLY) $(SRC)/dvdread/dvdread-win32.patch
+endif
+       $(MOVE)
+
+DEPS_dvdread = dvdcss
+
+.dvdread: dvdread .dvdcss
+       cd $< && sh autogen.sh noconfig
+       cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --with-libdvdcss=$(PREFIX)
+       cd $< && SUBDIRS="src misc m4" $(MAKE) install
+       touch $@