Xine-lib 1.2 and Windows

"[email protected]" <[email protected]> Sat, 12 May 2012 23:46:32 +0200 (CEST)
Newsgroups gmane.comp.video.xine.devel
Message-ID <31804998.7099511336859192377.JavaMail.root@wmail44>
Hello friends,
some time ago I tried to download the latest xine-lib 1.2 and I discovered 
that support for Windows was completely broken.
So, I would like to know if Windows platform must be still considered as 
supported and it just needs a bit of maintenance, or it must be assumed as 
unsupported from now.
In the meanwhile, I attached a patch with a selection of small and safe fixes 
that I implemented for making working xine-lib 1.2 on Windows:

"weak" attribute may be not supported, so I implemented these fixes in these 
files:
* __attribute__((weak)) has been replaced with XINE_WEAK macro into xine.h
* In xine/attributes.h, the conditional declaration of XINE_WEAK macro has 
been implemented.
* In m4/attributes.m4, the function CC_ATTRIBUTE_WEAK has been implemented.
* In configure.ac, the CC_ATTRIBUTE_WEAK function has been called.

In configure.ac, I added the presence check of some include files:
pwd.h
unistd.h (it's available in MINGW but it is not into MSVC)
sys/socket.h
netinet/in.h
arpa/inet.h
These diagnostics will be useful for future changes.

lib/hstrerror.c failed to compile because an include path seems wrong.
The file to include is "xine/xineintl.h" and not "xineintl.h".

libdvdnav failed to compile and I got a makefile error of "missing separator".
In src/input/libdvdnav/Makefile.am, the source name "dvd_udf.c" is preceeded 
by spaces rather than a TAB, so I fixed it.

Fixed a small typing error into src/xine-utils/memcpy.c


I implemented many other corrections, but these are the most safe.
I hope these changes could be useful for you.

Sincerely,

Carlo Bramini.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
xine-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-devel
windows1.txt (text/plain, 3.1 KB)
diff -r 72f0edddb775 configure.ac
--- a/configure.ac	Thu May 10 15:45:58 2012 +0300
+++ b/configure.ac	Sat May 12 23:13:17 2012 +0200
@@ -342,8 +342,9 @@
 
 AC_CHECK_HEADERS([alloca.h])
 AC_CHECK_HEADERS([assert.h byteswap.h dirent.h errno.h execinfo.h fcntl.h glob.h])
-AC_CHECK_HEADERS([libgen.h malloc.h netdb.h stdbool.h ucontext.h])
+AC_CHECK_HEADERS([libgen.h malloc.h netdb.h pwd.h stdbool.h ucontext.h unistd.h])
 AC_CHECK_HEADERS([sys/ioctl.h sys/mixer.h sys/mman.h sys/param.h sys/times.h sys/wait.h])
+AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h])
 
 dnl This is duplicative due to AC_HEADER_STDC, but src/input/vcd stuff needs to
 dnl have HAVE_STDIO_H defined, or it won't compile.
@@ -468,6 +469,7 @@
 CC_ATTRIBUTE_DEPRECATED
 CC_ATTRIBUTE_UNUSED
 CC_ATTRIBUTE_MALLOC
+CC_ATTRIBUTE_WEAK
 
 CC_ATTRIBUTE_PACKED([],
   [AC_MSG_WARN([Your compiler doesn't support __attribute__((packed)); xine might not work as expected.])])
diff -r 72f0edddb775 include/xine.h
--- a/include/xine.h	Thu May 10 15:45:58 2012 +0300
+++ b/include/xine.h	Sat May 12 23:13:17 2012 +0200
@@ -120,7 +120,7 @@
 /* allow the setting of some flags before xine_init
  * FIXME-ABI: this is currently GLOBAL
  */
-void xine_set_flags (xine_t *, int) XINE_PROTECTED __attribute__((weak));
+void xine_set_flags (xine_t *, int) XINE_PROTECTED XINE_WEAK;
 #define XINE_FLAG_NO_WRITE_CACHE		1
 
 /*
diff -r 72f0edddb775 include/xine/attributes.h
--- a/include/xine/attributes.h	Thu May 10 15:45:58 2012 +0300
+++ b/include/xine/attributes.h	Sat May 12 23:13:17 2012 +0200
@@ -78,6 +78,12 @@
 # define XINE_DEPRECATED
 #endif
 
+#ifdef SUPPORT_ATTRIBUTE_WEAK
+# define XINE_WEAK __attribute__((weak))
+#else
+# define XINE_WEAK
+#endif
+
 #ifndef __attr_unused
 # ifdef SUPPORT_ATTRIBUTE_UNUSED
 #  define __attr_unused __attribute__((__unused__))
diff -r 72f0edddb775 lib/hstrerror.c
--- a/lib/hstrerror.c	Thu May 10 15:45:58 2012 +0300
+++ b/lib/hstrerror.c	Sat May 12 23:13:17 2012 +0200
@@ -7,7 +7,7 @@
 #endif
 #include <errno.h>
 
-#include "xineintl.h"
+#include "xine/xineintl.h"
 
 /**
  * get error descriptions in DNS lookups
diff -r 72f0edddb775 m4/attributes.m4
--- a/m4/attributes.m4	Thu May 10 15:45:58 2012 +0300
+++ b/m4/attributes.m4	Sat May 12 23:13:17 2012 +0200
@@ -218,6 +218,13 @@
     [$1], [$2])
 ])
 
+AC_DEFUN([CC_ATTRIBUTE_WEAK], [
+  CC_CHECK_ATTRIBUTE(
+    [weak], ,
+    [void some_function(void *, int) __attribute__((weak));],
+    [$1], [$2])
+])
+
 AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
   CC_CHECK_ATTRIBUTE(
     [deprecated], ,
diff -r 72f0edddb775 src/input/libdvdnav/Makefile.am
--- a/src/input/libdvdnav/Makefile.am	Thu May 10 15:45:58 2012 +0300
+++ b/src/input/libdvdnav/Makefile.am	Sat May 12 23:13:17 2012 +0200
@@ -24,7 +24,7 @@
 	nav_read.c \
 	dvd_reader.c \
 	dvd_input.c \
-        dvd_udf.c
+	dvd_udf.c
 libdvdnav_la_LIBADD = $(PTHREAD_LIBS)
 
 noinst_HEADERS = \
diff -r 72f0edddb775 src/xine-utils/memcpy.c
--- a/src/xine-utils/memcpy.c	Thu May 10 15:45:58 2012 +0300
+++ b/src/xine-utils/memcpy.c	Sat May 12 23:13:17 2012 +0200
@@ -1,4 +1,4 @@
-;/*
+/*
  * Copyright (C) 2001-2004 the xine project
  *
  * This file is part of xine, a free video player.