diff options
author | Francesco Colista <francesco.colista@gmail.com> | 2011-04-12 14:02:20 +0000 |
---|---|---|
committer | Francesco Colista <francesco.colista@gmail.com> | 2011-04-12 14:06:27 +0000 |
commit | f3f358961a18ed1ca38f9ed69468c538fdf3078e (patch) | |
tree | b1a40abba114abd7a7998e4a34d7f8780a49bd1b | |
parent | 0210cf02f627212988eaed46b3dccc7ff74db40d (diff) | |
download | alpine_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/APKBUILD | 52 | ||||
-rw-r--r-- | testing/ushare/upnp-build-fix.patch | 156 | ||||
-rw-r--r-- | testing/ushare/ushare-config.patch | 22 | ||||
-rw-r--r-- | testing/ushare/ushare.confd | 2 | ||||
-rw-r--r-- | testing/ushare/ushare.initd | 20 |
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> | ||
3 | pkgname=ushare | ||
4 | pkgver=1.1a | ||
5 | pkgrel=0 | ||
6 | pkgdesc="A free UPnP A/V Media Server for Linux" | ||
7 | url="http://ushare.geexbox.org" | ||
8 | arch="all" | ||
9 | license="GPL2" | ||
10 | depends= | ||
11 | depends_dev="pkgconfig libupnp-dev libdlna-dev ffmpeg-dev" | ||
12 | makedepends="$depends_dev" | ||
13 | install="" | ||
14 | subpackages="" | ||
15 | source="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 | ||
22 | prepare() { | ||
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 | } | ||
31 | build() { | ||
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 | } | ||
41 | package() { | ||
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 | |||
48 | md5sums="5bbcdbf1ff85a9710fa3d4e82ccaa251 ushare-1.1a.tar.bz2 | ||
49 | 32c29f9f673e8b3a3d9e7bf5e60febbc upnp-build-fix.patch | ||
50 | 5243475c0cebc5db49296b2f3691085b ushare-config.patch | ||
51 | 57b6ccaba8d17a79c6a651ad5f66cb6d ushare.initd | ||
52 | 28cc24dea30918ea859ed9c974f242d7 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 @@ | |||
1 | diff -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 | - }; | ||
78 | diff -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_ */ | ||
96 | diff -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 @@ | |||
1 | CONFIGFILE="/etc/ushare/ushare.conf" | ||
2 | PARAMS="-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 | |||
3 | depend() { | ||
4 | need net | ||
5 | use syslog | ||
6 | } | ||
7 | |||
8 | start() { | ||
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 | |||
16 | stop() { | ||
17 | ebegin "Stopping uShare UPnP A/V Media Server" | ||
18 | start-stop-daemon --stop -quiet --pidfile /var/run/ushare.pid | ||
19 | eend $? | ||
20 | } | ||