minidlna: moved to github
minidlna: moved to github

git-svn-id: svn://svn.openwrt.org/openwrt/packages@41781 3c298f89-4303-0410-b956-a3cf2f4a3e73

#  
# 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.0.25  
PKG_RELEASE:=1  
 
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)_src.tar.gz  
PKG_SOURCE_URL:=@SF/minidlna  
PKG_MD5SUM:=d966256baf2f9b068b9de871ab5dade5  
 
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))  
 
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'  
 
#!/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  
}  
 
--- a/genconfig.sh  
+++ b/genconfig.sh  
@@ -23,14 +23,18 @@ RM="rm -f"  
CONFIGFILE="config.h"  
CONFIGMACRO="__CONFIG_H__"  
 
+PREFIX="${PREFIX:-/usr}"  
+ICONV_PREFIX="${ICONV_PREFIX:-$PREFIX}"  
+INTL_PREFIX="${INTL_PREFIX:-$PREFIX}"  
+  
# Database path  
-DB_PATH="/tmp/minidlna"  
+DB_PATH="${DB_PATH:-/tmp/minidlna}"  
# Log path  
-LOG_PATH="${DB_PATH}"  
+LOG_PATH="${LOG_PATH:-$DB_PATH}"  
 
# detecting the OS name and version  
-OS_NAME=`uname -s`  
-OS_VERSION=`uname -r`  
+OS_NAME="${OS_NAME:-$(uname -s)}"  
+OS_VERSION="${OS_VERSION:-$(uname -r)}"  
TIVO="/*#define TIVO_SUPPORT*/"  
NETGEAR="/*#define NETGEAR*/"  
READYNAS="/*#define READYNAS*/"  
@@ -40,22 +44,22 @@ ${RM} ${CONFIGFILE}  
 
