From c5668043d54b597d7218c7931e0096e0a2725d2a Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 21 Mar 2010 12:38:24 -0500
Subject: mediatomb: first import
 http://aur.archlinux.org/packages.php?ID=10199

untested
closes 588
---
 abs/extra-testing/community/mediatomb/PKGBUILD     | 57 +++++++++++++++++++++
 .../mediatomb/mediatomb-0.11.0+glibc-2.10.patch    | 23 +++++++++
 .../community/mediatomb/mediatomb-gcc-4.3.patch    | 24 +++++++++
 .../community/mediatomb/mediatomb.conf             |  5 ++
 abs/extra-testing/community/mediatomb/mediatomb.rc | 58 ++++++++++++++++++++++
 5 files changed, 167 insertions(+)
 create mode 100644 abs/extra-testing/community/mediatomb/PKGBUILD
 create mode 100644 abs/extra-testing/community/mediatomb/mediatomb-0.11.0+glibc-2.10.patch
 create mode 100644 abs/extra-testing/community/mediatomb/mediatomb-gcc-4.3.patch
 create mode 100644 abs/extra-testing/community/mediatomb/mediatomb.conf
 create mode 100755 abs/extra-testing/community/mediatomb/mediatomb.rc

diff --git a/abs/extra-testing/community/mediatomb/PKGBUILD b/abs/extra-testing/community/mediatomb/PKGBUILD
new file mode 100644
index 0000000..aaf4d58
--- /dev/null
+++ b/abs/extra-testing/community/mediatomb/PKGBUILD
@@ -0,0 +1,57 @@
+# Orginal Contributor: William Rea <sillywilly@gmail.com>
+# Contributor: Nikhil Bysani <nikron@gmail.com>
+# Contributor: Mika Hynnä <igheax@gmail.com>
+
+# 20090525: 
+#	+ makedepends=('gcc' 'patch' 'make')
+#	+ mediatomb-0.11.0+glibc-2.10.patch
+
+pkgname=mediatomb
+pkgver=0.11.0
+pkgrel=10
+pkgdesc="A UPnP mediaserver"
+arch=('i686' 'x86_64')
+url="http://mediatomb.sourceforge.net"
+license=('GPL')
+depends=('libexif' 'taglib' 'sqlite3' 'expat' 'spidermonkey' 'curl' 'ffmpeg')
+makedepends=('gcc' 'patch' 'make')
+backup=(etc/conf.d/mediatomb)
+source=(
+	http://mesh.dl.sourceforge.net/sourceforge/mediatomb/mediatomb-$pkgver.tar.gz \
+	mediatomb.rc \
+	mediatomb.conf \
+	http://kapsi.fi/~ighea/arch/mediatomb-gcc-4.3.patch
+	mediatomb-0.11.0+glibc-2.10.patch
+)
+
+build()
+{
+	cd $startdir/src/mediatomb-$pkgver || return 1
+	patch -Np1 < ../mediatomb-gcc-4.3.patch || return 1
+	patch -Np0 < ../mediatomb-0.11.0+glibc-2.10.patch || return 1
+	
+	sed -e s/"ffmpeg\/avformat.h"/"libavformat\/avformat.h"/g -i configure
+	sed -e s/"ffmpeg\/avformat.h"/"libavformat\/avformat.h"/g -i configure.ac
+	sed -e s/"ffmpeg\/avformat.h"/"libavformat\/avformat.h"/g -i src/metadata/ffmpeg_handler.cc
+	
+
+	./configure --prefix=/usr --enable-mysql=no --enable-libmagic=yes \
+	 --enable-libjs=yes --enable-ffmpeg --with-ffmpeg-h=/usr/include/ || return 1
+
+	make || return 1
+	make DESTDIR=$startdir/pkg install || return 1
+
+	# rc-script
+	mkdir -p $startdir/pkg/etc/rc.d/ || return 1
+	install -m0755 ../mediatomb.rc $startdir/pkg/etc/rc.d/mediatomb || return 1
+
+	# config-file
+	mkdir -p $startdir/pkg/etc/conf.d/ || return 1
+	install -m0644 ../mediatomb.conf $startdir/pkg/etc/conf.d/mediatomb || return 1
+
+}
+md5sums=('661f08933830d920de21436fe122fb15'
+         'a7ff197d5760b20b04675ba67bfd9e86'
+         'a4cbd08c32c93f116363a29bef60e21d'
+         'eda28d01e035b3237566da5b1aad7712'
+         '3b895eabee88a0697b4fd0c30af6cab2')
diff --git a/abs/extra-testing/community/mediatomb/mediatomb-0.11.0+glibc-2.10.patch b/abs/extra-testing/community/mediatomb/mediatomb-0.11.0+glibc-2.10.patch
new file mode 100644
index 0000000..b1436c1
--- /dev/null
+++ b/abs/extra-testing/community/mediatomb/mediatomb-0.11.0+glibc-2.10.patch
@@ -0,0 +1,23 @@
+--- src/tools.cc	(revisione 2018)
++++ src/tools.cc	(copia locale)
+@@ -303,8 +303,8 @@
+     Ref<StringBuffer> buf(new StringBuffer(len / 2));
+     for (int i = 0; i < len; i += 2)
+     {
+-        char *chi = strchr(HEX_CHARS, ptr[i]);
+-        char *clo = strchr(HEX_CHARS, ptr[i + 1]);
++        const char *chi = strchr(HEX_CHARS, ptr[i]);
++        const char *clo = strchr(HEX_CHARS, ptr[i + 1]);
+         int hi, lo;
+         
+         if (chi)
+@@ -397,7 +397,7 @@
+             char clo = data[i++];
+             int hi, lo;
+ 
+-            char *pos;
++            const char *pos;
+ 
+             pos = strchr(hex, chi);
+             if (!pos)
+
diff --git a/abs/extra-testing/community/mediatomb/mediatomb-gcc-4.3.patch b/abs/extra-testing/community/mediatomb/mediatomb-gcc-4.3.patch
new file mode 100644
index 0000000..9440bec
--- /dev/null
+++ b/abs/extra-testing/community/mediatomb/mediatomb-gcc-4.3.patch
@@ -0,0 +1,24 @@
+# GCC-4.3 compatibility patch by Mika Hynnä (ighea) <igheaxATgmailDOTcom>
+#
+--- mediatomb-0.11.0/src/url.cc	2008-03-02 00:48:36.000000000 +0200
++++ mediatomb-0.11.0.new/src/url.cc	2008-04-14 00:53:21.000000000 +0300
+@@ -75,7 +75,7 @@
+ 
+     if (only_header)
+     {
+-        curl_easy_setopt(curl_handle, CURLOPT_NOBODY);
++        curl_easy_setopt(curl_handle, CURLOPT_NOBODY,0);
+         curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, URL::dl);
+         curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, 
+                          (void *)buffer.getPtr());
+--- mediatomb-0.11.0/src/metadata/id3_handler.cc	2008-03-02 00:48:36.000000000 +0200
++++ mediatomb-0.11.0.new/src/metadata/id3_handler.cc	2008-04-14 01:22:36.000000000 +0300
+@@ -36,6 +36,8 @@
+ 
+ #ifdef HAVE_ID3
+ 
++#include <string.h>
++
+ #ifdef HAVE_CONFIG_H
+     #undef HAVE_CONFIG_H // else utils.h from the id3 library tries to import "config.h"
+ 
diff --git a/abs/extra-testing/community/mediatomb/mediatomb.conf b/abs/extra-testing/community/mediatomb/mediatomb.conf
new file mode 100644
index 0000000..339bd9e
--- /dev/null
+++ b/abs/extra-testing/community/mediatomb/mediatomb.conf
@@ -0,0 +1,5 @@
+# User to run the mediatomb as:
+USER=""
+# Extra parameters to pass to the daemon:
+PARAMS=""
+
diff --git a/abs/extra-testing/community/mediatomb/mediatomb.rc b/abs/extra-testing/community/mediatomb/mediatomb.rc
new file mode 100755
index 0000000..b3333cc
--- /dev/null
+++ b/abs/extra-testing/community/mediatomb/mediatomb.rc
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+DESC="MediaTomb UPnP A/V Media Server"
+
+USER=""
+
+if [ "$(whoami)" != "root" ];then
+ echo "You must be root to start/restart/stop services."
+ exit 1
+fi
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -r "/etc/conf.d/mediatomb" ] && . /etc/conf.d/mediatomb
+
+PID=`pidof -o %PPID /usr/bin/mediatomb`
+
+case "$1" in
+  start)
+    stat_busy "Starting $DESC"
+    if [ -z "$PID" ]; then
+	if [ -n "$USER" ]; then
+		echo -n "Starting as user: $USER"
+		su - $USER -c "/usr/bin/mediatomb -d $PARAMS &> /dev/null" || stat_fail
+	else
+		/usr/bin/mediatomb -d $PARAMS &> /dev/null || stat_fail
+	fi
+	PID=`pidof -o %PPID /usr/bin/mediatomb`
+	if [ -z "$PID" ]; then exit 1;fi
+	echo $PID > /var/run/mediatomb.pid
+	add_daemon mediatomb
+        stat_done
+    else    
+		echo -n "Already running!"
+		stat_fail
+    fi
+    ;;
+  stop)
+    stat_busy "Stopping $DESC"
+    [ ! -z "$PID" ] && kill $PID &> /dev/null
+    if [ $? -gt 0 ]; then
+      echo -n "Not started!"
+      stat_fail
+    else
+      rm /var/run/mediatomb.pid
+      rm_daemon mediatomb
+      stat_done
+    fi
+    ;;
+  restart)
+    $0 stop
+    sleep 1
+    $0 start
+    ;;
+  *)
+    echo "usage: $0 {start|stop|restart}"
+esac
-- 
cgit v0.12

