Contribs: fix nfs on win32
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 10 Apr 2017 11:27:23 +0000 (13:27 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 10 Apr 2017 11:29:32 +0000 (13:29 +0200)
contrib/src/nfs/rules.mak
contrib/src/nfs/win32.patch [new file with mode: 0644]

index 4e91925..221c26f 100644 (file)
@@ -15,11 +15,12 @@ $(TARBALLS)/libnfs-$(NFS_VERSION).tar.gz:
 nfs: libnfs-$(NFS_VERSION).tar.gz .sum-nfs
        $(UNPACK)
        mv libnfs-libnfs-$(NFS_VERSION) libnfs-$(NFS_VERSION)
+       $(APPLY) $(SRC)/nfs/win32.patch
        $(UPDATE_AUTOCONFIG)
        $(MOVE)
 
 .nfs: nfs
        cd $< && ./bootstrap
-       cd $< && $(HOSTVARS) ./configure --disable-examples --disable-utils $(HOSTCONF)
+       cd $< && $(HOSTVARS) ./configure --disable-examples --disable-utils --disable-werror $(HOSTCONF)
        cd $< && $(MAKE) install
        touch $@
diff --git a/contrib/src/nfs/win32.patch b/contrib/src/nfs/win32.patch
new file mode 100644 (file)
index 0000000..eece8da
--- /dev/null
@@ -0,0 +1,65 @@
+diff -ruN nfs/configure.ac nfs.good/configure.ac
+--- nfs/configure.ac   2016-10-09 20:23:11.000000000 +0200
++++ nfs.good/configure.ac      2017-04-10 11:55:45.979424891 +0200
+@@ -79,7 +79,7 @@
+ AC_SUBST(MAYBE_EXAMPLES)
+ AC_MSG_CHECKING(whether SO_BINDTODEVICE is available)
+-AC_TRY_RUN([
++AC_TRY_COMPILE([
+ /*
+  * Just see if we can compile with SO_BINDTODEVICE
+  */
+@@ -92,7 +92,7 @@
+ }
+ ], ac_cv_have_so_bindtodevice=yes, ac_cv_have_so_bindtodevice=no,
+    [echo $ac_n "compile with SO_BINDTODEVICE. Assuming OK... $ac_c"
+-    ac_cv_have_so_bindtodevice=yes])
++    ac_cv_have_so_bindtodevice])
+ if test "$ac_cv_have_so_bindtodevice" = yes ; then
+   AC_MSG_RESULT(yes)
+   AC_DEFINE(HAVE_SO_BINDTODEVICE, 1, [Whether our sockets support SO_BINDTODEVICE])
+diff -ruN nfs/lib/libnfs.c nfs.good/lib/libnfs.c
+--- nfs/lib/libnfs.c   2016-10-09 20:23:11.000000000 +0200
++++ nfs.good/lib/libnfs.c      2017-04-10 11:46:32.471450692 +0200
+@@ -26,8 +26,10 @@
+ #endif
+ #ifdef WIN32
++ #define __STDC_FORMAT_MACROS 1
++#include <inttypes.h>
+ #include "win32_compat.h"
+-#define PRIu64 "llu"
++//#define PRIu64 "llu"
+ #else
+ #include <inttypes.h>
+ #endif
+diff -ruN nfs/win32/win32_compat.h nfs.good/win32/win32_compat.h
+--- nfs/win32/win32_compat.h   2016-10-09 20:23:11.000000000 +0200
++++ nfs.good/win32/win32_compat.h      2017-04-10 11:43:57.415457919 +0200
+@@ -38,6 +38,7 @@
+ typedef int gid_t;
+ typedef int socklen_t;
++#ifndef S_IRUSR
+ #define S_IRUSR 0000400
+ #define S_IWUSR 0000200
+ #define S_IXUSR 0000100
+@@ -49,6 +50,7 @@
+ #define S_IROTH 0000004
+ #define S_IWOTH 0000002
+ #define S_IXOTH 0000001
++#endif
+ #define F_GETFL  3
+ #define F_SETFL  4
+@@ -106,7 +108,9 @@
+ #define poll(x, y, z)        win32_poll(x, y, z)
+ #define inet_pton(x,y,z)     win32_inet_pton(x,y,z)
+ #define open(x, y, z)        _open(x, y, z)
++#ifndef lseek
+ #define lseek(x, y, z)       _lseek(x, y, z)
++#endif
+ #define read(x, y, z)        _read(x, y, z)
+ #define write(x, y, z)       _write(x, y, z)
+ int     getpid(void);