The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



Вариант для распечатки  
Пред. тема | След. тема 
Форум Программирование под UNIX (Компиляция)
Режим отображения отдельной подветви беседы [ Отслеживать ]

Оглавление

Старый порт uShare для FreeBSD, stainlessrat (ok), 07-Окт-16, (0) [смотреть все] +1

Сообщения [Сортировка по времени | RSS]


9. "Старый порт uShare для FreeBSD"  +/
Сообщение от михалыч (ok), 16-Май-19, 13:17 
Вот, пожалуйста, собрал.
Может кому пригодится.

======================================================================
Makefile


# Created by: Mr. Anonymous <anonymous@anonym.org>
# $FreeBSD$

PORTNAME=       ushare
PORTVERSION=    1.1a
PORTREVISION=   9
CATEGORIES=     net
MASTER_SITES=   http://ushare.geexbox.org/releases/

MAINTAINER=     votdev@gmx.de
COMMENT=        This is a lightweight UPnP (TM) A/V Media Server

LICENSE=        GPLv2+

LIB_DEPENDS=    libupnp.so:devel/upnp
LIB_DEPENDS+=   libavformat.so:multimedia/ffmpeg

HAS_CONFIGURE=  yes

USES=           gmake iconv pathfix pkgconfig tar:bzip2
USES+=          gettext-runtime

LDFLAGS+=       -L${LOCALBASE}/lib -lintl
CFLAGS+=        -I${LOCALBASE}/include -I${WRKSRC}

OPTIONS_DEFINE= LIBDLNA
LIBDLNA_DESC=   Enable DLNA (PS3) support
LIB_DEPENDS+=   libdlna.so:devel/libdlna
LIBDLNA_CONFIGURE_ON=   --enable-dlna

PLIST_FILES=    bin/ushare etc/rc.d/ushare etc/ushare.conf.sample man/man1/ushare.1.gz

do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/src/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
        ${INSTALL_SCRIPT} ${WRKSRC}/scripts/${PORTNAME} ${STAGEDIR}${PREFIX}/etc/rc.d
        ${INSTALL_DATA} ${WRKSRC}/scripts/${PORTNAME}.conf ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample
        ${INSTALL_MAN} ${WRKSRC}/src/${PORTNAME}.1 ${STAGEDIR}${MANPREFIX}/man/man1

post-install:
        ${CP} -np ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample ${PREFIX}/etc/${PORTNAME}.conf

.include <bsd.port.mk>


Важно! Не забудьте про символы табуляции в Makefile

======================================================================
distinfo


SHA256 (ushare-1.1a.tar.bz2) = 7b9b85c79968d4f4560f02a99e33c6a33ff58f9d41d8faea79e31cce2ee78665
SIZE (ushare-1.1a.tar.bz2) = 65864

======================================================================
pkg-descr


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/

======================================================================
files/patch-scripts_ushare


--- scripts/ushare.orig 2007-12-09 13:03:36 UTC
+++ scripts/ushare
@@ -1,82 +1,29 @@
-#!/bin/sh -e
+#!/bin/sh
#
-# uShare init script
+# ushare.sh for rc.d usage (c) 2007 Volker Theile <votdev@gmx.de>.
#
-### BEGIN INIT INFO
-# Provides:          ushare
-# Required-Start:    $local_fs $syslog $network
-# Should-Start:
-# Required-Stop:
-# Should-Stop:
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: uShare
-# Description:       uShare UPnP (TM) A/V & DLNA Media Server
-#                    You should edit configuration in /etc/ushare.conf file
-#                    See http://ushare.geexbox.org for details
-### 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 & DLNA Media Server"
-PIDFILE=/var/run/ushare.pid
-CONFIGFILE=/etc/ushare.conf

-# abort if no executable exists
-[ -x $DAEMON ] || exit 0
+# PROVIDE: ushare
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: shutdown

-# Get lsb functions
-. /lib/lsb/init-functions
-. /etc/default/rcS
+# Add the following line to /etc/rc.conf to enable `ushare':
+#
+#ushare_enable="YES"

-[ -f /etc/default/ushare ] && . /etc/default/ushare
+. /etc/rc.subr

-checkpid() {
-  [ -e $PIDFILE ] || touch $PIDFILE
-}
+name="ushare"
+rcvar="${name}_enable"

-check_shares() {
-  if [ -r "$CONFIGFILE" ]; then
-    . $CONFIGFILE
-    [ -n "$USHARE_DIR" ] && return 0
-  fi
-  return 1
-}
+command="/usr/local/bin/${name}"
+command_args="--daemon"
+required_files="/usr/local/etc/${name}.conf"

-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
-    $0 start
-  ;;
-  *)
-    N=/etc/init.d/$NAME
-    log_success_msg "Usage: $N {start|stop|restart|reload|force-reload}"
-    exit 1
-  ;;
-esac
+# read configuration and set defaults
+load_rc_config "${name}"
+: ${ushare_enable="NO"}
+: ${ushare_flags=""}

