aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/Makefile1
-rw-r--r--net/ushare/Makefile32
-rw-r--r--net/ushare/distinfo3
-rw-r--r--net/ushare/files/patch-cfgparser.c53
-rw-r--r--net/ushare/files/patch-ushare105
-rw-r--r--net/ushare/files/patch-ushare.c71
-rw-r--r--net/ushare/files/patch-ushare.h17
-rw-r--r--net/ushare/pkg-descr6
8 files changed, 288 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile
index c01f72f71893..fb7b9ada4a30 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -831,6 +831,7 @@
SUBDIR += uproxy
SUBDIR += urelay
SUBDIR += urlendec
+ SUBDIR += ushare
SUBDIR += utftpd
SUBDIR += v6eval
SUBDIR += vchat
diff --git a/net/ushare/Makefile b/net/ushare/Makefile
new file mode 100644
index 000000000000..1ce36d5cc3de
--- /dev/null
+++ b/net/ushare/Makefile
@@ -0,0 +1,32 @@
+# New ports collection makefile for: ushare
+# Date created: 11 December 2006
+# Whom: Volker Theile <votdev@gmx.de>
+#
+# $FreeBSD$
+#
+
+PORTNAME= ushare
+PORTVERSION= 0.9.8
+CATEGORIES= net
+MASTER_SITES= http://ushare.geexbox.org/releases/
+
+MAINTAINER= votdev@gmx.de
+COMMENT= A lightweight UPnP (TM) A/V Media Server
+
+LIB_DEPENDS= upnp.2:${PORTSDIR}/devel/upnp
+BUILD_DEPENDS= pkg-config:${PORTSDIR}/devel/pkg-config \
+ iconv:${PORTSDIR}/converters/libiconv
+
+PLIST_FILES= bin/${PORTNAME} etc/${PORTNAME}.conf.sample
+MAN1= ${PORTNAME}.1
+
+USE_BZIP2= yes
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= --with-libiconv-prefix=${LOCALBASE}/lib --mandir=${LOCALBASE}/man
+
+do-install:
+ ${INSTALL_SCRIPT} ${WRKSRC}/src/${PORTNAME} ${PREFIX}/bin
+ ${MV} ${WRKSRC}/scripts/${PORTNAME}.conf ${PREFIX}/etc/${PORTNAME}.conf.sample
+ ${INSTALL_MAN} ${WRKSRC}/src/${PORTNAME}.1 ${PREFIX}/man/man1
+
+.include <bsd.port.mk>
diff --git a/net/ushare/distinfo b/net/ushare/distinfo
new file mode 100644
index 000000000000..d99b2a4da9b7
--- /dev/null
+++ b/net/ushare/distinfo
@@ -0,0 +1,3 @@
+MD5 (ushare-0.9.8.tar.bz2) = dec4c12d97d476c9a3a0347621d64e27
+SHA256 (ushare-0.9.8.tar.bz2) = 4419a3fdb894fbdbdbf19706065fb2df00528c2087e53819c28a353c5d33bde9
+SIZE (ushare-0.9.8.tar.bz2) = 162404
diff --git a/net/ushare/files/patch-cfgparser.c b/net/ushare/files/patch-cfgparser.c
new file mode 100644
index 000000000000..b046749e16b5
--- /dev/null
+++ b/net/ushare/files/patch-cfgparser.c
@@ -0,0 +1,53 @@
+--- src/cfgparser_orig.c Sun Nov 12 13:40:35 2006
++++ src/cfgparser.c Mon Dec 11 09:58:17 2006
+@@ -38,6 +38,50 @@
+
+ #define USHARE_DIR_DELIM ","
+
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++char *strndup(const char *s, size_t n) {
++ size_t len;
++ char *sdup;
++ if(!s)
++ return NULL;
++ len = strlen(s);
++ len = (n < len ? n : len);
++ sdup = (char *)malloc(len + 1);
++ if(sdup) {
++ memcpy(sdup, s, len);
++ sdup[len] = '\0';
++ }
++ return sdup;
++}
++
++ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
++ static char line[256];
++ char *ptr;
++ unsigned int len;
++ if(lineptr == NULL || n == NULL) {
++ return -1;
++ }
++ if(ferror(stream))
++ return -1;
++ if(feof(stream))
++ return -1;
++ fgets(line,256,stream);
++ ptr = strchr(line,'\n');
++ if(ptr)
++ *ptr = '\0';
++ len = strlen(line);
++ if((len+1) < 256) {
++ ptr = realloc(*lineptr, 256);
++ if(ptr == NULL)
++ return(-1);
++ *lineptr = ptr;
++ *n = 256;
++ }
++ strcpy(*lineptr,line);
++ return(len);
++}
++#endif
++
+ static bool
+ ignore_line (const char *line)
+ {
diff --git a/net/ushare/files/patch-ushare b/net/ushare/files/patch-ushare
new file mode 100644
index 000000000000..461fc0d81d8c
--- /dev/null
+++ b/net/ushare/files/patch-ushare
@@ -0,0 +1,105 @@
+--- scripts/ushare.orig Sat Dec 9 13:55:38 2006
++++ scripts/ushare Thu Dec 14 09:24:40 2006
+@@ -1,74 +1,29 @@
+-#!/bin/sh -e
+-### BEGIN INIT INFO
+-# Required-Start: $local_fs $syslog
+-# Required-Stop:
+-# Default-Start: 2 3 4 5
+-# Default-Stop: 0 1 6
+-# Short-Description: start and stop ushare
+-# Description:
+-### END INIT INFO
+-
+-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+-DAEMON=/usr/bin/ushare
+-NAME=ushare
+-DESC="uShare UPnP A/V Media Server"
+-PIDFILE=/var/run/ushare.pid
+-CONFIGFILE=/etc/ushare.conf
+-
+-# abort if no executable exists
+-[ -x $DAEMON ] || exit 0
+-
+-# Get lsb functions
+-. /lib/lsb/init-functions
+-. /etc/default/rcS
+-
+-[ -f /etc/default/ushare ] && . /etc/default/ushare
+-
+-checkpid() {
+- [ -e $PIDFILE ] || touch $PIDFILE
+-}
+-
+-check_shares() {
+- if [ -r "$CONFIGFILE" ]; then
+- . $CONFIGFILE
+- [ -n "$USHARE_DIR" ] && return 0
+- fi
+- return 1
+-}
+-
+-case "$1" in
+- start)
+- log_daemon_msg "Starting $DESC: $NAME"
+- if ! $(check_shares); then
+- log_warning_msg "No shares avalaible ..."
+- log_end_msg 0
+- else
+- checkpid
+- start-stop-daemon --start --quiet --background --oknodo \
+- --make-pidfile --pidfile $PIDFILE \
+- --exec $DAEMON -- $USHARE_OPTIONS
+- log_end_msg $?
+- fi
+- ;;
+- stop)
+- log_daemon_msg "Stopping $DESC: $NAME"
+- start-stop-daemon --stop --signal 2 --quiet --oknodo --pidfile $PIDFILE
+- log_end_msg $?
+- ;;
+- reload|force-reload)
+- log_daemon_msg "Reloading $DESC: $NAME"
+- start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
+- log_end_msg $?
+- ;;
+- restart)
+- $0 stop
+- $1 start
+- ;;
+- *)
+- N=/etc/init.d/$NAME
+- log_success_msg "Usage: $N {start|stop|restart|reload|force-reload}"
+- exit 1
+- ;;
+-esac
++#!/bin/sh
++#
++# ushare.sh for rc.d usage (c) 2006 Volker Theile.
++#
++
++# PROVIDE: ushare
++# REQUIRE: DAEMON
++# BEFORE: LOGIN
++# KEYWORD: shutdown
++
++# Add the following line to /etc/rc.conf to enable `ushare':
++#
++#ushare_enable="YES"
++
++. "/etc/rc.subr"
++
++name=ushare
++rcvar=`set_rcvar`
++
++command="/usr/local/bin/$name"
++command_args="--daemon"
++required_files="/usr/local/etc/$name.conf"
++
++# read configuration and set defaults
++load_rc_config "$name"
++: ${ushare_enable="NO"}
++: ${ushare_flags=""}
+
+-exit 0
++run_rc_command "$1"
diff --git a/net/ushare/files/patch-ushare.c b/net/ushare/files/patch-ushare.c
new file mode 100644
index 000000000000..8d2f503e9ad7
--- /dev/null
+++ b/net/ushare/files/patch-ushare.c
@@ -0,0 +1,71 @@
+--- src/ushare_orig.c Sun Nov 12 13:40:35 2006
++++ src/ushare.c Mon Dec 11 09:59:04 2006
+@@ -33,6 +33,11 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <getopt.h>
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++#include <sys/socket.h>
++#include <sys/sysctl.h>
++#include <net/if_dl.h>
++#endif
+ #include <net/if.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+@@ -346,6 +351,48 @@
+ static char *
+ create_udn (char *interface)
+ {
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++ int mib[6], len;
++ char *buf;
++ unsigned char *ptr;
++ struct if_msghdr *ifm;
++ struct sockaddr_dl *sdl;
++
++ mib[0] = CTL_NET;
++ mib[1] = AF_ROUTE;
++ mib[2] = 0;
++ mib[3] = AF_LINK;
++ mib[4] = NET_RT_IFLIST;
++ if((mib[5] = if_nametoindex(interface)) == 0) {
++ perror("if_nametoindex error");
++ exit(2);
++ }
++
++ if(sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
++ perror("sysctl 1 error");
++ exit(3);
++ }
++
++ if((buf = malloc(len)) == NULL) {
++ perror("malloc error");
++ exit(4);
++ }
++
++ if(sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
++ perror("sysctl 2 error");
++ exit(5);
++ }
++
++ ifm = (struct if_msghdr *)buf;
++ sdl = (struct sockaddr_dl *)(ifm + 1);
++ ptr = (unsigned char *)LLADDR(sdl);
++
++ snprintf(buf, 64, "%02X%02X%02X%02X%02X%02X",
++ (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
++ (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377));
++
++ return buf;
++#else
+ int sock;
+ struct ifreq ifr;
+ char *buf;
+@@ -382,6 +429,7 @@
+ close (sock);
+
+ return buf;
++#endif
+ }
+
+ static char *
diff --git a/net/ushare/files/patch-ushare.h b/net/ushare/files/patch-ushare.h
new file mode 100644
index 000000000000..babf67549386
--- /dev/null
+++ b/net/ushare/files/patch-ushare.h
@@ -0,0 +1,17 @@
+--- src/ushare.h.orig Sun Nov 12 13:40:36 2006
++++ src/ushare.h Wed Dec 13 17:16:10 2006
+@@ -101,4 +101,14 @@
+
+ inline void display_headers (void);
+
++#if (defined(__unix__) || defined(unix)) && !defined(USG)
++#ifndef HAVE_STRNDUP
++char *strndup(const char *s, size_t n);
++#endif
++
++#ifndef HAVE_GETLINE
++ssize_t getline(char **lineptr, size_t *n, FILE *stream);
++#endif
++#endif
++
+ #endif /* _USHARE_H_ */
diff --git a/net/ushare/pkg-descr b/net/ushare/pkg-descr
new file mode 100644
index 000000000000..0004a07f9b6e
--- /dev/null
+++ b/net/ushare/pkg-descr
@@ -0,0 +1,6 @@
+GeeXboX uShare is a UPnP (TM) A/V Media Server. It implements the server
+component that provides UPnP media devices with information on available
+multimedia files. uShare uses the built-in http server of libupnp to stream
+the files to clients.
+
+WWW: http://ushare.geexbox.org/