aboutsummaryrefslogtreecommitdiff
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
parent0210cf02f627212988eaed46b3dccc7ff74db40d (diff)
downloadalpine_aports-f3f358961a18ed1ca38f9ed69468c538fdf3078e.tar.bz2
alpine_aports-f3f358961a18ed1ca38f9ed69468c538fdf3078e.tar.xz
alpine_aports-f3f358961a18ed1ca38f9ed69468c538fdf3078e.zip
testing/ushare : new aport - A free UPnP A/V Media Server for Linux
-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 0000000000..8c2fb0f844
--- /dev/null
+++ b/testing/ushare/APKBUILD
@@ -0,0 +1,52 @@
1# Contributor: Francesco Colista <francesco.colista@gmail.com>
2# Maintainer: Francesco Colista <francesco.colista@gmail.com>
3pkgname=ushare
4pkgver=1.1a
5pkgrel=0
6pkgdesc="A free UPnP A/V Media Server for Linux"
7url="http://ushare.geexbox.org"
8arch="all"
9license="GPL2"
10depends=
11depends_dev="pkgconfig libupnp-dev libdlna-dev ffmpeg-dev"
12makedepends="$depends_dev"
13install=""
14subpackages=""
15source="http://ushare.geexbox.org/releases/${pkgname}-${pkgver}.tar.bz2
16 upnp-build-fix.patch
17 ushare-config.patch
18 ushare.initd
19 ushare.confd
20 "
21_builddir="$srcdir"/$pkgname-$pkgver
22prepare() {
23 local i
24 cd "$_builddir"
25 for i in $source; do
26 case $i in
27 *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
28 esac
29 done
30}
31build() {
32 cd "$_builddir"
33 sed -i -e 's/cat -n/cat/' configure
34 ./configure --prefix=/usr \
35 --sysconfdir=/etc/ushare \
36 --enable-dlna \
37 --with-libdlna-dir=/usr/include/libavformat \
38 --disable-nls
39 make || return 1
40}
41package() {
42 cd "$_builddir"
43 make DESTDIR="$pkgdir" install || return 1
44 install -D -m755 ../ushare.initd "$pkgdir"/etc/init.d/ushare
45 install -D -m755 ../ushare.confd "$pkgdir"/etc/conf.d/ushare
46}
47
48md5sums="5bbcdbf1ff85a9710fa3d4e82ccaa251 ushare-1.1a.tar.bz2
4932c29f9f673e8b3a3d9e7bf5e60febbc upnp-build-fix.patch
505243475c0cebc5db49296b2f3691085b ushare-config.patch
5157b6ccaba8d17a79c6a651ad5f66cb6d ushare.initd
5228cc24dea30918ea859ed9c974f242d7 ushare.confd"
diff --git a/testing/ushare/upnp-build-fix.patch b/testing/ushare/upnp-build-fix.patch
new file mode 100644
index 0000000000..c3ec37a324
--- /dev/null
+++ b/testing/ushare/upnp-build-fix.patch
@@ -0,0 +1,156 @@
1diff -wbBur ushare-1.1a/src/http.c ushare-1.1a.my/src/http.c
2--- ushare-1.1a/src/http.c 2007-12-09 13:03:36.000000000 +0000
3+++ ushare-1.1a.my/src/http.c 2010-10-29 11:13:07.000000000 +0000
4@@ -77,8 +77,7 @@
5 info->content_type = ixmlCloneDOMString (content_type);
6 }
7
8-static int
9-http_get_info (const char *filename, struct File_Info *info)
10+int http_get_info (const char *filename, struct File_Info *info)
11 {
12 extern struct ushare_t *ut;
13 struct upnp_entry_t *entry = NULL;
14@@ -197,8 +196,7 @@
15 return ((UpnpWebFileHandle) file);
16 }
17
18-static UpnpWebFileHandle
19-http_open (const char *filename, enum UpnpOpenFileMode mode)
20+UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode)
21 {
22 extern struct ushare_t *ut;
23 struct upnp_entry_t *entry = NULL;
24@@ -251,8 +249,7 @@
25 return ((UpnpWebFileHandle) file);
26 }
27
28-static int
29-http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
30+int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen)
31 {
32 struct web_file_t *file = (struct web_file_t *) fh;
33 ssize_t len = -1;
34@@ -286,8 +283,7 @@
35 return len;
36 }
37
38-static int
39-http_write (UpnpWebFileHandle fh __attribute__((unused)),
40+int http_write (UpnpWebFileHandle fh __attribute__((unused)),
41 char *buf __attribute__((unused)),
42 size_t buflen __attribute__((unused)))
43 {
44@@ -296,8 +292,7 @@
45 return 0;
46 }
47
48-static int
49-http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
50+int http_seek (UpnpWebFileHandle fh, off_t offset, int origin)
51 {
52 struct web_file_t *file = (struct web_file_t *) fh;
53 off_t newpos = -1;
54@@ -371,8 +366,7 @@
55 return 0;
56 }
57
58-static int
59-http_close (UpnpWebFileHandle fh)
60+int http_close (UpnpWebFileHandle fh)
61 {
62 struct web_file_t *file = (struct web_file_t *) fh;
63
64@@ -402,13 +396,3 @@
65
66 return 0;
67 }
68-
69-struct UpnpVirtualDirCallbacks virtual_dir_callbacks =
70- {
71- http_get_info,
72- http_open,
73- http_read,
74- http_write,
75- http_seek,
76- http_close
77- };
78diff -wbBur ushare-1.1a/src/http.h ushare-1.1a.my/src/http.h
79--- ushare-1.1a/src/http.h 2007-12-09 13:03:36.000000000 +0000
80+++ ushare-1.1a.my/src/http.h 2010-10-29 11:13:11.000000000 +0000
81@@ -25,6 +25,13 @@
82 #include <upnp/upnp.h>
83 #include <upnp/upnptools.h>
84
85-struct UpnpVirtualDirCallbacks virtual_dir_callbacks;
86+int http_close (UpnpWebFileHandle fh);
87+int http_write (UpnpWebFileHandle fh __attribute__((unused)),
88+ char *buf __attribute__((unused)),
89+ size_t buflen __attribute__((unused)));
90+int http_seek (UpnpWebFileHandle fh, off_t offset, int origin);
91+UpnpWebFileHandle http_open (const char *filename, enum UpnpOpenFileMode mode);
92+int http_read (UpnpWebFileHandle fh, char *buf, size_t buflen);
93+int http_get_info (const char *filename, struct File_Info *info);
94
95 #endif /* _HTTP_H_ */
96diff -wbBur ushare-1.1a/src/ushare.c ushare-1.1a.my/src/ushare.c
97--- ushare-1.1a/src/ushare.c 2007-12-09 13:03:36.000000000 +0000
98+++ ushare-1.1a.my/src/ushare.c 2010-10-29 11:17:45.000000000 +0000
99@@ -188,7 +188,7 @@
100 if (strcmp (request->DevUDN + 5, ut->udn))
101 return;
102
103- ip = request->CtrlPtIPAddr.s_addr;
104+ ip = (*(struct sockaddr_in*)&request->CtrlPtIPAddr).sin_addr.s_addr;
105 ip = ntohl (ip);
106 sprintf (val, "%d.%d.%d.%d",
107 (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
108@@ -348,7 +348,47 @@
109
110 UpnpEnableWebserver (TRUE);
111
112- res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
113+ res = UpnpVirtualDir_set_WriteCallback(http_write);
114+ if (res != UPNP_E_SUCCESS)
115+ {
116+ log_error (_("Cannot set virtual directory callbacks\n"));
117+ free (description);
118+ return -1;
119+ }
120+
121+ res = UpnpVirtualDir_set_GetInfoCallback(http_get_info);
122+ if (res != UPNP_E_SUCCESS)
123+ {
124+ log_error (_("Cannot set virtual directory callbacks\n"));
125+ free (description);
126+ return -1;
127+ }
128+
129+ res = UpnpVirtualDir_set_ReadCallback(http_read);
130+ if (res != UPNP_E_SUCCESS)
131+ {
132+ log_error (_("Cannot set virtual directory callbacks\n"));
133+ free (description);
134+ return -1;
135+ }
136+
137+ res = UpnpVirtualDir_set_OpenCallback(http_open);
138+ if (res != UPNP_E_SUCCESS)
139+ {
140+ log_error (_("Cannot set virtual directory callbacks\n"));
141+ free (description);
142+ return -1;
143+ }
144+
145+ res = UpnpVirtualDir_set_SeekCallback(http_seek);
146+ if (res != UPNP_E_SUCCESS)
147+ {
148+ log_error (_("Cannot set virtual directory callbacks\n"));
149+ free (description);
150+ return -1;
151+ }
152+
153+ res = UpnpVirtualDir_set_CloseCallback(http_close);
154 if (res != UPNP_E_SUCCESS)
155 {
156 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 0000000000..d064db890b
--- /dev/null
+++ b/testing/ushare/ushare-config.patch
@@ -0,0 +1,22 @@
1--- ushare-1.1a/scripts/ushare.conf 2007-12-09 07:03:36.000000000 -0600
2+++ b/scripts/ushare.conf 2010-11-15 12:09:45.000000000 -0600
3@@ -31,15 +31,15 @@ USHARE_DIR=
4 USHARE_OVERRIDE_ICONV_ERR=
5
6 # Enable Web interface (yes/no)
7-ENABLE_WEB=
8+USHARE_ENABLE_WEB=
9
10 # Enable Telnet control interface (yes/no)
11-ENABLE_TELNET=
12+USHARE_ENABLE_TELNET=
13
14 # Use XboX 360 compatibility mode (yes/no)
15-ENABLE_XBOX=
16+USHARE_ENABLE_XBOX=
17
18 # Use DLNA profile (yes/no)
19 # This is needed for PlayStation3 to work (among other devices)
20-ENABLE_DLNA=
21+USHARE_ENABLE_DLNA=
22
diff --git a/testing/ushare/ushare.confd b/testing/ushare/ushare.confd
new file mode 100644
index 0000000000..ef7f7c895b
--- /dev/null
+++ b/testing/ushare/ushare.confd
@@ -0,0 +1,2 @@
1CONFIGFILE="/etc/ushare/ushare.conf"
2PARAMS="-f $CONFIGFILE"
diff --git a/testing/ushare/ushare.initd b/testing/ushare/ushare.initd
new file mode 100644
index 0000000000..8ca03fc470
--- /dev/null
+++ b/testing/ushare/ushare.initd
@@ -0,0 +1,20 @@
1#!/sbin/runscript
2
3depend() {
4 need net
5 use syslog
6}
7
8start() {
9 ebegin "Starting uShare UPnP A/V Media Server"
10 start-stop-daemon --start --quiet --background --make-pidfile \
11 --pidfile /var/run/ushare.pid --exec /bin/ushare \
12 -- $PARAMS
13 eend $?
14}
15
16stop() {
17 ebegin "Stopping uShare UPnP A/V Media Server"
18 start-stop-daemon --stop -quiet --pidfile /var/run/ushare.pid
19 eend $?
20}