-exit 0
+run_rc_command "$1"

======================================================================
files/patch-src_trace.c


--- src/trace.c.orig    2007-12-09 13:03:36 UTC
+++ src/trace.c
@@ -57,7 +57,7 @@ print_log (log_level level, const char *
   va_end (va);
}

-inline void
+extern inline void
start_log (void)
{
   openlog (PACKAGE_NAME, LOG_PID, LOG_DAEMON);

======================================================================
files/patch-src_trace.h


--- src/trace.h.orig    2007-12-09 13:03:36 UTC
+++ src/trace.h
@@ -29,7 +29,7 @@ typedef enum {

void print_log (log_level level, const char *format, ...)
   __attribute__ ((format (printf, 2, 3)));
-inline void start_log (void);
+extern inline void start_log (void);

/* log_info
  * Normal print, to replace printf

======================================================================
files/patch-src_ushare.c


--- src/ushare.c.orig   2007-12-09 13:03:36 UTC
+++ src/ushare.c
@@ -171,6 +171,19 @@ ushare_signal_exit (void)
   pthread_mutex_unlock (&ut->termination_mutex);
}

+
+#ifdef __FreeBSD__
+static void
+*get_ip_addr(struct sockaddr *sa)
+{
+  if (sa->sa_family == AF_INET)
+    return &(((struct sockaddr_in*)sa)->sin_addr);
+  else
+    return &(((struct sockaddr_in6*)sa)->sin6_addr);
+}
+#endif /* __FreeBSD__ */
+
+
static void
handle_action_request (struct Upnp_Action_Request *request)
{
@@ -188,7 +201,11 @@ handle_action_request (struct Upnp_Actio
   if (strcmp (request->DevUDN + 5, ut->udn))
     return;

+#ifndef __FreeBSD__
   ip = request->CtrlPtIPAddr.s_addr;
+#else
+  ip = get_ip_addr((struct sockaddr *)&request->CtrlPtIPAddr) ;
+#endif /* __FreeBSD__ */
   ip = ntohl (ip);
   sprintf (val, "%d.%d.%d.%d",
            (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);
@@ -348,6 +365,7 @@ init_upnp (struct ushare_t *ut)

   UpnpEnableWebserver (TRUE);

+#ifndef __FreeBSD__
   res = UpnpSetVirtualDirCallbacks (&virtual_dir_callbacks);
   if (res != UPNP_E_SUCCESS)
   {
@@ -355,6 +373,43 @@ init_upnp (struct ushare_t *ut)
     free (description);
     return -1;
   }
+#else
+  if ((res = UpnpVirtualDir_set_GetInfoCallback(virtual_dir_callbacks.get_info)) != UPNP_E_SUCCESS ) {
+     log_error (_("Cannot set virtual directory callback - get_info\n"));
+     free (description);
+     return -1;
+  }
+
+  if ((res = UpnpVirtualDir_set_OpenCallback(virtual_dir_callbacks.open)) != UPNP_E_SUCCESS ) {
+     log_error (_("Cannot set virtual directory callback - open\n"));
+     free (description);
+     return -1;
+  }
+
+  if ((res = UpnpVirtualDir_set_ReadCallback(virtual_dir_callbacks.read)) != UPNP_E_SUCCESS ) {
+     log_error (_("Cannot set virtual directory callback - read\n"));
+     free (description);
+     return -1;
+  }
+
+  if ((res = UpnpVirtualDir_set_WriteCallback(virtual_dir_callbacks.write)) != UPNP_E_SUCCESS ) {
+     log_error (_("Cannot set virtual directory callback - write\n"));
+     free (description);
+     return -1;
+  }
+
+  if ((res = UpnpVirtualDir_set_SeekCallback(virtual_dir_callbacks.seek)) != UPNP_E_SUCCESS ) {
+     log_error (_("Cannot set virtual directory callback - seek\n"));
+     free (description);
+     return -1;
+  }
+
+  if ((res = UpnpVirtualDir_set_CloseCallback(virtual_dir_callbacks.close)) != UPNP_E_SUCCESS ) {
+     log_error (_("Cannot set virtual directory callback - close\n"));
+     free (description);
+     return -1;
+  }
+#endif /* __FreeBSD__ */

   res = UpnpAddVirtualDir (VIRTUAL_DIR);
   if (res != UPNP_E_SUCCESS)
@@ -421,6 +476,7 @@ has_iface (char *interface)
   itf = itflist;
   while (itf)
   {
+#ifndef __FreeBSD__
     if ((itf->ifa_flags & IFF_UP)
         && !strncmp (itf->ifa_name, interface, IFNAMSIZ))
     {
@@ -430,6 +486,23 @@ has_iface (char *interface)
       return true;
     }
     itf = itf->ifa_next;
+#else
+    if (strncmp (itf->ifa_name, interface, IFNAMSIZ)) {
+       itf = itf->ifa_next;
+       continue ;
+    }
+
+    if (itf->ifa_flags & IFF_UP) {
+       log_info (_("Interface %s is up.\n"), interface);
+       freeifaddrs (itflist);
+       return true ;
+    } else {
+         log_error (_("Interface %s is down.\n"), interface);
+         log_error (_("Recheck uShare's configuration and try again !\n"));
+         freeifaddrs (itflist);
+         return false ;
+      }
+#endif /*  __FreeBSD__ */
   }

   freeifaddrs (itf);
@@ -718,7 +791,7 @@ reload_config (int s __attribute__ ((unu
   }
}

-inline void
+extern inline void
display_headers (void)
{
   printf (_("%s (version %s), a lightweight UPnP A/V and DLNA Media Server.\n"),

======================================================================
files/patch-src_ushare.h


--- src/ushare.h.orig   2007-12-09 13:03:36 UTC
+++ src/ushare.h
@@ -27,6 +27,11 @@
#include <stdbool.h>
#include <pthread.h>

+#ifdef __FreeBSD__
+#include <stdio.h>
+#include <string.h>
+#endif /* __FreeBSD__ */
+
#ifdef HAVE_DLNA
#include <dlna.h>
#endif /* HAVE_DLNA */
@@ -127,6 +132,6 @@ struct action_event_t {
   struct service_t *service;
};

-inline void display_headers (void);
+extern inline void display_headers (void);

#endif /* _USHARE_H_ */

Протестировал на FreeBSD 11.1-RELEASE
Работает.

Ответить | Правка | Наверх | Cообщить модератору

10. "Старый порт uShare для FreeBSD"  +/
Сообщение от Nik_45 (ok), 20-Окт-19, 23:19 
> Вот, пожалуйста, собрал.
> Может кому пригодится.

Мне пригодился, спасибо!
На 11-й версии отлично собирется, а вот на 12-й уже не хочет.

===============================================================================================
/usr/ports/net/ushare # make
===>   NOTICE:

The ushare port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://www.freebsd.org/doc/en/articles/contributing/ports-c...

===>   ushare-1.1a_10 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by ushare-1.1a_10 for building
===>  Extracting for ushare-1.1a_10
=> SHA256 Checksum OK for ushare-1.1a.tar.bz2.
===>  Patching for ushare-1.1a_10
===>  Applying FreeBSD patches for ushare-1.1a_10
===>   ushare-1.1a_10 depends on executable: msgfmt - found
===>   ushare-1.1a_10 depends on executable: gmake - found
===>   ushare-1.1a_10 depends on package: pkgconf>=1.3.0_1 - found
===>   ushare-1.1a_10 depends on shared library: libupnp.so - found (/usr/local/lib/libupnp.so)
===>   ushare-1.1a_10 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>  Configuring for ushare-1.1a_10
./configure: gcc: not found
Checking for compiler available...
Checking for locales ...
Checking for ifaddrs ...
Checking for langinfo ...
Checking for iconv ...
Checking for libixml ...
Checking for libthreadutil ...
Error, can't find libthreadutil !
See file "config.log" produced by configure for more details.
===>  Script "configure" failed unexpectedly.
Please report the problem to ports@FreeBSD.org [maintainer] and attach the
"/usr/ports/net/ushare/work/ushare-1.1a/config.log" including the output of
the failure of your make command. Also, it might be a good idea to provide
an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make: stopped in /usr/ports/net/ushare

===============================================================================================
фрагмент лог файла

Checking for libthreadutil ...
check_lib upnp/ThreadPool.h ThreadPoolAdd -lthreadutil -lpthread
check_header upnp/ThreadPool.h
check_cpp
BEGIN /tmp/ushare--41873-.c
     1    #include <upnp/ThreadPool.h>
     2    int x;
END /tmp/ushare--41873-.c
cc -O2 -pipe -I/usr/local/include -I/usr/ports/net/ushare/work/ushare-1.1a -fstack-protector-strong -fno-strict-aliasing -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -O3 -DHAVE_LOCALE_H -DHAVE_SETLOCALE -DHAVE_IFADDRS_H -DHAVE_LANGINFO_H -DHAVE_LANGINFO_CODESET -DHAVE_ICONV -E -o /tmp/ushare--41873-.o /tmp/ushare--41873-.c
/tmp/ushare--41873-.c:1:10: fatal error: 'upnp/ThreadPool.h' file not found
#include <upnp/ThreadPool.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
Error, can't find libthreadutil !


Ответить | Правка | Наверх | Cообщить модератору

Архив | Удалить

Рекомендовать для помещения в FAQ | Индекс форумов | Темы | Пред. тема | След. тема




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру