<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[126548] trunk/dports/net/ushare</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/126548">126548</a></dd>
<dt>Author</dt> <dd>ctreleaven@macports.org</dd>
<dt>Date</dt> <dd>2014-10-11 18:22:42 -0700 (Sat, 11 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>add patches for updated libupnp, fix segfaults, add startupitem and notes, add license</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportsnetusharePortfile">trunk/dports/net/ushare/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportsnetusharefilespatchadd_std_includesdiff">trunk/dports/net/ushare/files/patch-add_std_includes.diff</a></li>
<li><a href="#trunkdportsnetusharefilespatchushareupnpbuildfixdiff">trunk/dports/net/ushare/files/patch-ushare-upnp-build-fix.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportsnetusharePortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/ushare/Portfile (126547 => 126548)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/net/ushare/Portfile        2014-10-12 01:01:19 UTC (rev 126547)
+++ trunk/dports/net/ushare/Portfile        2014-10-12 01:22:42 UTC (rev 126548)
</span><span class="lines">@@ -5,9 +5,11 @@
</span><span class="cx"> 
</span><span class="cx"> name                ushare
</span><span class="cx"> version             1.1a
</span><del>-revision            3
</del><ins>+revision            4
</ins><span class="cx"> categories          net multimedia
</span><span class="cx"> platforms           darwin
</span><ins>+supported_archs     x86_64
+# libdlna does not support i386
</ins><span class="cx"> maintainers         nomaintainer
</span><span class="cx"> description         a UPnP (TM) A/V &amp; DLNA Media Server
</span><span class="cx"> long_description \
</span><span class="lines">@@ -25,14 +27,17 @@
</span><span class="cx">                         --enable-dlna
</span><span class="cx"> 
</span><span class="cx"> homepage            http://ushare.geexbox.org/
</span><ins>+license             GPL-2+
</ins><span class="cx"> master_sites        ${homepage}releases
</span><span class="cx"> use_bzip2           yes
</span><span class="cx"> checksums           md5 5bbcdbf1ff85a9710fa3d4e82ccaa251
</span><ins>+
</ins><span class="cx"> patchfiles          patch-configure.diff
</span><ins>+# following prevents segfaults
+patchfiles-append   patch-add_std_includes.diff
+# following required due to libupnp changes
+patchfiles-append   patch-ushare-upnp-build-fix.diff
</ins><span class="cx"> 
</span><del>-# libdlna isn't universal
-universal_variant no
-
</del><span class="cx"> configure.cflags-append     -std=gnu89 -I${prefix}/include -I${worksrcpath}
</span><span class="cx"> configure.ldflags-append    -lintl
</span><span class="cx"> 
</span><span class="lines">@@ -41,3 +46,22 @@
</span><span class="cx">     file rename ${destroot}${prefix}/etc/ushare.conf \
</span><span class="cx">         ${destroot}${prefix}/etc/ushare.conf.sample
</span><span class="cx"> }
</span><ins>+
+universal_variant no
+
+startupitem.create      yes
+startupitem.netchange   yes
+startupitem.executable  ${prefix}/bin/uShare --cfg=${prefix}/etc/ushare.conf
+
+notes &quot;
+****  ${name}  ****
+Before running ${name}, you must configure it by creating and editing:
+&gt;&gt;  ${prefix}/etc/ushare.conf
+${prefix}/etc/ushare.conf.sample is provided as a template.
+
+Note that ${name} runs as root.  This poses a security risk and you should not use
+${name} on internet-facing machine
+
+When loaded, you may be able to configure ${name} with a web browser at
+&gt;&gt;  &lt;ip.addr.of.host&gt;:&lt;port&gt;/web/ushare.html
+&quot;
</ins></span></pre></div>
<a id="trunkdportsnetusharefilespatchadd_std_includesdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/net/ushare/files/patch-add_std_includes.diff (0 => 126548)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/net/ushare/files/patch-add_std_includes.diff                                (rev 0)
+++ trunk/dports/net/ushare/files/patch-add_std_includes.diff        2014-10-12 01:22:42 UTC (rev 126548)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+See https://bugs.archlinux.org/task/24866
+Comment by Anton Komolov (xRemaLx) - Tuesday, 21 February 2012, 06:17 GMT
+On my system (64bit), I use this patch for a month. No more segfaults :)
+Problem is solved by the patch: mixing 32-bit and 64 bit pointers. This happens 
+if the compiler does not find a definition of the standard functions in header 
+files. On a 64 bit system automatically uses the 64 bit function, even though 
+the program is 32 bit.
+
+
+--- src/cds.c        2007-12-09 16:03:36.000000000 +0300
++++ src/cds.c        2012-01-26 05:14:03.317360310 +0400
+@@ -20,6 +20,8 @@
+  */

