Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 2014 22:24:59 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Dean Hollister <deanhollister@bigpond.com>
Cc:        ports@FreeBSD.org
Subject:   Re: FreeBSD Port: ushare-1.1a_9
Message-ID:  <2B96750F-D229-45A9-8CED-6F79F5A84F9B@FreeBSD.org>
In-Reply-To: <CF4A2CAE.13029%deanhollister@bigpond.com>
References:  <CF4A2CAE.13029%deanhollister@bigpond.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_C839A546-9C24-495A-884D-E1E7DADD8AF7
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF"


--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

On 19 Mar 2014, at 09:59, Dean Hollister <deanhollister@bigpond.com> wrote:
> It appears that the ushare port requires GCC to build, but this
> requirement is not present in the Makefile. Attempting to build without
> GCC generates the following error:
...
> In file included from cfgparser.c:30:
> In file included from ./cfgparser.h:24:
> ./ushare.h:135:13: warning: inline function 'display_headers' is not
> defined
>      [-Wundefined-inline]
> inline void display_headers (void);
>            ^
> cfgparser.c:316:3: note: used here
>  display_headers ();
>  ^
> 1 warning generated.

This is because the ushare author apparently does not understand how
inline works in C.  It is very simple to fix: just drop the attached
files into /usr/ports/net/ushare/files, overwriting any existing ones.

-Dimitry

--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF
Content-Disposition: attachment;
	filename=patch-trace.c
Content-Type: application/octet-stream;
	name="patch-trace.c"
Content-Transfer-Encoding: 7bit

--- src/trace.c.orig	2007-12-09 14:03:36.000000000 +0100
+++ src/trace.c	2014-03-19 22:10:28.000000000 +0100
@@ -57,7 +57,7 @@
   va_end (va);
 }
 
-inline void
+extern inline void
 start_log (void)
 {
   openlog (PACKAGE_NAME, LOG_PID, LOG_DAEMON);

--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF
Content-Disposition: attachment;
	filename=patch-trace.h
Content-Type: application/octet-stream;
	name="patch-trace.h"
Content-Transfer-Encoding: 7bit

--- src/trace.h.orig	2007-12-09 14:03:36.000000000 +0100
+++ src/trace.h	2014-03-19 22:09:50.000000000 +0100
@@ -29,7 +29,7 @@
 
 void print_log (log_level level, const char *format, ...)
   __attribute__ ((format (printf, 2, 3)));
-inline void start_log (void);
+extern inline void start_log (void);
 
 /* log_info
  * Normal print, to replace printf

--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF
Content-Disposition: attachment;
	filename=patch-ushare.c
Content-Type: application/octet-stream;
	name="patch-ushare.c"
Content-Transfer-Encoding: 7bit

--- 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);
@@ -718,7 +791,7 @@
   }
 }
 
-inline void
+extern inline void
 display_headers (void)
 {
   printf (_("%s (version %s), a lightweight UPnP A/V and DLNA Media Server.\n"),

--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF
Content-Disposition: attachment;
	filename=patch-ushare.h
Content-Type: application/octet-stream;
	name="patch-ushare.h"
Content-Transfer-Encoding: 7bit

--- 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 */
@@ -127,6 +132,6 @@
   struct service_t *service;
 };
 
-inline void display_headers (void);
+extern inline void display_headers (void);
 
 #endif /* _USHARE_H_ */

--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii



--Apple-Mail=_10FAD7BE-C3E2-4731-B16F-A5FB50A434DF--

--Apple-Mail=_C839A546-9C24-495A-884D-E1E7DADD8AF7
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iEYEARECAAYFAlMqCzAACgkQsF6jCi4glqP9EQCgtgLgGJOfcgzRagmzhqdxfhre
UwIAoPPBY90EX1I7GCU+SvaLcM5f/GR6
=AMh4
-----END PGP SIGNATURE-----

--Apple-Mail=_C839A546-9C24-495A-884D-E1E7DADD8AF7--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2B96750F-D229-45A9-8CED-6F79F5A84F9B>