summaryrefslogtreecommitdiffstats
path: root/testing/ushare
diff options
context:
space:
mode:
authorFrancesco Colista <francesco.colista@gmail.com>2011-04-12 14:02:20 +0000
committerFrancesco Colista <francesco.colista@gmail.com>2011-04-12 14:06:27 +0000
commitf3f358961a18ed1ca38f9ed69468c538fdf3078e (patch)
treeb1a40abba114abd7a7998e4a34d7f8780a49bd1b /testing/ushare
parent0210cf02f627212988eaed46b3dccc7ff74db40d (diff)
downloadaports-f3f358961a18ed1ca38f9ed69468c538fdf3078e.tar.bz2
aports-f3f358961a18ed1ca38f9ed69468c538fdf3078e.tar.xz
testing/ushare : new aport - A free UPnP A/V Media Server for Linux
Diffstat (limited to 'testing/ushare')
-rw-r--r--testing/ushare/APKBUILD52
-rw-r--r--testing/ushare/upnp-build-fix.patch156
-rw-r--r--testing/ushare/ushare-config.patch22
-rw-r--r--testing/ushare/ushare.confd2
-rw-r--r--testing/ushare/ushare.initd20
5 files changed, 252 insertions, 0 deletions
diff --git a/testing/ushare/APKBUILD b/testing/ushare/APKBUILD
new file mode 100644
index 000000000..8c2fb0f84
--- /dev/null
+++ b/testing/ushare/APKBUILD
@@ -0,0 +1,52 @@
+# Contributor: Francesco Colista <francesco.colista@gmail.com>
+# Maintainer: Francesco Colista <francesco.colista@gmail.com>
+pkgname=ushare
+pkgver=1.1a
+pkgrel=0
+pkgdesc="A free UPnP A/V Media Server for Linux"
+url="http://ushare.geexbox.org"
+arch="all"
+license="GPL2"
+depends=
+depends_dev="pkgconfig libupnp-dev libdlna-dev ffmpeg-dev"
+makedepends="$depends_dev"
+install=""
+subpackages=""
+source="http://ushare.geexbox.org/releases/${pkgname}-${pkgver}.tar.bz2
+ upnp-build-fix.patch
+ ushare-config.patch
+ ushare.initd
+ ushare.confd
+ "
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+build() {
+ cd "$_builddir"
+ sed -i -e 's/cat -n/cat/' configure
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc/ushare \
+ --enable-dlna \
+ --with-libdlna-dir=/usr/include/libavformat \
+ --disable-nls
+ make || return 1
+}
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ install -D -m755 ../ushare.initd "$pkgdir"/etc/init.d/ushare
+ install -D -m755 ../ushare.confd "$pkgdir"/etc/conf.d/ushare
+}
+
+md5sums="5bbcdbf1ff85a9710fa3d4e82ccaa251 ushare-1.1a.tar.bz2
+32c29f9f673e8b3a3d9e7bf5e60febbc upnp-build-fix.patch
+5243475c0cebc5db49296b2f3691085b ushare-config.patch
+57b6ccaba8d17a79c6a651ad5f66cb6d ushare.initd
+28cc24dea30918ea859ed9c974f242d7 ushare.confd"
diff --git a/testing/ushare/upnp-build-fix.patch b/testing/ushare/upnp-build-fix.patch
new file mode 100644
index 000000000..c3ec37a32
--- /dev/null
+++ b/testing/ushare/upnp-build-fix.patch
@@ -0,0 +1,156 @@
+diff -wbBur ushare-1.1a/src/http.c ushare-1.1a.my/src/http.c
+--- ushare-1.1a/src/http.c 2007-12-09 13:03:36.000000000 +0000
++++ ushare-1.1a.my/src/http.c 2010-10-29 11:13:07.000000000 +0000
+@@ -77,8 +77,7 @@
+ info->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
+--- ushare-1.1a/src/http.h 2007-12-09 13:03:36.000000000 +0000
++++ ushare-1.1a.my/src/http.h 2010-10-29 11:13:11.000000000 +0000
+@@ -25,6 +25,13 @@
+ #include <upnp/upnp.h>
+ #include <upnp/upnptools.h>
+
+-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
+--- ushare-1.1a/src/ushare.c 2007-12-09 13:03:36.000000000 +0000
++++ ushare-1.1a.my/src/ushare.c 2010-10-29 11:17:45.000000000 +0000
+@@ -188,7 +188,7 @@
+ if (strcmp (request->DevUDN + 5, ut->udn))
+ return;
+
+- ip = request->CtrlPtIPAddr.s_addr;
++ ip = (*(struct sockaddr_in*)&request->CtrlPtIPAddr).sin_addr.s_addr;
+ ip = ntohl (ip);
+ sprintf (val, "%d.%d.%d.%d",
+ (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
+@@ -348,7 +348,47 @@
+
+ UpnpEnableWebserver (TRUE);
+
+- res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
++ res = UpnpVirtualDir_set_WriteCallback(http_write);
++ if (res != UPNP_E_SUCCESS)
++ {
++ log_error (_("Cannot set virtual directory callbacks\n"));
++ free (description);
++ return -1;
++ }
++
++ res = UpnpVirtualDir_set_GetInfoCallback(http_get_info);
++ if (res != UPNP_E_SUCCESS)
++ {
++ log_error (_("Cannot set virtual directory callbacks\n"));
++ free (description);
++ return -1;
++ }
++
++ res = UpnpVirtualDir_set_ReadCallback(http_read);
++ if (res != UPNP_E_SUCCESS)
++ {
++ log_error (_("Cannot set virtual directory callbacks\n"));
++ free (description);
++ return -1;
++ }
++
++ res = UpnpVirtualDir_set_OpenCallback(http_open);
++ if (res != UPNP_E_SUCCESS)
++ {
++ log_error (_("Cannot set virtual directory callbacks\n"));
++ free (description);
++ return -1;
++ }
++
++ res = UpnpVirtualDir_set_SeekCallback(http_seek);
++ if (res != UPNP_E_SUCCESS)
++ {
++ log_error (_("Cannot set virtual directory callbacks\n"));
++ free (description);
++ return -1;
++ }
++
++ res = UpnpVirtualDir_set_CloseCallback(http_close);
+ if (res != UPNP_E_SUCCESS)
+ {
+ log_error (_("Cannot set virtual directory callbacks\n"));
diff --git a/testing/ushare/ushare-config.patch b/testing/ushare/ushare-config.patch
new file mode 100644
index 000000000..d064db890
--- /dev/null
+++ b/testing/ushare/ushare-config.patch
@@ -0,0 +1,22 @@
+--- ushare-1.1a/scripts/ushare.conf 2007-12-09 07:03:36.000000000 -0600
++++ b/scripts/ushare.conf 2010-11-15 12:09:45.000000000 -0600
+@@ -31,15 +31,15 @@ USHARE_DIR=
+ USHARE_OVERRIDE_ICONV_ERR=
+
+ # Enable Web interface (yes/no)
+-ENABLE_WEB=
++USHARE_ENABLE_WEB=
+
+ # Enable Telnet control interface (yes/no)
+-ENABLE_TELNET=
++USHARE_ENABLE_TELNET=
+
+ # Use XboX 360 compatibility mode (yes/no)
+-ENABLE_XBOX=
++USHARE_ENABLE_XBOX=
+
+ # Use DLNA profile (yes/no)
+ # This is needed for PlayStation3 to work (among other devices)
+-ENABLE_DLNA=
++USHARE_ENABLE_DLNA=
+
diff --git a/testing/ushare/ushare.confd b/testing/ushare/ushare.confd
new file mode 100644
index 000000000..ef7f7c895
--- /dev/null
+++ b/testing/ushare/ushare.confd
@@ -0,0 +1,2 @@
+CONFIGFILE="/etc/ushare/ushare.conf"
+PARAMS="-f $CONFIGFILE"
diff --git a/testing/ushare/ushare.initd b/testing/ushare/ushare.initd
new file mode 100644
index 000000000..8ca03fc47
--- /dev/null
+++ b/testing/ushare/ushare.initd
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+
+depend() {
+ need net
+ use syslog
+}
+
+start() {
+ ebegin "Starting uShare UPnP A/V Media Server"
+ start-stop-daemon --start --quiet --background --make-pidfile \
+ --pidfile /var/run/ushare.pid --exec /bin/ushare \
+ -- $PARAMS
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping uShare UPnP A/V Media Server"
+ start-stop-daemon --stop -quiet --pidfile /var/run/ushare.pid
+ eend $?
+}