+ #include &lt;stdlib.h&gt;
++#include &lt;string.h&gt;
++#include &lt;stdio.h&gt;
+ #include &lt;upnp/upnp.h&gt;
+ #include &lt;upnp/upnptools.h&gt;

+--- src/cms.c        2007-12-09 16:03:36.000000000 +0300
++++ src/cms.c        2012-01-26 05:15:33.236991387 +0400
+@@ -20,6 +20,7 @@
+  */

+ #include &lt;stdlib.h&gt;
++#include &lt;string.h&gt;
+ #include &lt;upnp/upnp.h&gt;
+ #include &lt;upnp/upnptools.h&gt;

+--- src/http.c        2012-01-26 05:27:44.073992912 +0400
++++ src/http.c        2012-01-26 05:17:31.756505126 +0400
+@@ -25,6 +25,7 @@
+ #include &lt;errno.h&gt;
+ #include &lt;stdio.h&gt;
+ #include &lt;stdlib.h&gt;
++#include &lt;string.h&gt;
+ #include &lt;unistd.h&gt;
+ #include &lt;errno.h&gt;

+--- src/presentation.c        2007-12-09 16:03:36.000000000 +0300
++++ src/presentation.c        2012-01-26 05:19:41.635972259 +0400
+@@ -19,6 +19,8 @@
+  */

+ #include &lt;stdlib.h&gt;
++#include &lt;string.h&gt;
++#include &lt;stdio.h&gt;

+ #if HAVE_LANGINFO_CODESET
+ # include &lt;langinfo.h&gt;
+--- src/mime.c        2007-12-09 16:03:36.000000000 +0300
++++ src/mime.c        2012-01-26 05:23:54.251602492 +0400
+@@ -21,6 +21,7 @@

+ #include &lt;stdlib.h&gt;
+ #include &lt;string.h&gt;
++#include &lt;stdio.h&gt;

+ #include &quot;mime.h&quot;
+ #include &quot;ushare.h&quot;
+--- src/services.c        2007-12-09 16:03:36.000000000 +0300
++++ src/services.c        2012-01-26 05:21:28.572200186 +0400
+@@ -20,6 +20,7 @@
+  */

+ #include &lt;stdlib.h&gt;
++#include &lt;string.h&gt;
+ #include &lt;upnp/upnp.h&gt;
+ #include &lt;upnp/upnptools.h&gt;
</ins></span></pre></div>
<a id="trunkdportsnetusharefilespatchushareupnpbuildfixdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/net/ushare/files/patch-ushare-upnp-build-fix.diff (0 => 126548)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/net/ushare/files/patch-ushare-upnp-build-fix.diff                                (rev 0)
+++ trunk/dports/net/ushare/files/patch-ushare-upnp-build-fix.diff        2014-10-12 01:22:42 UTC (rev 126548)
</span><span class="lines">@@ -0,0 +1,161 @@
</span><ins>+update libupnp to 1.6.8, broke compiling of uShare
+
+See https://dev.openwrt.org/ticket/8296
+and https://lists.rpmfusion.org/pipermail/rpmfusion-developers/2011-September/010113.html
+
+diff -wbBur ushare-1.1a/src/http.c ushare-1.1a.my/src/http.c
+--- src/http.c        2007-12-09 13:03:36.000000000 +0000
++++ src/http.c        2010-10-29 11:13:07.000000000 +0000
+@@ -77,8 +77,7 @@
+   info-&gt;content_type = ixmlCloneDOMString (content_type);
+ }

+-static int
+-http_get_info (const char *filename, struct File_Info *info)
++int http_get_info (const char *filename, struct File_Info *info)
+ {
+   extern struct ushare_t *ut;
+   struct upnp_entry_t *entry = NULL;
+@@ -197,8 +196,7 @@
+   return ((UpnpWebFileHandle) file);
+ }

