diff options
author | pav <pav@FreeBSD.org> | 2010-11-10 06:21:03 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2010-11-10 06:21:03 +0800 |
commit | 6d7b58075a5cfc3f3c3376f7b2d2a700e6712cb4 (patch) | |
tree | 6a16a2a1b128743ac16262f991a3d625325e898d /net/ushare | |
parent | da4923c0cbe255640a5191992f8a9398241f6752 (diff) | |
download | freebsd-ports-gnome-6d7b58075a5cfc3f3c3376f7b2d2a700e6712cb4.tar.gz freebsd-ports-gnome-6d7b58075a5cfc3f3c3376f7b2d2a700e6712cb4.tar.zst freebsd-ports-gnome-6d7b58075a5cfc3f3c3376f7b2d2a700e6712cb4.zip |
- Unbreak
Submitted by: Gennady <gen@ukr.net>
Diffstat (limited to 'net/ushare')
-rw-r--r-- | net/ushare/Makefile | 2 | ||||
-rw-r--r-- | net/ushare/distinfo | 1 | ||||
-rw-r--r-- | net/ushare/files/patch-http.h | 24 | ||||
-rw-r--r-- | net/ushare/files/patch-ushare.c | 118 | ||||
-rw-r--r-- | net/ushare/files/patch-ushare.h | 14 |
5 files changed, 156 insertions, 3 deletions
diff --git a/net/ushare/Makefile b/net/ushare/Makefile index 15ae1b491cc4..dc231783f8d9 100644 --- a/net/ushare/Makefile +++ b/net/ushare/Makefile @@ -16,8 +16,6 @@ COMMENT= A lightweight UPnP (TM) A/V Media Server LIB_DEPENDS= upnp.4:${PORTSDIR}/devel/upnp -BROKEN= does not compile - HAS_CONFIGURE= yes USE_BZIP2= yes USE_GMAKE= yes diff --git a/net/ushare/distinfo b/net/ushare/distinfo index e1669e19a9de..185d787da690 100644 --- a/net/ushare/distinfo +++ b/net/ushare/distinfo @@ -1,3 +1,2 @@ -MD5 (ushare-1.1a.tar.bz2) = 5bbcdbf1ff85a9710fa3d4e82ccaa251 SHA256 (ushare-1.1a.tar.bz2) = 7b9b85c79968d4f4560f02a99e33c6a33ff58f9d41d8faea79e31cce2ee78665 SIZE (ushare-1.1a.tar.bz2) = 65864 diff --git a/net/ushare/files/patch-http.h b/net/ushare/files/patch-http.h new file mode 100644 index 000000000000..5fca23071332 --- /dev/null +++ b/net/ushare/files/patch-http.h @@ -0,0 +1,24 @@ +--- src/http.h.orig 2007-12-09 15:03:36.000000000 +0200 ++++ src/http.h 2010-11-09 14:29:36.150630970 +0200 +@@ -25,6 +25,21 @@ + #include <upnp/upnp.h> + #include <upnp/upnptools.h> + ++#ifdef __FreeBSD__ ++struct UpnpVirtualDirCallbacks { ++int (*get_info) __P((const char *filename, struct File_Info *info)) ; ++UpnpWebFileHandle (*open) __P((const char *filename, enum UpnpOpenFileMode mode)) ; ++int (*read) __P((UpnpWebFileHandle fh, char *buf, size_t buflen)) ; ++int (*write) __P((UpnpWebFileHandle fh __attribute__((unused)), ++ char *buf __attribute__((unused)), ++ size_t buflen __attribute__((unused)))) ; ++int (*seek) __P((UpnpWebFileHandle fh, off_t offset, int origin)) ; ++int (*close) __P((UpnpWebFileHandle fh)) ; ++} ; ++ ++extern struct UpnpVirtualDirCallbacks virtual_dir_callbacks; ++#else + struct UpnpVirtualDirCallbacks virtual_dir_callbacks; ++#endif /* __FreeBSD__ */ + + #endif /* _HTTP_H_ */ diff --git a/net/ushare/files/patch-ushare.c b/net/ushare/files/patch-ushare.c new file mode 100644 index 000000000000..d5959c0af17d --- /dev/null +++ b/net/ushare/files/patch-ushare.c @@ -0,0 +1,118 @@ +--- src/ushare.c.orig 2007-12-09 15:03:36.000000000 +0200 ++++ src/ushare.c 2010-11-09 14:56:44.261445831 +0200 +@@ -171,6 +171,19 @@ + pthread_mutex_unlock (&ut->termination_mutex); + } + ++ ++#ifdef __FreeBSD__ ++static void ++*get_ip_addr(struct sockaddr *sa) ++{ ++ if (sa->sa_family == AF_INET) ++ return &(((struct sockaddr_in*)sa)->sin_addr); ++ else ++ return &(((struct sockaddr_in6*)sa)->sin6_addr); ++} ++#endif /* __FreeBSD__ */ ++ ++ + static void + handle_action_request (struct Upnp_Action_Request *request) + { +@@ -188,7 +201,11 @@ + if (strcmp (request->DevUDN + 5, ut->udn)) + return; + ++#ifndef __FreeBSD__ + ip = request->CtrlPtIPAddr.s_addr; ++#else ++ ip = get_ip_addr((struct sockaddr *)&request->CtrlPtIPAddr) ; ++#endif /* __FreeBSD__ */ + ip = ntohl (ip); + sprintf (val, "%d.%d.%d.%d", + (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF); +@@ -348,6 +365,7 @@ + + UpnpEnableWebserver (TRUE); + ++#ifndef __FreeBSD__ + res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks); + if (res != UPNP_E_SUCCESS) + { +@@ -355,6 +373,43 @@ + free (description); + return -1; + } ++#else ++ if ((res = UpnpVirtualDir_set_GetInfoCallback(virtual_dir_callbacks.get_info)) != UPNP_E_SUCCESS ) { ++ log_error (_("Cannot set virtual directory callback - get_info\n")); ++ free (description); ++ return -1; ++ } ++ ++ if ((res = UpnpVirtualDir_set_OpenCallback(virtual_dir_callbacks.open)) != UPNP_E_SUCCESS ) { ++ log_error (_("Cannot set virtual directory callback - open\n")); ++ free (description); ++ return -1; ++ } ++ ++ if ((res = UpnpVirtualDir_set_ReadCallback(virtual_dir_callbacks.read)) != UPNP_E_SUCCESS ) { ++ log_error (_("Cannot set virtual directory callback - read\n")); ++ free (description); ++ return -1; ++ } ++ ++ if ((res = UpnpVirtualDir_set_WriteCallback(virtual_dir_callbacks.write)) != UPNP_E_SUCCESS ) { ++ log_error (_("Cannot set virtual directory callback - write\n")); ++ free (description); ++ return -1; ++ } ++ ++ if ((res = UpnpVirtualDir_set_SeekCallback(virtual_dir_callbacks.seek)) != UPNP_E_SUCCESS ) { ++ log_error (_("Cannot set virtual directory callback - seek\n")); ++ free (description); ++ return -1; ++ } ++ ++ if ((res = UpnpVirtualDir_set_CloseCallback(virtual_dir_callbacks.close)) != UPNP_E_SUCCESS ) { ++ log_error (_("Cannot set virtual directory callback - close\n")); ++ free (description); ++ return -1; ++ } ++#endif /* __FreeBSD__ */ + + res = UpnpAddVirtualDir (VIRTUAL_DIR); + if (res != UPNP_E_SUCCESS) +@@ -421,6 +476,7 @@ + itf = itflist; + while (itf) + { ++#ifndef __FreeBSD__ + if ((itf->ifa_flags & IFF_UP) + && !strncmp (itf->ifa_name, interface, IFNAMSIZ)) + { +@@ -430,6 +486,23 @@ + return true; + } + itf = itf->ifa_next; ++#else ++ if (strncmp (itf->ifa_name, interface, IFNAMSIZ)) { ++ itf = itf->ifa_next; ++ continue ; ++ } ++ ++ if (itf->ifa_flags & IFF_UP) { ++ log_info (_("Interface %s is up.\n"), interface); ++ freeifaddrs (itflist); ++ return true ; ++ } else { ++ log_error (_("Interface %s is down.\n"), interface); ++ log_error (_("Recheck uShare's configuration and try again !\n")); ++ freeifaddrs (itflist); ++ return false ; ++ } ++#endif /* __FreeBSD__ */ + } + + freeifaddrs (itf); diff --git a/net/ushare/files/patch-ushare.h b/net/ushare/files/patch-ushare.h new file mode 100644 index 000000000000..35619ebe428a --- /dev/null +++ b/net/ushare/files/patch-ushare.h @@ -0,0 +1,14 @@ +--- src/ushare.h.orig 2007-12-09 15:03:36.000000000 +0200 ++++ src/ushare.h 2010-11-09 14:31:03.466292203 +0200 +@@ -27,6 +27,11 @@ + #include <stdbool.h> + #include <pthread.h> + ++#ifdef __FreeBSD__ ++#include <stdio.h> ++#include <string.h> ++#endif /* __FreeBSD__ */ ++ + #ifdef HAVE_DLNA + #include <dlna.h> + #endif /* HAVE_DLNA */ |