# Detect if there are missing headers  
# NOTE: This check only works with a normal distro  
-[ ! -e "/usr/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING"  
-[ ! -e "/usr/include/jpeglib.h" ] && MISSING="libjpeg $MISSING"  
-[ ! -e "/usr/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING"  
-[ ! -e "/usr/include/id3tag.h" ] && MISSING="libid3tag $MISSING"  
-[ ! -e "/usr/include/ogg/ogg.h" ] && MISSING="libogg $MISSING"  
-[ ! -e "/usr/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING"  
-[ ! -e "/usr/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING"  
-[ ! -e "/usr/include/ffmpeg/avutil.h" -a \  
- ! -e "/usr/include/libavutil/avutil.h" -a \  
- ! -e "/usr/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING"  
-[ ! -e "/usr/include/ffmpeg/avformat.h" -a \  
- ! -e "/usr/include/libavformat/avformat.h" -a \  
- ! -e "/usr/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING"  
-[ ! -e "/usr/include/ffmpeg/avcodec.h" -a \  
- ! -e "/usr/include/libavcodec/avcodec.h" -a \  
- ! -e "/usr/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING"  
+[ ! -e "${PREFIX}/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING"  
+[ ! -e "${PREFIX}/include/jpeglib.h" ] && MISSING="libjpeg $MISSING"  
+[ ! -e "${PREFIX}/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING"  
+[ ! -e "${PREFIX}/include/id3tag.h" ] && MISSING="libid3tag $MISSING"  
+[ ! -e "${PREFIX}/include/ogg/ogg.h" ] && MISSING="libogg $MISSING"  
+[ ! -e "${PREFIX}/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING"  
+[ ! -e "${PREFIX}/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING"  
+[ ! -e "${PREFIX}/include/ffmpeg/avutil.h" -a \  
+ ! -e "${PREFIX}/include/libavutil/avutil.h" -a \  
+ ! -e "${PREFIX}/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING"  
+[ ! -e "${PREFIX}/include/ffmpeg/avformat.h" -a \  
+ ! -e "${PREFIX}/include/libavformat/avformat.h" -a \  
+ ! -e "${PREFIX}/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING"  
+[ ! -e "${PREFIX}/include/ffmpeg/avcodec.h" -a \  
+ ! -e "${PREFIX}/include/libavcodec/avcodec.h" -a \  
+ ! -e "${PREFIX}/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING"  
if [ -n "$MISSING" ]; then  
echo -e "\nERROR! Cannot continue."  
echo -e "The following required libraries are either missing, or are missing development headers:\n"  
@@ -151,8 +155,7 @@ case $OS_NAME in  
fi  
;;  
*)  
- echo "Unknown OS : $OS_NAME"  
- exit 1  
+ echo "WARNING: Unknown OS : $OS_NAME" 1>&2  
;;  
esac  
 
@@ -183,7 +186,7 @@ fi  
echo "" >> ${CONFIGFILE}  
 
echo "/* Enable if the system iconv.h exists. ID3 tag reading in various character sets will not work properly otherwise. */" >> ${CONFIGFILE}  
-if [ -f /usr/include/iconv.h ]; then  
+if [ -f ${ICONV_PREFIX}/include/iconv.h ]; then  
echo "#define HAVE_ICONV_H" >> ${CONFIGFILE}  
else  
echo -e "\nWARNING!! Iconv support not found. ID3 tag reading may not work."  
@@ -192,7 +195,7 @@ fi  
echo "" >> ${CONFIGFILE}  
 
echo "/* Enable if the system libintl.h exists for NLS support. */" >> ${CONFIGFILE}  
-if [ -f /usr/include/libintl.h ]; then  
+if [ -f ${INTL_PREFIX}/include/libintl.h ]; then  
echo "#define ENABLE_NLS" >> ${CONFIGFILE}  
else  
echo "/*#define ENABLE_NLS*/" >> ${CONFIGFILE}  
 
--- a/Makefile  
+++ b/Makefile  
@@ -10,19 +10,23 @@  
# or :  
# $ make install  
#  
+PREFIX ?= /usr  
+ICONV_PREFIX ?= $(PREFIX)  
+INTL_PREFIX ?= $(PREFIX)  
#CFLAGS = -Wall -O -D_GNU_SOURCE -g -DDEBUG  
#CFLAGS = -Wall -g -Os -D_GNU_SOURCE  
CFLAGS = -Wall -g -O3 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \  
- -I/usr/include/ffmpeg \  
- -I/usr/include/libavutil -I/usr/include/libavcodec -I/usr/include/libavformat \  
- -I/usr/include/ffmpeg/libavutil -I/usr/include/ffmpeg/libavcodec -I/usr/include/ffmpeg/libavformat  
+ -I$(PREFIX)/include/ffmpeg \  
+ -I$(PREFIX)/include/libavutil -I$(PREFIX)/include/libavcodec -I$(PREFIX)/include/libavformat \  
+ -I$(PREFIX)/include/ffmpeg/libavutil -I$(PREFIX)/include/ffmpeg/libavcodec -I$(PREFIX)/include/ffmpeg/libavformat  
+  
#STATIC_LINKING: CFLAGS += -DSTATIC  
#STATIC_LINKING: LDFLAGS = -static  
CC = gcc  
RM = rm -f  
INSTALL = install  
 
-INSTALLPREFIX ?= $(DESTDIR)/usr  
+INSTALLPREFIX ?= $(DESTDIR)$(PREFIX)  
SBININSTALLDIR = $(INSTALLPREFIX)/sbin  
ETCINSTALLDIR = $(DESTDIR)/etc  
 
@@ -37,7 +41,7 @@ BASEOBJS = minidlna.o upnphttp.o upnpdes  
 
ALLOBJS = $(BASEOBJS) $(LNXOBJS)  
 
-LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis  
+LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis -luuid $(ICONV_LIBS)  
#STATIC_LINKING: LIBS = -lvorbis -logg -lm -lsqlite3 -lpthread -lexif -ljpeg -lFLAC -lm -lid3tag -lz -lavformat -lavutil -lavcodec -lm  
 
TESTUPNPDESCGENOBJS = testupnpdescgen.o upnpdescgen.o  
@@ -64,7 +68,7 @@ install-conf:  
$(INSTALL) -d $(ETCINSTALLDIR)  
$(INSTALL) --mode=0644 minidlna.conf $(ETCINSTALLDIR)  
 
-minidlna: $(BASEOBJS) $(LNXOBJS) $(LIBS)  
+minidlna: $(BASEOBJS) $(LNXOBJS)  
@echo Linking $@  
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BASEOBJS) $(LNXOBJS) $(LIBS)  
 
 
--- a/minidlna.c  
+++ b/minidlna.c  
@@ -58,6 +58,7 @@  
#include <fcntl.h>  
#include <sys/file.h>  
#include <sys/time.h>  
+#include <sys/stat.h>  
#include <time.h>  
#include <signal.h>  
#include <sys/param.h>  
 
--- a/metadata.c 2012-08-27 23:00:06.997932249 +0100  
+++ b/metadata.c 2012-08-27 23:10:07.716582960 +0100  
@@ -110,7 +110,7 @@ lav_open(AVFormatContext **ctx, const ch  
static inline void  
lav_close(AVFormatContext *ctx)  
{  
-#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)  
+#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0)  
avformat_close_input(&ctx);  
#else  
av_close_input_file(ctx);  
 
comments