+-static UpnpWebFileHandle
+-http_open (const char *filename, enum UpnpOpenFileMode mode)
++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode)
+ {
+   extern struct ushare_t *ut;
+   struct upnp_entry_t *entry = NULL;
+@@ -251,8 +249,7 @@
+   return ((UpnpWebFileHandle) file);
+ }

+-static int
+-http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+   ssize_t len = -1;
+@@ -286,8 +283,7 @@
+   return len;
+ }

+-static int
+-http_write (UpnpWebFileHandle fh __attribute__((unused)),
++int http_write (UpnpWebFileHandle fh __attribute__((unused)),
+             char *buf __attribute__((unused)),
+             size_t buflen __attribute__((unused)))
+ {
+@@ -296,8 +292,7 @@
+   return 0;
+ }

+-static int
+-http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;
+   off_t newpos = -1;
+@@ -371,8 +366,7 @@
+   return 0;
+ }

+-static int
+-http_close (UpnpWebFileHandle fh)
++int http_close (UpnpWebFileHandle fh)
+ {
+   struct web_file_t *file = (struct web_file_t *) fh;

+@@ -402,13 +396,3 @@

+   return 0;
+ }
+-
+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks =
+-  {
+-    http_get_info,
+-    http_open,
+-    http_read,
+-    http_write,
+-    http_seek,
+-    http_close
+-  };
+diff -wbBur ushare-1.1a/src/http.h ushare-1.1a.my/src/http.h
+--- src/http.h        2007-12-09 13:03:36.000000000 +0000
++++ src/http.h        2010-10-29 11:13:11.000000000 +0000
+@@ -25,6 +25,13 @@
+ #include &lt;upnp/upnp.h&gt;
+ #include &lt;upnp/upnptools.h&gt;

+-struct UpnpVirtualDirCallbacks virtual_dir_callbacks;
++int http_close (UpnpWebFileHandle fh);
++int http_write (UpnpWebFileHandle fh __attribute__((unused)),
++            char *buf __attribute__((unused)),
++            size_t buflen __attribute__((unused)));
++int http_seek (UpnpWebFileHandle fh, off_t offset, int origin);
++UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode);
++int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen);
++int http_get_info (const char *filename, struct File_Info *info);

+ #endif /* _HTTP_H_ */
+diff -wbBur ushare-1.1a/src/ushare.c ushare-1.1a.my/src/ushare.c
+--- src/ushare.c        2007-12-09 13:03:36.000000000 +0000
++++ src/ushare.c        2010-10-29 11:17:45.000000000 +0000
+@@ -188,7 +188,7 @@
+   if (strcmp (request-&gt;DevUDN + 5, ut-&gt;udn))
+     return;

+-  ip = request-&gt;CtrlPtIPAddr.s_addr;
++  ip = (*(struct sockaddr_in*)&amp;request-&gt;CtrlPtIPAddr).sin_addr.s_addr;
+   ip = ntohl (ip);
+   sprintf (val, &quot;%d.%d.%d.%d&quot;,
+            (ip &gt;&gt; 24) &amp; 0xFF, (ip &gt;&gt; 16) &amp; 0xFF, (ip &gt;&gt; 8) &amp; 0xFF, ip &amp; 0xFF);
+@@ -348,7 +348,47 @@

+   UpnpEnableWebserver (TRUE);

+-  res = UpnpSetVirtualDirCallbacks (&amp;virtual_dir_callbacks);
++  res = UpnpVirtualDir_set_WriteCallback(http_write);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_(&quot;Cannot set virtual directory callbacks\n&quot;));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_GetInfoCallback(http_get_info);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_(&quot;Cannot set virtual directory callbacks\n&quot;));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_ReadCallback(http_read);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_(&quot;Cannot set virtual directory callbacks\n&quot;));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_OpenCallback(http_open);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_(&quot;Cannot set virtual directory callbacks\n&quot;));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_SeekCallback(http_seek);
++  if (res != UPNP_E_SUCCESS)
++  {
++    log_error (_(&quot;Cannot set virtual directory callbacks\n&quot;));
++    free (description);
++    return -1;
++  }
++
++  res = UpnpVirtualDir_set_CloseCallback(http_close);
+   if (res != UPNP_E_SUCCESS)
+   {
+     log_error (_(&quot;Cannot set virtual directory callbacks\n&quot;));
</ins></span></pre>
</div>
</div>

</body>
</html>