Permalink
Browse files

[linux/osx/ios] Prepare dyloading libnfs

- added libnfs to configure.in search
- added libnfs makefile for linux
- added libnfs dyload wrapper
  • Loading branch information...
1 parent 9e1ad28 commit 28c4d78e91b13b569352d250c05e24a758529e36 @Memphiz Memphiz committed Jun 11, 2011
Showing with 258 additions and 1 deletion.
  1. +37 −0 configure.in
  2. +55 −0 lib/libnfs/Makefile
  3. +3 −1 tools/darwin/depends/libnfs/Makefile
  4. +2 −0 xbmc/DllPaths_generated.h.in
  5. +161 −0 xbmc/filesystem/DllLibNfs.h
View
@@ -90,6 +90,9 @@ openmax_not_found="== Could not find libnvomx. OpenMax support disabled. =="
ssh_not_found="== Could not find libssh. SSH FTP VFS support disabled. =="
librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
librtmp_disabled="== RTMP support disabled. =="
+libnfs_not_found="== Could not find libnfs. NFS support disabled. =="
+libnfs_disabled="== NFS support disabled. =="
+
# External library message strings
external_libraries_enabled="== Use of all supported external libraries enabled. =="
@@ -222,6 +225,13 @@ AC_ARG_ENABLE([rtmp],
[use_librtmp=$enableval],
[use_librtmp=auto])
+AC_ARG_ENABLE([nfs],
+ [AS_HELP_STRING([--enable-nfs],
+ [enable NFS support via libnfs (default is auto)])],
+ [use_libnfs=$enableval],
+ [use_libnfs=auto])
+
+
AC_ARG_ENABLE([ffmpeg_libvorbis],
[AS_HELP_STRING([--enable-ffmpeg-libvorbis],
[enable FFmpeg vorbis encoding (default is no)])],
@@ -810,6 +820,26 @@ else
AC_MSG_NOTICE($librtmp_disabled)
fi
+# libnfs
+if test "$use_libnfs" != "no"; then
+ AC_CHECK_HEADERS([nfsc/libnfs.h],,
+ [if test "$use_libnfs" = "yes"; then
+ AC_MSG_ERROR($libnfs_not_found)
+ elif test "$use_libnfs" != "no"; then
+ AC_MSG_NOTICE($libnfs_not_found)
+ use_libnfs="no"
+ fi
+ ])
+ if test "$use_libnfs" != "no"; then
+ XB_FIND_SONAME([NFS], [nfs], [use_libnfs])
+ fi
+ if test "$use_libnfs" != "no"; then
+ AC_DEFINE([HAVE_LIBNFS], [1], [Whether to use libnfs library.])
+ fi
+else
+ AC_MSG_NOTICE($libnfs_disabled)
+fi
+
### External libraries checks
# External FFmpeg
if test "$use_external_ffmpeg" = "yes"; then
@@ -1335,6 +1365,13 @@ else
final_message="$final_message\n libRTMP support:\tNo"
fi
+if test "$use_libnfs" != "no"; then
+ final_message="$final_message\n libnfs support:\tYes"
+else
+ final_message="$final_message\n libnfs support:\tNo"
+fi
+
+
if test "$use_optical_drive" = "yes"; then
final_message="$final_message\n Optical drive:\tYes"
else
View
@@ -0,0 +1,55 @@
+# A quick and dirty Makefile to download/build and install
+#
+# Usage:
+# make
+# sudo make install
+
+# lib name, version
+LIBNAME=libnfs
+VERSION=0977fbb
+SOURCE=Memphiz-$(LIBNAME)-$(VERSION)
+# download location and format
+BASE_URL=http://githubredir.debian.net/github/memphiz/libnfs
+ARCHIVE=$(SOURCE).tar.gz
+TARBALLS_LOCATION=.
+RETRIEVE_TOOL=/usr/bin/curl
+RETRIEVE_TOOL_FLAGS=-Ls --create-dirs --output $(TARBALLS_LOCATION)/$(ARCHIVE)
+ARCHIVE_TOOL=tar
+ARCHIVE_TOOL_FLAGS=xf
+prefix=/usr
+
+# configuration settings
+CONFIGURE=./configure --prefix=$(prefix) --without-examples --without-ldconfig
+
+SO_NAME=$(SOURCE)/lib/libnfs.so
+
+CLEAN_FILES=$(ARCHIVE) $(SOURCE)
+
+all: $(SO_NAME)
+
+$(TARBALLS_LOCATION)/$(ARCHIVE):
+ $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)
+
+$(SOURCE): $(TARBALLS_LOCATION)/$(ARCHIVE)
+ rm -rf $(SOURCE)
+ $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
+ echo $(SOURCE) > .gitignore
+ cd $(SOURCE);autoreconf -vif;$(CONFIGURE)
+
+$(SO_NAME): $(SOURCE)
+ make -C $(SOURCE)
+
+install:
+ make -C $(SOURCE) install
+ ln -s /usr/lib/libnfs.so.1.0.0 /usr/lib/libnfs.so
+clean:
+ make -C $(SOURCE) clean
+ rm -f .installed
+ rm -f -r include
+ rm -f -r lib
+ rm -f *.tar.gz
+ rm -r -f Memphiz-libnfs*
+ rm -r -f nfsc
+
+distclean::
+ rm -rf $(SOURCE) .installed
@@ -14,7 +14,8 @@ CONFIGURE=./configure --prefix=$(PREFIX) --without-examples
RPC_HEADERS=rpcinc/auth.h rpcinc/auth_unix.h rpcinc/clnt.h rpcinc/pmap_clnt.h rpcinc/pmap_prot.h rpcinc/pmap_rmt.h rpcinc/rpc.h rpcinc/rpc_msg.h rpcinc/svc.h rpcinc/svc_auth.h rpcinc/types.h rpcinc/xdr.h
-LIBDYLIB=$(SOURCE)/lib/libnfs.1.0.0.dylib
+DYLIBNAME=libnfs.1.0.0.dylib
+LIBDYLIB=$(SOURCE)/lib/$(DYLIBNAME)
CLEAN_FILES=$(ARCHIVE) $(SOURCE)
@@ -38,6 +39,7 @@ $(LIBDYLIB): $(SOURCE)
.installed:
make -C $(SOURCE) install
touch $@
+ ln -s $(PREFIX)/lib/$(DYLIBNAME) $(PREFIX)/lib/libnfs.dylib
clean:
make -C $(SOURCE) clean
@@ -35,6 +35,7 @@
#define DLL_PATH_LIBCMYTH "special://xbmcbin/system/libcmyth-@ARCH@.so"
#define DLL_PATH_LIBRTMP "@RTMP_SONAME@"
+#define DLL_PATH_LIBNFS "@NFS_SONAME@"
#ifndef DLL_PATH_LIBCURL
#define DLL_PATH_LIBCURL "@CURL_SONAME@"
@@ -55,6 +56,7 @@
#define DLL_PATH_SID_CODEC "special://xbmcbin/system/players/paplayer/libsidplay2-@ARCH@.so"
#define DLL_PATH_SPC_CODEC "special://xbmcbin/system/players/paplayer/SNESAPU-@ARCH@.so"
#define DLL_PATH_VGM_CODEC "special://xbmcbin/system/players/paplayer/vgmstream-@ARCH@.so"
+#define DLL_PATH_WAVPACK_CODEC "@WAVPACK_SONAME@"
#define DLL_PATH_YM_CODEC "special://xbmcbin/system/players/paplayer/stsoundlibrary-@ARCH@.so"
#define DLL_PATH_FLAC_CODEC "@FLAC_SONAME@"
View
@@ -0,0 +1,161 @@
+#pragma once
+
+/*
+ * Copyright (C) 2011 Team XBMC
+ * http://www.xbmc.org
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "DynamicDll.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <nfsc/libnfs.h>
+#ifdef __cplusplus
+}
+#endif
+
+class DllLibNfsInterface
+{
+public:
+ virtual ~DllLibNfsInterface() {}
+
+ virtual struct nfs_context *nfs_init_context(void)=0;
+ virtual void nfs_destroy_context(struct nfs_context *nfs)=0;
+ virtual size_t nfs_get_readmax(struct nfs_context *nfs)=0;
+ virtual size_t nfs_get_writemax(struct nfs_context *nfs)=0;
+ virtual char *nfs_get_error(struct nfs_context *nfs)=0;
+ virtual int nfs_close_sync(struct nfs_context *nfs, struct nfsfh *nfsfh)=0;
+ virtual int nfs_fsync_sync(struct nfs_context *nfs, struct nfsfh *nfsfh)=0;
+ virtual int nfs_mkdir_sync(struct nfs_context *nfs, const char *path)=0;
+ virtual int nfs_rmdir_sync(struct nfs_context *nfs, const char *path)=0;
+ virtual int nfs_unlink_sync(struct nfs_context *nfs, const char *path)=0;
+ virtual void nfs_closedir(struct nfs_context *nfs, struct nfsdir *nfsdir)=0;
+ virtual struct nfsdirent *nfs_readdir(struct nfs_context *nfs, struct nfsdir *nfsdir)=0;
+ virtual int nfs_mount_sync(struct nfs_context *nfs, const char *server, const char *exportname)=0;
+ virtual int nfs_stat_sync(struct nfs_context *nfs, const char *path, struct stat *st)=0;
+ virtual int nfs_fstat_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, struct stat *st)=0;
+ virtual int nfs_truncate_sync(struct nfs_context *nfs, const char *path, off_t length)=0;
+ virtual int nfs_ftruncate_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t length)=0;
+ virtual int nfs_opendir_sync(struct nfs_context *nfs, const char *path, struct nfsdir **nfsdir)=0;
+ virtual int nfs_statvfs_sync(struct nfs_context *nfs, const char *path, struct statvfs *svfs)=0;
+ virtual int nfs_chmod_sync(struct nfs_context *nfs, const char *path, int mode)=0;
+ virtual int nfs_fchmod_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, int mode)=0;
+ virtual int nfs_access_sync(struct nfs_context *nfs, const char *path, int mode)=0;
+ virtual int nfs_utimes_sync(struct nfs_context *nfs, const char *path, struct timeval *times)=0;
+ virtual int nfs_utime_sync(struct nfs_context *nfs, const char *path, struct utimbuf *times)=0;
+ virtual int nfs_symlink_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath)=0;
+ virtual int nfs_rename_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath)=0;
+ virtual int nfs_link_sync(struct nfs_context *nfs, const char *oldpath, const char *newpath)=0;
+ virtual int nfs_readlink_sync(struct nfs_context *nfs, const char *path, char *buf, int bufsize)=0;
+ virtual int nfs_chown_sync(struct nfs_context *nfs, const char *path, int uid, int gid)=0;
+ virtual int nfs_fchown_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, int uid, int gid)=0;
+ virtual int nfs_open_sync(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh)=0;
+ virtual int nfs_read_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf)=0;
+ virtual int nfs_write_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, size_t count, char *buf)=0;
+ virtual int nfs_creat_sync(struct nfs_context *nfs, const char *path, int mode, struct nfsfh **nfsfh)=0;
+ virtual int nfs_pread_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf)=0;
+ virtual int nfs_pwrite_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, size_t count, char *buf)=0;
+ virtual int nfs_lseek_sync(struct nfs_context *nfs, struct nfsfh *nfsfh, off_t offset, int whence, off_t *current_offset)=0;
+};
+
+class DllLibNfs : public DllDynamic, DllLibNfsInterface
+{
+ DECLARE_DLL_WRAPPER(DllLibNfs, DLL_PATH_LIBNFS)
+ DEFINE_METHOD0(struct nfs_context *, nfs_init_context)
+ DEFINE_METHOD1(void, nfs_destroy_context, (struct nfs_context *p1))
+ DEFINE_METHOD1(size_t, nfs_get_readmax, (struct nfs_context *p1))
+ DEFINE_METHOD1(size_t, nfs_get_writemax, (struct nfs_context *p1))
+ DEFINE_METHOD1(char *, nfs_get_error, (struct nfs_context *p1))
+ DEFINE_METHOD2(struct nfsdirent *, nfs_readdir, (struct nfs_context *p1, struct nfsdir *p2))
+ DEFINE_METHOD2(int, nfs_fsync_sync, (struct nfs_context *p1, struct nfsfh *p2))
+ DEFINE_METHOD2(int, nfs_mkdir_sync, (struct nfs_context *p1, const char *p2))
+ DEFINE_METHOD2(int, nfs_rmdir_sync, (struct nfs_context *p1, const char *p2))
+ DEFINE_METHOD2(int, nfs_unlink_sync, (struct nfs_context *p1, const char *p2))
+ DEFINE_METHOD2(void,nfs_closedir, (struct nfs_context *p1, struct nfsdir *p2))
+ DEFINE_METHOD2(int, nfs_close_sync, (struct nfs_context *p1, struct nfsfh *p2))
+ DEFINE_METHOD3(int, nfs_mount_sync, (struct nfs_context *p1, const char *p2, const char *p3))
+ DEFINE_METHOD3(int, nfs_stat_sync, (struct nfs_context *p1, const char *p2, struct stat *p3))
+ DEFINE_METHOD3(int, nfs_fstat_sync, (struct nfs_context *p1, struct nfsfh *p2, struct stat *p3))
+ DEFINE_METHOD3(int, nfs_truncate_sync, (struct nfs_context *p1, const char *p2, off_t p3))
+ DEFINE_METHOD3(int, nfs_ftruncate_sync, (struct nfs_context *p1, struct nfsfh *p2, off_t p3))
+ DEFINE_METHOD3(int, nfs_opendir_sync, (struct nfs_context *p1, const char *p2, struct nfsdir **p3))
+ DEFINE_METHOD3(int, nfs_statvfs_sync, (struct nfs_context *p1, const char *p2, struct statvfs *p3))
+ DEFINE_METHOD3(int, nfs_chmod_sync, (struct nfs_context *p1, const char *p2, int p3))
+ DEFINE_METHOD3(int, nfs_fchmod_sync, (struct nfs_context *p1, struct nfsfh *p2, int p3))
+ DEFINE_METHOD3(int, nfs_utimes_sync, (struct nfs_context *p1, const char *p2, struct timeval *p3))
+ DEFINE_METHOD3(int, nfs_utime_sync, (struct nfs_context *p1, const char *p2, struct utimbuf *p3))
+ DEFINE_METHOD3(int, nfs_access_sync, (struct nfs_context *p1, const char *p2, int p3))
+ DEFINE_METHOD3(int, nfs_symlink_sync, (struct nfs_context *p1, const char *p2, const char *p3))
+ DEFINE_METHOD3(int, nfs_rename_sync, (struct nfs_context *p1, const char *p2, const char *p3))
+ DEFINE_METHOD3(int, nfs_link_sync, (struct nfs_context *p1, const char *p2, const char *p3))
+ DEFINE_METHOD4(int, nfs_open_sync, (struct nfs_context *p1, const char *p2, int p3, struct nfsfh **p4))
+ DEFINE_METHOD4(int, nfs_read_sync, (struct nfs_context *p1, struct nfsfh *p2, size_t p3, char *p4))
+ DEFINE_METHOD4(int, nfs_write_sync, (struct nfs_context *p1, struct nfsfh *p2, size_t p3, char *p4))
+ DEFINE_METHOD4(int, nfs_creat_sync, (struct nfs_context *p1, const char *p2, int p3, struct nfsfh **p4))
+ DEFINE_METHOD4(int, nfs_readlink_sync, (struct nfs_context *p1, const char *p2, char *p3, int p4))
+ DEFINE_METHOD4(int, nfs_chown_sync, (struct nfs_context *p1, const char *p2, int p3, int p4))
+ DEFINE_METHOD4(int, nfs_fchown_sync, (struct nfs_context *p1, struct nfsfh *p2, int p3, int p4))
+ DEFINE_METHOD5(int, nfs_pread_sync, (struct nfs_context *p1, struct nfsfh *p2, off_t p3, size_t p4, char *p5))
+ DEFINE_METHOD5(int, nfs_pwrite_sync, (struct nfs_context *p1, struct nfsfh *p2, off_t p3, size_t p4, char *p5))
+ DEFINE_METHOD5(int, nfs_lseek_sync, (struct nfs_context *p1, struct nfsfh *p2, off_t p3, int p4, off_t *p5))
+
+
+
+ BEGIN_METHOD_RESOLVE()
+ RESOLVE_METHOD_RENAME(nfs_init_context, nfs_init_context)
+ RESOLVE_METHOD_RENAME(nfs_destroy_context,nfs_destroy_context)
+ RESOLVE_METHOD_RENAME(nfs_get_readmax, nfs_get_readmax)
+ RESOLVE_METHOD_RENAME(nfs_get_writemax, nfs_get_writemax)
+ RESOLVE_METHOD_RENAME(nfs_get_error, nfs_get_error)
+ RESOLVE_METHOD_RENAME(nfs_readdir, nfs_readdir)
+ RESOLVE_METHOD_RENAME(nfs_closedir, nfs_closedir)
+ RESOLVE_METHOD_RENAME(nfs_mount_sync, nfs_mount_sync)
+ RESOLVE_METHOD_RENAME(nfs_stat_sync, nfs_stat_sync)
+ RESOLVE_METHOD_RENAME(nfs_fstat_sync, nfs_fstat_sync)
+ RESOLVE_METHOD_RENAME(nfs_open_sync, nfs_open_sync)
+ RESOLVE_METHOD_RENAME(nfs_close_sync, nfs_close_sync)
+ RESOLVE_METHOD_RENAME(nfs_pread_sync, nfs_pread_sync)
+ RESOLVE_METHOD_RENAME(nfs_read_sync, nfs_read_sync)
+ RESOLVE_METHOD_RENAME(nfs_pwrite_sync, nfs_pwrite_sync)
+ RESOLVE_METHOD_RENAME(nfs_write_sync, nfs_write_sync)
+ RESOLVE_METHOD_RENAME(nfs_lseek_sync, nfs_lseek_sync)
+ RESOLVE_METHOD_RENAME(nfs_fsync_sync, nfs_fsync_sync)
+ RESOLVE_METHOD_RENAME(nfs_truncate_sync, nfs_truncate_sync)
+ RESOLVE_METHOD_RENAME(nfs_ftruncate_sync, nfs_ftruncate_sync)
+ RESOLVE_METHOD_RENAME(nfs_mkdir_sync, nfs_mkdir_sync)
+ RESOLVE_METHOD_RENAME(nfs_rmdir_sync, nfs_rmdir_sync)
+ RESOLVE_METHOD_RENAME(nfs_creat_sync, nfs_creat_sync)
+ RESOLVE_METHOD_RENAME(nfs_unlink_sync, nfs_unlink_sync)
+ RESOLVE_METHOD_RENAME(nfs_opendir_sync, nfs_opendir_sync)
+ RESOLVE_METHOD_RENAME(nfs_statvfs_sync, nfs_statvfs_sync)
+ RESOLVE_METHOD_RENAME(nfs_readlink_sync, nfs_readlink_sync)
+ RESOLVE_METHOD_RENAME(nfs_chmod_sync, nfs_chmod_sync)
+ RESOLVE_METHOD_RENAME(nfs_fchmod_sync, nfs_fchmod_sync)
+ RESOLVE_METHOD_RENAME(nfs_chown_sync, nfs_chown_sync)
+ RESOLVE_METHOD_RENAME(nfs_fchown_sync, nfs_fchown_sync)
+ RESOLVE_METHOD_RENAME(nfs_utimes_sync, nfs_utimes_sync)
+ RESOLVE_METHOD_RENAME(nfs_utime_sync, nfs_utime_sync)
+ RESOLVE_METHOD_RENAME(nfs_access_sync, nfs_access_sync)
+ RESOLVE_METHOD_RENAME(nfs_symlink_sync, nfs_symlink_sync)
+ RESOLVE_METHOD_RENAME(nfs_rename_sync, nfs_rename_sync)
+ RESOLVE_METHOD_RENAME(nfs_link_sync, nfs_link_sync)
+ END_METHOD_RESOLVE()
+};
+

0 comments on commit 28c4d78

Please sign in to comment.