From 0daad9cc9cd1c1d63f741c379bf19d465823fd5d Mon Sep 17 00:00:00 2001 From: medaved Date: Tue, 15 Jul 2014 21:13:56 +0400 Subject: [PATCH] first commit --- multimedia/minidlna/Makefile | 91 ++++++++++++++++++ multimedia/minidlna/files/minidlna.config | 17 ++++ multimedia/minidlna/files/minidlna.init | 96 +++++++++++++++++++ .../minidlna/patches/010-libav-fix.patch | 19 ++++ .../patches/020-makefileam-tweaks.patch | 32 +++++++ 5 files changed, 255 insertions(+) create mode 100644 multimedia/minidlna/Makefile create mode 100644 multimedia/minidlna/files/minidlna.config create mode 100644 multimedia/minidlna/files/minidlna.init create mode 100644 multimedia/minidlna/patches/010-libav-fix.patch create mode 100644 multimedia/minidlna/patches/020-makefileam-tweaks.patch diff --git a/multimedia/minidlna/Makefile b/multimedia/minidlna/Makefile new file mode 100644 index 000000000..796ab643f --- /dev/null +++ b/multimedia/minidlna/Makefile @@ -0,0 +1,91 @@ +# +# Copyright (C) 2010-2013 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:=minidlna +PKG_VERSION:=1.1.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/minidlna +PKG_MD5SUM:=879027192C89E5376CDD2AE2D1AA33B4 + +PKG_BUILD_PARALLEL:=0 +PKG_BUILD_DEPENDS:=util-linux + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/minidlna + SECTION:=multimedia + CATEGORY:=Multimedia + TITLE:=UPnP A/V & DLNA Media Server + URL:=http://minidlna.sourceforge.net/ + DEPENDS:= +libpthread +libexif +libjpeg +libsqlite3 +libffmpeg \ + +libid3tag +libflac +libvorbis +libuuid \ + $(ICONV_DEPENDS) $(INTL_DEPENDS) +endef + +define Package/minidlna/description + MiniDLNA (aka ReadyDLNA) is server software with the aim of + being fully compliant with DLNA/UPnP-AV clients. +endef + +define Package/minidlna/conffiles +/etc/minidlna.conf +endef + +TARGET_CPPFLAGS += \ + -I$(STAGING_DIR)/usr/include \ + -I$(STAGING_DIR)/usr/include/FLAC \ + -I$(STAGING_DIR)/usr/include/libavcodec \ + -I$(STAGING_DIR)/usr/include/libavformat \ + -I$(STAGING_DIR)/usr/include/libavutil \ + -I$(STAGING_DIR)/usr/include/libexif \ + -I$(STAGING_DIR)/usr/include/uuid \ + -I$(STAGING_DIR)/usr/include/vorbis \ + -I$(ICONV_PREFIX)/include \ + -I$(INTL_PREFIX)/include \ + -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ + +TARGET_LDFLAGS += \ + -L$(ICONV_PREFIX)/lib \ + -L$(INTL_PREFIX)/lib \ + -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \ + +MAKE_FLAGS +=\ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + ICONV_LIBS="-liconv $(if $(INTL_FULL),-lintl)" \ + +MAKE_VARS +=\ + PREFIX="$(STAGING_DIR)/usr" \ + ICONV_PREFIX="$(ICONV_PREFIX)" \ + INTL_PREFIX="$(INTL_PREFIX)" \ + OS_NAME="OpenWrt Linux" \ + OS_VERSION="$(LINUX_VERSION)" \ + OS_URL="http://openwrt.org/" \ + DB_PATH="/var/run/minidlna" \ + LOG_PATH="/var/log" \ + + +define Package/minidlna/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/minidlna $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/minidlna.init $(1)/etc/init.d/minidlna + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/minidlna.config $(1)/etc/config/minidlna +endef + +define Package/minidlna/conffiles +/etc/config/minidlna +endef + +$(eval $(call BuildPackage,minidlna)) diff --git a/multimedia/minidlna/files/minidlna.config b/multimedia/minidlna/files/minidlna.config new file mode 100644 index 000000000..459be3e8e --- /dev/null +++ b/multimedia/minidlna/files/minidlna.config @@ -0,0 +1,17 @@ +config minidlna config + option 'enabled' '0' + option port '8200' + option interface 'br-lan' + option friendly_name 'OpenWrt DLNA Server' + option db_dir '/var/run/minidlna' + option log_dir '/var/log' + option inotify '1' + option enable_tivo '0' + option strict_dlna '0' + option presentation_url '' + option notify_interval '900' + option serial '12345678' + option model_number '1' + option root_container '.' + list media_dir '/mnt' + option album_art_names 'Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg' diff --git a/multimedia/minidlna/files/minidlna.init b/multimedia/minidlna/files/minidlna.init new file mode 100644 index 000000000..581c8d1f5 --- /dev/null +++ b/multimedia/minidlna/files/minidlna.init @@ -0,0 +1,96 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2010 OpenWrt.org + +START=50 + +SERVICE_USE_PID=1 + +MINIDLNA_CONFIG_FILE="/tmp/minidlna.conf" + +minidlna_cfg_append() { + echo "$1" >> "$MINIDLNA_CONFIG_FILE" +} + +minidlna_cfg_addbool() { + local cfg="$1" + local key="$2" + local def="$3" + local val + + config_get_bool val "$cfg" "$key" "$def" + [ "$val" -gt 0 ] && val="yes" || val="no" + minidlna_cfg_append "$key=$val" +} + +minidlna_cfg_addstr() { + local cfg="$1" + local key="$2" + local def="$3" + local val + + config_get val "$cfg" "$key" "$def" + [ -n "$val" ] && minidlna_cfg_append "$key=$val" +} + +minidlna_cfg_add_media_dir() { + local val=$1 + + minidlna_cfg_append "media_dir=$val" +} + +minidlna_create_config() { + local cfg=$1 + local port + local interface + + config_get port $cfg port + config_get interface $cfg interface + + [ -z "$interface" -o -t "$port" ] && return 1 + + echo "# this file is generated automatically, don't edit" > "$MINIDLNA_CONFIG_FILE" + + minidlna_cfg_append "port=$port" + minidlna_cfg_append "network_interface=$interface" + + minidlna_cfg_addstr $cfg friendly_name + minidlna_cfg_addstr $cfg db_dir + minidlna_cfg_addstr $cfg log_dir + minidlna_cfg_addbool $cfg inotify '1' + minidlna_cfg_addbool $cfg enable_tivo '0' + minidlna_cfg_addbool $cfg strict_dlna '0' + minidlna_cfg_addstr $cfg album_art_names + minidlna_cfg_addstr $cfg presentation_url + minidlna_cfg_addstr $cfg notify_interval '900' + minidlna_cfg_addstr $cfg serial '12345678' + minidlna_cfg_addstr $cfg model_number '1' + minidlna_cfg_addstr $cfg minissdpsocket + minidlna_cfg_addstr $cfg root_container '.' + config_list_foreach "$cfg" "media_dir" minidlna_cfg_add_media_dir + + return 0 +} + +start() { + local enabled + local db_dir + local log_dir + + config_load 'minidlna' + config_get_bool enabled config 'enabled' '0' + + [ "$enabled" -gt 0 ] || return 1 + + minidlna_create_config config || return 1 + + config_get db_dir config 'db_dir' '/var/run/minidlna' + config_get log_dir config 'log_dir' '/var/log' + + mkdir -m 0755 -p $db_dir + mkdir -m 0755 -p $log_dir + service_start /usr/bin/minidlna -f "$MINIDLNA_CONFIG_FILE" +} + +stop() { + service_stop /usr/bin/minidlna +} diff --git a/multimedia/minidlna/patches/010-libav-fix.patch b/multimedia/minidlna/patches/010-libav-fix.patch new file mode 100644 index 000000000..59245998c --- /dev/null +++ b/multimedia/minidlna/patches/010-libav-fix.patch @@ -0,0 +1,19 @@ +--- a/libav.h ++++ b/libav.h +@@ -167,7 +167,7 @@ + static inline int + lav_is_thumbnail_stream(AVStream *s, uint8_t **data, int *size) + { +-#if LIBAVFORMAT_VERSION_INT >= ((54<<16)+(6<<8)) ++/*if LIBAVFORMAT_VERSION_INT >= ((54<<16)+(6<<8)) + if (s->disposition & AV_DISPOSITION_ATTACHED_PIC && + s->codec->codec_id == AV_CODEC_ID_MJPEG) + { +@@ -177,6 +177,6 @@ + *size = s->attached_pic.size; + return 1; + } +-#endif ++endif*/ + return 0; + } diff --git a/multimedia/minidlna/patches/020-makefileam-tweaks.patch b/multimedia/minidlna/patches/020-makefileam-tweaks.patch new file mode 100644 index 000000000..93d3f3cb1 --- /dev/null +++ b/multimedia/minidlna/patches/020-makefileam-tweaks.patch @@ -0,0 +1,32 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -19,9 +19,9 @@ + + SUBDIRS=po + +-sbin_PROGRAMS = minidlnad ++sbin_PROGRAMS = minidlna + check_PROGRAMS = testupnpdescgen +-minidlnad_SOURCES = minidlna.c upnphttp.c upnpdescgen.c upnpsoap.c \ ++minidlna_SOURCES = minidlna.c upnphttp.c upnpdescgen.c upnpsoap.c \ + upnpreplyparse.c minixml.c clients.c \ + getifaddr.c process.c upnpglobalvars.c \ + options.c minissdp.c uuid.c upnpevents.c \ +@@ -38,7 +38,7 @@ + flacoggflag = -logg + #endif + +-minidlnad_LDADD = \ ++minidlna_LDADD = \ + @LIBJPEG_LIBS@ \ + @LIBID3TAG_LIBS@ \ + @LIBSQLITE3_LIBS@ \ +@@ -49,7 +49,7 @@ + @LIBICONV@ \ + -lFLAC $(flacoggflag) $(vorbisflag) + +-minidlnad_LDFLAGS = @STATIC_LDFLAGS@ ++minidlna_LDFLAGS = @STATIC_LDFLAGS@ + + testupnpdescgen_SOURCES = testupnpdescgen.c upnpdescgen.c + testupnpdescgen_LDADD = \