Browse Source

xupnpd: Import r398 from packages and update to r399.

lilik-openwrt-22.03
Álvaro Fernández Rojas 11 years ago
parent
commit
4aaeb5fd68
4 changed files with 184 additions and 0 deletions
  1. +71
    -0
      multimedia/xupnpd/Makefile
  2. +15
    -0
      multimedia/xupnpd/files/xupnpd.init
  3. +15
    -0
      multimedia/xupnpd/patches/100-default_config.patch
  4. +83
    -0
      multimedia/xupnpd/patches/101-root_dir_param.patch

+ 71
- 0
multimedia/xupnpd/Makefile View File

@ -0,0 +1,71 @@
#
# Copyright (C) 2013-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=xupnpd
PKG_REV:=399
PKG_VERSION:=$(PKG_REV)
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=xupnpd-$(PKG_VERSION)
PKG_SOURCE_URL:=http://tsdemuxer.googlecode.com/svn/trunk/xupnpd/src/
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
include $(INCLUDE_DIR)/package.mk
LUA_FLAGS:=-llua
define Build/Compile
(cd $(PKG_BUILD_DIR); $(TARGET_CC) -v $(LUA_FLAGS) $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -DWITH_URANDOM $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS) -lm -ldl -lcrypt -o xupnpd *.c *.cpp)
endef
define Package/xupnpd
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:=+liblua
TITLE:=eXtensible UPnP agent
URL:=http://xupnpd.org/
endef
define Package/xupnpd/conffiles
/usr/share/xupnpd/xupnpd.lua
/usr/share/xupnpd/config
/usr/share/xupnpd/playlists
endef
define Package/xupnpd/description
xupnpd - eXtensible UPnP agent
This program is a light DLNA Media Server which provides ContentDirectory:1 service for sharing IPTV unicast streams over local area network (with udpxy for multicast to HTTP unicast conversion).
The program shares UTF8-encoded M3U playlists with links over local area network as content of the directory.
You can watch HDTV broadcasts (multicast or unicast) and listen Internet Radio in IP network without transcoding and PC.
endef
define Package/xupnpd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/xupnpd $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/xupnpd.init $(1)/etc/init.d/xupnpd
$(INSTALL_DIR) $(1)/usr/share/xupnpd
$(CP) $(PKG_BUILD_DIR)/*.lua $(1)/usr/share/xupnpd
$(INSTALL_DIR) $(1)/usr/share/xupnpd/ui
$(CP) $(PKG_BUILD_DIR)/ui/* $(1)/usr/share/xupnpd/ui
$(INSTALL_DIR) $(1)/usr/share/xupnpd/www
$(CP) $(PKG_BUILD_DIR)/www/* $(1)/usr/share/xupnpd/www
$(INSTALL_DIR) $(1)/usr/share/xupnpd/playlists
$(INSTALL_DIR) $(1)/usr/share/xupnpd/plugins
$(CP) $(PKG_BUILD_DIR)/plugins/* $(1)/usr/share/xupnpd/plugins
$(INSTALL_DIR) $(1)/usr/share/xupnpd/config
$(INSTALL_DIR) $(1)/etc/xupnpd
(cd $(1)/etc/xupnpd; ln -s ../../usr/share/xupnpd/config ./; ln -s ../../usr/share/xupnpd/xupnpd.lua ./)
$(INSTALL_DIR) $(1)/usr/share/xupnpd/localmedia
endef
$(eval $(call BuildPackage,xupnpd))

+ 15
- 0
multimedia/xupnpd/files/xupnpd.init View File

@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2013-2014 OpenWrt.org
START=50
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/bin/xupnpd
procd_append_param command -d /usr/share/xupnpd
procd_set_param respawn
procd_close_instance
}

+ 15
- 0
multimedia/xupnpd/patches/100-default_config.patch View File

@ -0,0 +1,15 @@
--- a/xupnpd.lua
+++ b/xupnpd.lua
@@ -1,10 +1,10 @@
cfg={}
-- multicast interface for SSDP exchange, 'eth0', 'br0', 'br-lan' for example
-cfg.ssdp_interface='lo'
+cfg.ssdp_interface='br-lan'
-- 'cfg.ssdp_loop' enables multicast loop (if player and server in one host)
-cfg.ssdp_loop=1
+cfg.ssdp_loop=0
-- SSDP announcement interval
cfg.ssdp_notify_interval=15

+ 83
- 0
multimedia/xupnpd/patches/101-root_dir_param.patch View File

@ -0,0 +1,83 @@
--- a/main.cpp
+++ b/main.cpp
@@ -4,11 +4,14 @@
* https://tsdemuxer.googlecode.com/svn/trunk/xupnpd
*/
+#include <ctype.h>
#include <stdio.h>
#include <syslog.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include "luacompat.h"
#include "luaxlib.h"
#include "luaxcore.h"
@@ -16,35 +19,36 @@
int main(int argc,char** argv)
{
- const char* p=strrchr(argv[0],'/');
-
- int rc;
-
- if(p)
- {
- char location[512];
- int n=p-argv[0];
- if(n>=sizeof(location))
- n=sizeof(location)-1;
- strncpy(location,argv[0],n);
- location[n]=0;
-
- rc=chdir(location);
-
- argv[0]=(char*)p+1;
- }
-
- const char* root=getenv("XUPNPDROOTDIR");
- if(root && *root)
- rc=chdir(root);
-
- {
- FILE* fp=fopen("xupnpd.lua","r");
- if(fp)
- fclose(fp);
- else
- rc=chdir("/usr/share/xupnpd/");
- }
+ int c;
+ char *xupnpd_root = "/usr/share/xupnpd/";
+ struct stat s;
+
+ opterr = 0;
+ while ((c = getopt (argc, argv, "d:")) != -1) {
+ switch (c) {
+ case 'd':
+ xupnpd_root = optarg;
+ break;
+ case '?':
+ if (optopt == 'd')
+ fprintf(stderr, "Option -%c requires an argument.\n", optopt);
+ else if (isprint(optopt))
+ fprintf(stderr, "Unknown option \"-%c\".\n", optopt);
+ else
+ fprintf(stderr, "Unknown option\n");
+ return 1;
+ default:
+ abort();
+ }
+ }
+
+ if(stat(xupnpd_root, &s) != -1 && S_ISDIR(s.st_mode)) {
+ c = chdir(xupnpd_root);
+ }
+ else {
+ fprintf(stderr, "Directory %s doesn't exist.\n", xupnpd_root);
+ return 1;
+ }
lua_State* L=lua_open();
if(L)

Loading…
Cancel
Save