1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

- Unbreak

Submitted by:	Gennady <gen@ukr.net>
This commit is contained in:
Pav Lucistnik 2010-11-09 22:21:03 +00:00
parent 9b437b8dfd
commit 842203ad4a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=264324
5 changed files with 156 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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_ */

View File

@ -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);

View File

@ -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 */