From owner-freebsd-ports@FreeBSD.ORG Wed Mar 19 21:25:17 2014 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DD21E1A for ; Wed, 19 Mar 2014 21:25:17 +0000 (UTC) Received: from tensor.andric.com (unknown [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8B960F41 for ; Wed, 19 Mar 2014 21:25:16 +0000 (UTC) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 7B6D45C45; Wed, 19 Mar 2014 22:25:06 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_C839A546-9C24-495A-884D-E1E7DADD8AF7"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: FreeBSD Port: ushare-1.1a_9 From: Dimitry Andric In-Reply-To: Date: Wed, 19 Mar 2014 22:24:59 +0100 Message-Id: <2B96750F-D229-45A9-8CED-6F79F5A84F9B@FreeBSD.org> References: To: Dean Hollister X-Mailer: Apple Mail (2.1874) Cc: ports@FreeBSD.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Mar 2014 21:25:17 -0000 --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 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 #include +#ifdef __FreeBSD__ +#include +#include +#endif /* __FreeBSD__ */ + #ifdef HAVE_DLNA #include #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--