aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Lock <nox@FreeBSD.org>2011-03-26 19:13:50 +0000
committerJuergen Lock <nox@FreeBSD.org>2011-03-26 19:13:50 +0000
commit0f8592a752db2bbc69de164655d2e424f89e9504 (patch)
treee7b1c67b8a8e1e4843448b489e02302140c1ad9a
parent4ca62e90763f54ae048aeb7db6b82b22dadb6709 (diff)
downloadports-0f8592a752db2bbc69de164655d2e424f89e9504.tar.gz
ports-0f8592a752db2bbc69de164655d2e424f89e9504.zip
Notes
-rw-r--r--multimedia/Makefile1
-rw-r--r--multimedia/vdr/Makefile93
-rw-r--r--multimedia/vdr/Makefile.plugins50
-rw-r--r--multimedia/vdr/distinfo2
-rw-r--r--multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsddevice.c10
-rw-r--r--multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsdffdevice.c19
-rw-r--r--multimedia/vdr/files/patch-device.c11
-rw-r--r--multimedia/vdr/files/patch-device.h20
-rw-r--r--multimedia/vdr/files/patch-dvbdevice.c27
-rw-r--r--multimedia/vdr/files/patch-menuitems.c10
-rw-r--r--multimedia/vdr/files/patch-plugin.c19
-rw-r--r--multimedia/vdr/files/patch-tools.c38
-rw-r--r--multimedia/vdr/files/patch-tools.c-indexregenfix12
-rw-r--r--multimedia/vdr/files/patch-vdr-1.7.17_FreeBSD1308
-rw-r--r--multimedia/vdr/files/patch-vdr.111
-rw-r--r--multimedia/vdr/files/patch-z-Makefile49
-rw-r--r--multimedia/vdr/files/patch-z-libsi-si.c42
-rw-r--r--multimedia/vdr/files/remote.conf114
-rw-r--r--multimedia/vdr/files/vdr-1.7.15-disable_ca_updates.patch10
-rw-r--r--multimedia/vdr/files/vdr-1.7.15-disable_eitscan.patch11
-rw-r--r--multimedia/vdr/files/vdr.in34
-rw-r--r--multimedia/vdr/pkg-descr13
-rw-r--r--multimedia/vdr/pkg-plist208
23 files changed, 2112 insertions, 0 deletions
diff --git a/multimedia/Makefile b/multimedia/Makefile
index fbaa3c3bf4ba..65aae96a61e8 100644
--- a/multimedia/Makefile
+++ b/multimedia/Makefile
@@ -334,6 +334,7 @@
SUBDIR += vcdtools
SUBDIR += vdpau-video
SUBDIR += vdpauinfo
+ SUBDIR += vdr
SUBDIR += vic
SUBDIR += vlc
SUBDIR += vodcatcher
diff --git a/multimedia/vdr/Makefile b/multimedia/vdr/Makefile
new file mode 100644
index 000000000000..c317a5a3b94c
--- /dev/null
+++ b/multimedia/vdr/Makefile
@@ -0,0 +1,93 @@
+# New ports collection makefile for: vdr
+# Date created: Wed Apr 14 18:11:42 CEST 2010
+# Whom: Juergen Lock <nox@freebsd.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= vdr
+PORTVERSION= 1.7.17
+PORTREVISION= 1
+CATEGORIES= multimedia
+MASTER_SITES= ftp://ftp.tvdr.de/vdr/Developer/
+
+MAINTAINER= nox@FreeBSD.org
+COMMENT= Video Disk Recorder - development version
+
+BUILD_DEPENDS= ${LOCALBASE}/include/linux/dvb/frontend.h:${PORTSDIR}/multimedia/v4l_compat
+LIB_DEPENDS= jpeg.11:${PORTSDIR}/graphics/jpeg
+BUILD_DEPENDS+= ${LOCALBASE}/libdata/pkgconfig/fontconfig.pc:${PORTSDIR}/x11-fonts/fontconfig
+RUN_DEPENDS+= ${LOCALBASE}/libdata/pkgconfig/fontconfig.pc:${PORTSDIR}/x11-fonts/fontconfig
+
+OPTIONS= IPTVPATCH "Stops EIT scans on IPTV channels" On
+
+DIST_SUBDIR= vdr
+USE_BZIP2= yes
+USE_GMAKE= yes
+USE_GNOME+= pkgconfig
+USE_GETTEXT= yes
+PORTDOCS= COPYING INSTALL MANUAL README
+MAKE_JOBS_SAFE= yes
+MAN1= vdr.1
+MAN5= vdr.5
+MANCOMPRESSED= yes
+MAKE_JOBS_SAFE= yes
+CONFDIR= $(ETCDIR)
+MAKE_ARGS+= DVBDIR=${LOCALBASE}/include
+MAKE_ARGS+= VDR_USER=${VDR_USER}
+MAKE_ARGS+= CONFDIR=$(CONFDIR)
+MAKE_ARGS+= OSTYPE=FreeBSD
+MAKE_ARGS+= LIRC_DEVICE=/var/run/lirc/lircd
+ALL_TARGET= all plugins
+
+VIDEODIR= /video
+SUB_LIST+= VIDEODIR=${VIDEODIR}
+USE_RC_SUBR= vdr
+VDR_USER= vdr
+VDR_GROUP= vdr
+USERS= ${VDR_USER}
+GROUPS= ${VDR_GROUP}
+PLIST_SUB= VDR_USER=${VDR_USER}
+PLIST_SUB+= VDR_GROUP=${VDR_GROUP}
+
+.include <bsd.port.options.mk>
+
+.if defined(WITH_IPTVPATCH)
+EXTRA_PATCHES= ${FILESDIR}/vdr-1.7.15-disable_ca_updates.patch \
+ ${FILESDIR}/vdr-1.7.15-disable_eitscan.patch
+.endif
+
+.if !defined(WITHOUT_NLS)
+PLIST_SUB+= NLS=""
+.else
+PLIST_SUB+= NLS="@comment "
+ALL_TARGET= vdr
+.endif
+
+post-patch:
+ @${SED} 's|^\(VIDEODIR[[:space:]]*\)[?]*\(=[[:space:]]*\).*|\1\2${VIDEODIR}|' \
+ ${WRKSRC}/Make.config.template >${WRKSRC}/Make.config
+ @${REINPLACE_CMD} -e 's|%%CONFDIR%%|${CONFDIR}|' ${WRKSRC}/vdr.1
+
+post-install:
+.if !defined(WITHOUT_NLS)
+ @(cd ${WRKSRC} && ${COPYTREE_SHARE} locale ${PREFIX}/share/)
+.endif
+ ${MKDIR} ${CONFDIR}/plugins
+ ${CHOWN} ${VDR_USER}:${VDR_GROUP} ${CONFDIR} ${CONFDIR}/plugins
+ ${INSTALL_DATA} ${FILESDIR}/remote.conf ${CONFDIR}/remote.conf.sample
+ @if [ ! -f ${CONFDIR}/remote.conf ]; then \
+ ${INSTALL_DATA} -o ${VDR_USER} -g ${VDR_GROUP} ${FILESDIR}/remote.conf ${CONFDIR}; \
+ fi
+ for i in $$(cd ${WRKSRC} && ls *.conf); do \
+ ${INSTALL_DATA} ${WRKSRC}/$$i ${CONFDIR}/$$i.sample; \
+ if [ ! -f ${CONFDIR}/$$i ]; then \
+ ${INSTALL_DATA} -o ${VDR_USER} -g ${VDR_GROUP} ${WRKSRC}/$$i ${CONFDIR}/$$i; \
+ fi; \
+ done
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ (cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR})
+.endif
+
+.include <bsd.port.mk>
diff --git a/multimedia/vdr/Makefile.plugins b/multimedia/vdr/Makefile.plugins
new file mode 100644
index 000000000000..d16bf05e33a8
--- /dev/null
+++ b/multimedia/vdr/Makefile.plugins
@@ -0,0 +1,50 @@
+# this is to be included by vdr plugin ports
+#
+# $FreeBSD: /tmp/pcvs/ports/multimedia/vdr/Makefile.plugins,v 1.1 2011-03-26 19:13:49 nox Exp $
+
+BUILD_DEPENDS+= ${LOCALBASE}/include/linux/dvb/frontend.h:${PORTSDIR}/multimedia/v4l_compat
+
+BUILD_DEPENDS+= vdr:${PORTSDIR}/multimedia/vdr
+RUN_DEPENDS+= vdr:${PORTSDIR}/multimedia/vdr
+
+DIST_SUBDIR= vdr
+PATCH_SUBDIR= vdr
+USE_GMAKE= yes
+USE_GETTEXT= yes
+VDRDIR= ${LOCALBASE}/include/vdr
+VDRINCDIR= ${LOCALBASE}/include
+MAKE_ARGS+= DVBDIR=${LOCALBASE}/include
+MAKE_ARGS+= VDRDIR=${VDRDIR}
+MAKE_ARGS+= VDR_USER=${VDR_USER}
+MAKE_ARGS+= INSTALL_PROGRAM="${INSTALL_PROGRAM}"
+MAKE_ARGS+= OSTYPE=FreeBSD
+PLUGIN?= ${PORTNAME:S/^vdr-plugin-//}
+CONFIGURE_ENV+= LOCALBASE=${LOCALBASE}
+MAKE_ENV+= LOCALBASE=${LOCALBASE}
+VDR_USER= vdr
+VDR_GROUP= vdr
+PLIST_SUB= VDR_USER=${VDR_USER}
+PLIST_SUB+= VDR_GROUP=${VDR_GROUP}
+
+.if !defined(WITHOUT_NLS)
+PLIST_SUB+= NLS=""
+.else
+PLIST_SUB+= NLS="@comment "
+.endif
+
+localeplist:
+ @${FIND} ${WRKDIR}/locale -type f -print |${SED} 's|^.*locale/|%%NLS%%share/locale/|'
+
+post-patch-plugin:
+ @${MKDIR} ${WRKDIR}/lib ${WRKDIR}/locale
+ @${REINPLACE_CMD} 's/^\(LIBDIR[[:space:]]*\)[?]*\(=[[:space:]]*\).*/\1\2..\/lib/;'\\
+ 's/^\(LOCALEDIR[[:space:]]*\)[?]*\(=[[:space:]]*\).*/\1\2..\/locale/;'\\
+ 's/^\(VDRDIR[[:space:]]*\)[?]*\(=[[:space:]]*\).*/\1\2'"${VDRDIR:S-/-\\\\/-g}/;"\\
+ 's/^\(VDRINCDIR[[:space:]]*\)[?]*\(=[[:space:]]*\).*/\1\2'"${VDRINCDIR:S-/-\\\\/-g}/;"\\
+ 's/^\(BINDIR[[:space:]]*\)[?]*\(=[[:space:]]*\).*/\1\2'"${PREFIX:S-/-\\\\/-g}\/bin/;" \
+ ${WRKSRC}/Makefile ${VDR_PLUGIN_MAKEFILES}
+
+post-install-pluginlocales:
+.if !defined(WITHOUT_NLS)
+ @(cd ${WRKDIR} && ${COPYTREE_SHARE} locale ${PREFIX}/share/)
+.endif
diff --git a/multimedia/vdr/distinfo b/multimedia/vdr/distinfo
new file mode 100644
index 000000000000..bd9710b6b034
--- /dev/null
+++ b/multimedia/vdr/distinfo
@@ -0,0 +1,2 @@
+SHA256 (vdr/vdr-1.7.17.tar.bz2) = f11102d4b4595347587f09f3957d508567cead6ccd231f9831fc02be8deb7994
+SIZE (vdr/vdr-1.7.17.tar.bz2) = 688181
diff --git a/multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsddevice.c b/multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsddevice.c
new file mode 100644
index 000000000000..ec9c2dddaf1a
--- /dev/null
+++ b/multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsddevice.c
@@ -0,0 +1,10 @@
+--- PLUGINS/src/dvbsddevice/dvbsddevice.c.orig
++++ PLUGINS/src/dvbsddevice/dvbsddevice.c
+@@ -6,6 +6,7 @@
+ * $Id: dvbsddevice.c 1.3 2010/01/30 10:05:42 kls Exp $
+ */
+
++#include <stdint.h>
+ #include <vdr/plugin.h>
+ #include "dvbsdffdevice.h"
+
diff --git a/multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsdffdevice.c b/multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsdffdevice.c
new file mode 100644
index 000000000000..8d33ca5b3954
--- /dev/null
+++ b/multimedia/vdr/files/patch-PLUGINS-src-dvbsddevice-dvbsdffdevice.c
@@ -0,0 +1,19 @@
+--- PLUGINS/src/dvbsddevice/dvbsdffdevice.c.orig
++++ PLUGINS/src/dvbsddevice/dvbsdffdevice.c
+@@ -6,12 +6,16 @@
+ * $Id: dvbsdffdevice.c 2.26 2010/01/30 10:05:23 kls Exp $
+ */
+
++#include <stdint.h>
+ #include "dvbsdffdevice.h"
+ #include <errno.h>
+ #include <limits.h>
+ #include <linux/videodev2.h>
+ #include <linux/dvb/audio.h>
+ #include <linux/dvb/dmx.h>
++#ifdef __FreeBSD__
++typedef struct timespec __kernel_time_t;
++#endif
+ #include <linux/dvb/video.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
diff --git a/multimedia/vdr/files/patch-device.c b/multimedia/vdr/files/patch-device.c
new file mode 100644
index 000000000000..408700c70686
--- /dev/null
+++ b/multimedia/vdr/files/patch-device.c
@@ -0,0 +1,11 @@
+--- device.c.orig
++++ device.c
+@@ -65,7 +65,7 @@ bool cDeviceHook::DeviceProvidesTranspon
+ #define MIN_PRE_1_3_19_PRIVATESTREAM 10
+
+ int cDevice::numDevices = 0;
+-int cDevice::useDevice = 0;
++uint64_t cDevice::useDevice = 0;
+ int cDevice::nextCardIndex = 0;
+ int cDevice::currentChannel = 1;
+ cDevice *cDevice::device[MAXDEVICES] = { NULL };
diff --git a/multimedia/vdr/files/patch-device.h b/multimedia/vdr/files/patch-device.h
new file mode 100644
index 000000000000..027c5a8fbeaa
--- /dev/null
+++ b/multimedia/vdr/files/patch-device.h
@@ -0,0 +1,20 @@
+--- device.h.orig
++++ device.h
+@@ -25,7 +25,7 @@
+ #include "thread.h"
+ #include "tools.h"
+
+-#define MAXDEVICES 16 // the maximum number of devices in the system
++#define MAXDEVICES 64 // the maximum number of devices in the system
+ #define MAXPIDHANDLES 64 // the maximum number of different PIDs per device
+ #define MAXRECEIVERS 16 // the maximum number of receivers per device
+ #define MAXVOLUME 255
+@@ -105,7 +105,7 @@ class cDevice : public cThread {
+ friend class cDeviceHook;
+ private:
+ static int numDevices;
+- static int useDevice;
++ static uint64_t useDevice;
+ static cDevice *device[MAXDEVICES];
+ static cDevice *primaryDevice;
+ static cDevice *avoidDevice;
diff --git a/multimedia/vdr/files/patch-dvbdevice.c b/multimedia/vdr/files/patch-dvbdevice.c
new file mode 100644
index 000000000000..964571ac9d0f
--- /dev/null
+++ b/multimedia/vdr/files/patch-dvbdevice.c
@@ -0,0 +1,27 @@
+--- dvbdevice.c.orig
++++ dvbdevice.c
+@@ -7,6 +7,7 @@
+ * $Id: dvbdevice.c 2.38 2010/05/01 09:47:13 kls Exp $
+ */
+
++#include <stdint.h>
+ #include "dvbdevice.h"
+ #include <ctype.h>
+ #include <errno.h>
+@@ -800,10 +801,13 @@ bool cDvbDevice::Initialize(void)
+ NextCardIndex(1); // skips this one
+ }
+ }
+- else if (Frontend == 0)
+- goto LastAdapter;
+- else
++ else {
++ if (Checked >= MAXDVBDEVICES || Adapter >= MAXDVBDEVICES)
++ goto LastAdapter;
++ if (Frontend == 0)
++ NextCardIndex(1); // skips this one
+ goto NextAdapter;
++ }
+ }
+ NextAdapter: ;
+ }
diff --git a/multimedia/vdr/files/patch-menuitems.c b/multimedia/vdr/files/patch-menuitems.c
new file mode 100644
index 000000000000..45fe6f2dbede
--- /dev/null
+++ b/multimedia/vdr/files/patch-menuitems.c
@@ -0,0 +1,10 @@
+--- menuitems.c.orig
++++ menuitems.c
+@@ -7,6 +7,7 @@
+ * $Id: menuitems.c 2.6 2010/02/16 14:44:35 kls Exp $
+ */
+
++#include <stdint.h>
+ #include "menuitems.h"
+ #include <ctype.h>
+ #include <math.h>
diff --git a/multimedia/vdr/files/patch-plugin.c b/multimedia/vdr/files/patch-plugin.c
new file mode 100644
index 000000000000..46497c90fe98
--- /dev/null
+++ b/multimedia/vdr/files/patch-plugin.c
@@ -0,0 +1,19 @@
+--- plugin.c.orig
++++ plugin.c
+@@ -198,11 +198,14 @@ bool cDll::Load(bool Log)
+ }
+ handle = dlopen(fileName, RTLD_NOW);
+ const char *error = dlerror();
+- if (!error) {
++ if (handle) {
+ void *(*creator)(void);
+ creator = (void *(*)(void))dlsym(handle, "VDRPluginCreator");
+- if (!(error = dlerror()))
++ error = dlerror();
++ if (creator) {
+ plugin = (cPlugin *)creator();
++ error = NULL;
++ }
+ }
+ if (!error) {
+ if (plugin && args) {
diff --git a/multimedia/vdr/files/patch-tools.c b/multimedia/vdr/files/patch-tools.c
new file mode 100644
index 000000000000..d99421e11781
--- /dev/null
+++ b/multimedia/vdr/files/patch-tools.c
@@ -0,0 +1,38 @@
+--- tools.c.orig
++++ tools.c
+@@ -1201,9 +1201,35 @@ cReadLine::~cReadLine()
+ free(buffer);
+ }
+
++#ifdef __FreeBSD__
++#if __FreeBSD_version > 800000
++#define HAVE_GETLINE
++#endif
++#else
++#define HAVE_GETLINE
++#endif
++
+ char *cReadLine::Read(FILE *f)
+ {
++#ifndef HAVE_GETLINE
++ size_t n;
++
++ if (!buffer) {
++ if (!(buffer = (char *)malloc(size = 4096)))
++ return NULL;
++ }
++ if (!fgets(buffer, size, f))
++ return NULL;
++ while ((n = strlen(buffer)) >= size - 1 && buffer[n - 1] != '\n') {
++ if (!(buffer = (char *)realloc(buffer, size * 2)))
++ return NULL;
++ size *= 2;
++ if (!fgets(buffer + n, size - n, f))
++ break;
++ }
++#else
+ int n = getline(&buffer, &size, f);
++#endif
+ if (n > 0) {
+ n--;
+ if (buffer[n] == '\n') {
diff --git a/multimedia/vdr/files/patch-tools.c-indexregenfix b/multimedia/vdr/files/patch-tools.c-indexregenfix
new file mode 100644
index 000000000000..c5590f141e4b
--- /dev/null
+++ b/multimedia/vdr/files/patch-tools.c-indexregenfix
@@ -0,0 +1,12 @@
+--- tools.c.orig
++++ tools.c
+@@ -1669,6 +1669,9 @@ ssize_t cUnbufferedFile::Read(void *Data
+ }
+ }
+ lastpos = curpos;
++#else
++ if (bytesRead > 0)
++ curpos += bytesRead;
+ #endif
+ return bytesRead;
+ }
diff --git a/multimedia/vdr/files/patch-vdr-1.7.17_FreeBSD b/multimedia/vdr/files/patch-vdr-1.7.17_FreeBSD
new file mode 100644
index 000000000000..3b3943b745e9
--- /dev/null
+++ b/multimedia/vdr/files/patch-vdr-1.7.17_FreeBSD
@@ -0,0 +1,1308 @@
+Index: Make.config.template
+===================================================================
+RCS file: /progs/network/ccvs/vdr/Make.config.template,v
+retrieving revision 1.1.1.3
+retrieving revision 1.5
+diff -u -r1.1.1.3 -r1.5
+--- Make.config.template 2010/03/01 09:42:48 1.1.1.3
++++ Make.config.template 2010/03/01 09:58:06 1.5
+@@ -8,6 +8,11 @@
+ #
+ # $Id: Make.config.template 2.2 2010/02/06 14:50:03 kls Exp $
+
++OSTYPE ?= $(shell uname -s)
++ifeq ($(OSTYPE),FreeBSD)
++FREEBSD=1
++endif
++
+ ### The C compiler and options:
+
+ CC = gcc
+@@ -23,20 +28,35 @@
+
+ ### The directory environment:
+
+-#DVBDIR = /usr/src/v4l-dvb/linux
+-MANDIR = /usr/local/man
+-BINDIR = /usr/local/bin
++PREFIX = /usr/local
++MANDIR = $(PREFIX)/man
++BINDIR = $(PREFIX)/bin
+
+-LOCDIR = ./locale
+ PLUGINDIR= ./PLUGINS
+-PLUGINLIBDIR= $(PLUGINDIR)/lib
+ VIDEODIR = /video
++
++ifdef FREEBSD
++# you have to set DVBDIR to a valid path!!!
++# you will need extra patches for DVBDIR!!!
++DVBDIR = /usr/src/v4l-dvb/linux
++LOCDIR = $(PREFIX)/share/locale
++CONFDIR = $(PREFIX)/etc/vdr
++PLUGINLIBDIR= $(PREFIX)/lib/vdr
++else
++#DVBDIR = /usr/src/v4l-dvb/linux
++LOCDIR = ./locale
+ CONFDIR = $(VIDEODIR)
++PLUGINLIBDIR= $(PLUGINDIR)/lib
++endif
+
+ ### The remote control:
+
+ LIRC_DEVICE = /dev/lircd
++ifdef FREEBSD
++RCU_DEVICE = /dev/cuau0
++else
+ RCU_DEVICE = /dev/ttyS1
++endif
+
+ ## Define if you want vdr to not run as root
+ #VDR_USER = vdr
+@@ -45,4 +65,8 @@
+
+ ifdef DVBDIR
+ INCLUDES += -I$(DVBDIR)/include
++endif
++
++ifdef FREEBSD
++INCLUDES += -I/usr/local/include
+ endif
+Index: Makefile
+@@ -8,6 +8,11 @@
+
+ .DELETE_ON_ERROR:
+
++OSTYPE ?= $(shell uname -s)
++ifeq ($(OSTYPE),FreeBSD)
++FREEBSD=1
++endif
++
+ CC ?= gcc
+ CFLAGS ?= -g -O3 -Wall
+
+@@ -20,7 +25,12 @@ PREFIX ?= /usr/local
+ MANDIR = $(PREFIX)/share/man
+ BINDIR = $(PREFIX)/bin
+ LOCDIR = ./locale
++ifdef FREEBSD
++LIBDIRS = -L${LOCALBASE}/lib
++LIBS = -ljpeg -lpthread -lrt -lfreetype -lfontconfig -liconv -lintl
++else
+ LIBS = -ljpeg -lpthread -ldl -lcap -lrt -lfreetype -lfontconfig
++endif
+ INCLUDES ?= $(shell pkg-config --cflags freetype2)
+
+ PLUGINDIR= ./PLUGINS
+@@ -129,7 +139,11 @@ i18n: $(I18Nmsgs)
+
+ install-i18n:
+ @mkdir -p $(DESTDIR)$(LOCDIR)
++ifdef FREEBSD
++ @(cd $(LOCALEDIR); cp -R * $(DESTDIR)$(LOCDIR))
++else
+ @(cd $(LOCALEDIR); cp -r --parents * $(DESTDIR)$(LOCDIR))
++endif
+
+ # The 'include' directory (for plugins):
+
+@@ -168,7 +182,11 @@ install: install-bin install-conf instal
+
+ install-bin: vdr
+ @mkdir -p $(DESTDIR)$(BINDIR)
++ifdef FREEBSD
++ @cp -f vdr svdrpsend.pl $(DESTDIR)$(BINDIR)
++else
+ @cp --remove-destination vdr svdrpsend.pl $(DESTDIR)$(BINDIR)
++endif
+
+ # Configuration files:
+
+@@ -191,7 +209,11 @@ install-doc:
+
+ install-plugins: plugins
+ @mkdir -p $(DESTDIR)$(PLUGINLIBDIR)
++ifdef FREEBSD
++ @cp -f $(PLUGINDIR)/lib/lib*-*.so.$(APIVERSION) $(DESTDIR)$(PLUGINLIBDIR)
++else
+ @cp --remove-destination $(PLUGINDIR)/lib/lib*-*.so.$(APIVERSION) $(DESTDIR)$(PLUGINLIBDIR)
++endif
+
+ # Source documentation:
+
+Index: channels.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/channels.c,v
+retrieving revision 1.1.1.5
+retrieving revision 1.6
+diff -u -r1.1.1.5 -r1.6
+--- channels.c 2010/06/07 09:07:28 1.1.1.5
++++ channels.c 2010/06/07 09:12:57 1.6
+@@ -29,7 +29,12 @@
+ int tid;
+ int sid;
+ int rid = 0;
++#ifdef __FreeBSD__
++ sourcebuf = MALLOC(char, 10);
++ int fields = sscanf(s, "%9[^-]-%d-%d-%d-%d", sourcebuf, &nid, &tid, &sid, &rid);
++#else
+ int fields = sscanf(s, "%a[^-]-%d-%d-%d-%d", &sourcebuf, &nid, &tid, &sid, &rid);
++#endif
+ if (fields == 4 || fields == 5) {
+ int source = cSource::FromString(sourcebuf);
+ free(sourcebuf);
+@@ -543,7 +548,17 @@
+ char *vpidbuf = NULL;
+ char *apidbuf = NULL;
+ char *caidbuf = NULL;
++#ifdef __FreeBSD__
++ namebuf = MALLOC(char, 256);
++ sourcebuf = MALLOC(char, 10);
++ parambuf = MALLOC(char, 256);
++ vpidbuf = MALLOC(char, 256);
++ apidbuf = MALLOC(char, 256);
++ caidbuf = MALLOC(char, 256);
++ int fields = sscanf(s, "%255[^:]:%d :%255[^:]:%9[^:] :%d :%255[^:]:%255[^:]:%d :%255[^:]:%d :%d :%d :%d ", namebuf, &frequency, parambuf, sourcebuf, &srate, vpidbuf, apidbuf, &tpid, caidbuf, &sid, &nid, &tid, &rid);
++#else
+ int fields = sscanf(s, "%a[^:]:%d :%a[^:]:%a[^:] :%d :%a[^:]:%a[^:]:%d :%a[^:]:%d :%d :%d :%d ", &namebuf, &frequency, &parambuf, &sourcebuf, &srate, &vpidbuf, &apidbuf, &tpid, &caidbuf, &sid, &nid, &tid, &rid);
++#endif
+ if (fields >= 9) {
+ if (fields == 9) {
+ // allow reading of old format
+Index: ci.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/ci.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- ci.c 2010/02/17 10:14:44 1.1.1.2
++++ ci.c 2010/02/17 10:46:55 1.3
+@@ -10,7 +10,11 @@
+ #include "ci.h"
+ #include <ctype.h>
+ #include <linux/dvb/ca.h>
++#ifdef __FreeBSD__
++#include <stdlib.h>
++#else
+ #include <malloc.h>
++#endif
+ #include <netinet/in.h>
+ #include <poll.h>
+ #include <string.h>
+Index: config.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/config.c,v
+retrieving revision 1.1.1.4
+retrieving revision 1.4
+diff -u -r1.1.1.4 -r1.4
+--- config.c 2010/06/07 09:07:28 1.1.1.4
++++ config.c 2010/06/07 09:12:57 1.4
+@@ -10,6 +10,9 @@
+ #include "config.h"
+ #include <ctype.h>
+ #include <stdlib.h>
++#ifdef __FreeBSD__
++#include <netinet/in.h>
++#endif
+ #include "device.h"
+ #include "i18n.h"
+ #include "interface.h"
+Index: diseqc.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/diseqc.c,v
+retrieving revision 1.1.1.3
+retrieving revision 1.4
+diff -u -r1.1.1.3 -r1.4
+--- diseqc.c 2010/03/01 09:42:49 1.1.1.3
++++ diseqc.c 2010/03/01 09:58:06 1.4
+@@ -50,7 +50,14 @@
+ }
+ return true;
+ }
++#ifdef __FreeBSD__
++ sourcebuf = MALLOC(char, 10);
++ if (commands == NULL)
++ commands = MALLOC(char, 256);
++ int fields = sscanf(s, "%9[^ ] %d %c %d %255[^\n]", sourcebuf, &slof, &polarization, &lof, commands);
++#else
+ int fields = sscanf(s, "%a[^ ] %d %c %d %a[^\n]", &sourcebuf, &slof, &polarization, &lof, &commands);
++#endif
+ if (fields == 4)
+ commands = NULL; //XXX Apparently sscanf() doesn't work correctly if the last %a argument results in an empty string
+ if (4 <= fields && fields <= 5) {
+Index: dvbsubtitle.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/dvbsubtitle.c,v
+retrieving revision 1.1.1.5
+retrieving revision 1.5
+diff -u -r1.1.1.5 -r1.5
+--- dvbsubtitle.c 2010/10/19 20:28:49 1.1.1.5
++++ dvbsubtitle.c 2010/10/19 20:32:58 1.5
+@@ -718,7 +718,11 @@
+ if (Length > PayloadOffset + SubstreamHeaderLength) {
+ int64_t pts = PesHasPts(Data) ? PesGetPts(Data) : 0;
+ if (pts)
++#ifdef __FreeBSD__
++ dbgconverter("Converter PTS: %lld\n", (long long int)pts);
++#else
+ dbgconverter("Converter PTS: %lld\n", pts);
++#endif
+ const uchar *data = Data + PayloadOffset + SubstreamHeaderLength; // skip substream header
+ int length = Length - PayloadOffset - SubstreamHeaderLength; // skip substream header
+ if (ResetSubtitleAssembler)
+@@ -754,7 +758,11 @@
+ if (Length > PayloadOffset) {
+ int64_t pts = PesGetPts(Data);
+ if (pts)
++#ifdef __FreeBSD__
++ dbgconverter("Converter PTS: %lld\n", (long long int)pts);
++#else
+ dbgconverter("Converter PTS: %lld\n", pts);
++#endif
+ const uchar *data = Data + PayloadOffset;
+ int length = Length - PayloadOffset;
+ if (length > 3) {
+@@ -819,7 +827,11 @@
+ if (AssertOsd()) {
+ sb->Draw(osd);
+ Timeout.Set(sb->Timeout() * 1000);
++#ifdef __FreeBSD__
++ dbgconverter("PTS: %lld STC: %lld (%lld) timeout: %d\n", (long long int)sb->Pts(), (long long int)cDevice::PrimaryDevice()->GetSTC(), (long long int)Delta, sb->Timeout());
++#else
+ dbgconverter("PTS: %lld STC: %lld (%lld) timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout());
++#endif
+ }
+ bitmaps->Del(sb);
+ }
+@@ -889,7 +901,11 @@
+ page->SetTimeout(Data[6]);
+ page->SetState((Data[6 + 1] & 0x0C) >> 2);
+ page->regions.Clear();
++#ifdef __FreeBSD__
++ dbgpages("Update page id %d version %d pts %lld timeout %d state %d\n", pageId, page->Version(), (long long int)page->Pts(), page->Timeout(), page->State());
++#else
+ dbgpages("Update page id %d version %d pts %lld timeout %d state %d\n", pageId, page->Version(), page->Pts(), page->Timeout(), page->State());
++#endif
+ for (int i = 6 + 2; i < segmentLength; i += 6) {
+ cSubtitleRegion *region = page->GetRegionById(Data[i], true);
+ region->SetHorizontalAddress((Data[i + 2] << 8) + Data[i + 3]);
+Index: eit.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/eit.c,v
+retrieving revision 1.1.1.3
+retrieving revision 1.5
+diff -u -r1.1.1.3 -r1.5
+--- eit.c 2010/06/07 09:07:27 1.1.1.3
++++ eit.c 2010/06/07 09:12:57 1.5
+@@ -339,10 +339,15 @@
+ if (diff > 2) {
+ mutex.Lock();
+ if (abs(diff - lastDiff) < 3) {
++#ifdef __FreeBSD__
++ isyslog("system time would have changed from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(sattim), sattim);
++ esyslog("stime() not available on FreeBSD, maybe use adjtime()?");
++#else
+ if (stime(&sattim) == 0)
+ isyslog("system time changed from %s (%ld) to %s (%ld)", *TimeToString(loctim), loctim, *TimeToString(sattim), sattim);
+ else
+ esyslog("ERROR while setting system time: %m");
++#endif
+ }
+ lastDiff = diff;
+ mutex.Unlock();
+Index: epg.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/epg.c,v
+retrieving revision 1.1.1.3
+retrieving revision 1.5
+diff -u -r1.1.1.3 -r1.5
+--- epg.c 2010/03/01 09:42:48 1.1.1.3
++++ epg.c 2010/03/01 09:58:06 1.5
+@@ -31,7 +31,13 @@
+ bool tComponent::FromString(const char *s)
+ {
+ unsigned int Stream, Type;
++#ifdef __FreeBSD__
++ if (description == NULL)
++ description = MALLOC(char, 256);
++ int n = sscanf(s, "%X %02X %7s %255[^\n]", &Stream, &Type, language, description); // 7 = MAXLANGCODE2 - 1
++#else
+ int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1
++#endif
+ if (n != 4 || isempty(description)) {
+ free(description);
+ description = NULL;
+Index: font.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/font.c,v
+retrieving revision 1.1.1.3
+retrieving revision 1.5
+diff -u -r1.1.1.3 -r1.5
+--- font.c 2010/10/19 20:28:48 1.1.1.3
++++ font.c 2010/10/19 20:32:58 1.5
+@@ -383,7 +383,11 @@
+ {
+ if (!FontNames->Size()) {
+ FcInit();
++#ifdef __FreeBSD__
++ FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, (char *)NULL);
++#else
+ FcObjectSet *os = FcObjectSetBuild(FC_FAMILY, FC_STYLE, NULL);
++#endif
+ FcPattern *pat = FcPatternCreate();
+ FcPatternAddBool(pat, FC_SCALABLE, FcTrue);
+ if (Monospaced)
+Index: i18n.h
+===================================================================
+RCS file: /progs/network/ccvs/vdr/i18n.h,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- i18n.h 2010/02/17 10:14:45 1.1.1.2
++++ i18n.h 2010/02/17 10:46:55 1.3
+@@ -48,7 +48,11 @@
+ ///< have an actual locale installed. The rest are just dummy entries
+ ///< to allow having three letter language codes for other languages
+ ///< that have no actual locale on this system.
++#ifdef __FreeBSD__
++const char *I18nTranslate(const char *s, const char *Plugin = NULL) __format_arg(1);
++#else
+ const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1);
++#endif
+ ///< Translates the given string (with optional Plugin context) into
+ ///< the current language. If no translation is available, the original
+ ///< string will be returned.
+Index: menu.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/menu.c,v
+retrieving revision 1.1.1.6
+retrieving revision 1.7
+diff -u -r1.1.1.6 -r1.7
+Index: menuitems.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/menuitems.c,v
+retrieving revision 1.1.1.4
+retrieving revision 1.5
+diff -u -r1.1.1.4 -r1.5
+--- menuitems.c 2010/06/07 09:07:27 1.1.1.4
++++ menuitems.c 2010/06/07 09:12:57 1.5
+@@ -838,7 +838,11 @@
+ struct tm tm_r;
+ localtime_r(value, &tm_r);
+ strftime(buf, DATEBUFFERSIZE, "%Y-%m-%d ", &tm_r);
++#ifdef __FreeBSD__
++ strcat(buf, WeekDayNameReal(tm_r.tm_wday));
++#else
+ strcat(buf, WeekDayName(tm_r.tm_wday));
++#endif
+ }
+ else
+ *buf = 0;
+Index: pat.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/pat.c,v
+retrieving revision 1.1.1.5
+retrieving revision 1.6
+diff -u -r1.1.1.5 -r1.6
+--- pat.c 2010/10/19 20:28:48 1.1.1.5
++++ pat.c 2010/10/19 20:32:58 1.6
+@@ -8,7 +8,11 @@
+ */
+
+ #include "pat.h"
++#ifdef __FreeBSD__
++#include <stdlib.h>
++#else
+ #include <malloc.h>
++#endif
+ #include "channels.h"
+ #include "libsi/section.h"
+ #include "libsi/descriptor.h"
+Index: recording.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/recording.c,v
+retrieving revision 1.1.1.3
+retrieving revision 1.5
+diff -u -r1.1.1.3 -r1.5
+--- recording.c 2010/03/16 15:18:58 1.1.1.3
++++ recording.c 2010/03/16 15:21:05 1.5
+@@ -1505,7 +1505,11 @@
+ delta = int(buf.st_size % sizeof(tIndexTs));
+ if (delta) {
+ delta = sizeof(tIndexTs) - delta;
++#ifdef __FreeBSD__
++ esyslog("ERROR: invalid file size (%lld) in '%s'", (long long int)buf.st_size, fileName);
++#else
+ esyslog("ERROR: invalid file size (%lld) in '%s'", buf.st_size, fileName);
++#endif
+ }
+ last = int((buf.st_size + delta) / sizeof(tIndexTs) - 1);
+ if (!Record && last >= 0) {
+@@ -1825,7 +1829,11 @@
+ // Search for a PAT packet from the end of the file:
+ cPatPmtParser PatPmtParser;
+ sprintf(pFileNumber, RECORDFILESUFFIXTS, Number);
++#ifdef __FreeBSD__
++ int fd = open(fileName, O_RDONLY, DEFFILEMODE);
++#else
+ int fd = open(fileName, O_RDONLY | O_LARGEFILE, DEFFILEMODE);
++#endif
+ if (fd >= 0) {
+ off_t pos = lseek(fd, -TS_SIZE, SEEK_END);
+ while (pos >= 0) {
+@@ -1866,14 +1874,22 @@
+ int BlockingFlag = blocking ? 0 : O_NONBLOCK;
+ if (record) {
+ dsyslog("recording to '%s'", fileName);
++#ifdef __FreeBSD__
++ file = OpenVideoFile(fileName, O_RDWR | O_CREAT | BlockingFlag);
++#else
+ file = OpenVideoFile(fileName, O_RDWR | O_CREAT | O_LARGEFILE | BlockingFlag);
++#endif
+ if (!file)
+ LOG_ERROR_STR(fileName);
+ }
+ else {
+ if (access(fileName, R_OK) == 0) {
+ dsyslog("playing '%s'", fileName);
++#ifdef __FreeBSD__
++ file = cUnbufferedFile::Create(fileName, O_RDONLY | BlockingFlag);
++#else
+ file = cUnbufferedFile::Create(fileName, O_RDONLY | O_LARGEFILE | BlockingFlag);
++#endif
+ if (!file)
+ LOG_ERROR_STR(fileName);
+ }
+Index: remote.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/remote.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.2
+diff -u -r1.1.1.2 -r1.2
+--- remote.c 2010/02/17 10:14:45 1.1.1.2
++++ remote.c 2010/02/17 12:36:01 1.2
+@@ -121,7 +121,11 @@
+ bool cRemote::Put(uint64_t Code, bool Repeat, bool Release)
+ {
+ char buffer[32];
++#ifdef __FreeBSD__
++ snprintf(buffer, sizeof(buffer), "%016llX", (long long unsigned int)Code);
++#else
+ snprintf(buffer, sizeof(buffer), "%016llX", Code);
++#endif
+ return Put(buffer, Repeat, Release);
+ }
+
+Index: shutdown.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/shutdown.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.4
+diff -u -r1.1.1.2 -r1.4
+Index: skins.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/skins.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- skins.c 2010/02/17 10:14:45 1.1.1.2
++++ skins.c 2010/02/17 10:46:55 1.3
+@@ -11,6 +11,20 @@
+ #include "interface.h"
+ #include "status.h"
+
++#ifdef __FreeBSD__
++/* XXX Implement strchrnul for FreeBSD. */
++static char *
++strchrnul (const char *s, int c_in)
++{
++ char c = c_in;
++ while (*s && (*s != c))
++ s++;
++
++ return (char *) s;
++}
++#endif
++
++
+ // --- cSkinQueuedMessage ----------------------------------------------------
+
+ class cSkinQueuedMessage : public cListObject {
+Index: sources.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/sources.c,v
+retrieving revision 1.1.1.4
+retrieving revision 1.5
+diff -u -r1.1.1.4 -r1.5
+--- sources.c 2010/03/16 15:18:58 1.1.1.4
++++ sources.c 2010/03/16 15:21:05 1.5
+@@ -31,7 +31,14 @@
+ bool cSource::Parse(const char *s)
+ {
+ char *codeBuf = NULL;
++#ifdef __FreeBSD__
++ codeBuf = MALLOC(char, 10);
++ if (description == NULL)
++ description = MALLOC(char, 256);
++ if (2 == sscanf(s, "%9[^ ] %255[^\n]", codeBuf, description))
++#else
+ if (2 == sscanf(s, "%a[^ ] %a[^\n]", &codeBuf, &description))
++#endif
+ code = FromString(codeBuf);
+ free(codeBuf);
+ return code != stNone && description && *description;
+Index: svdrp.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/svdrp.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.4
+diff -u -r1.1.1.2 -r1.4
+--- svdrp.c 2010/02/17 10:14:45 1.1.1.2
++++ svdrp.c 2010/02/17 12:34:54 1.4
+@@ -40,6 +40,12 @@
+ #include "tools.h"
+ #include "videodir.h"
+
++/* FreeBSD has it's own version of isnumber(),
++ but VDR's version is incompatible */
++#ifdef __FreeBSD__
++#undef isnumber
++#endif
++
+ // --- cSocket ---------------------------------------------------------------
+
+ cSocket::cSocket(int Port, int Queue)
+Index: themes.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/themes.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- themes.c 2010/02/17 10:14:44 1.1.1.2
++++ themes.c 2010/02/17 10:46:55 1.3
+@@ -47,7 +47,11 @@
+ // FileName is ok
+ if (SetName) {
+ free(name);
++#ifdef __FreeBSD__
++ name = (char *)strndup(n, e - n);
++#else
+ name = strndup(n, e - n);
++#endif
+ }
+ }
+ else
+Index: thread.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/thread.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.6
+diff -u -r1.1.1.2 -r1.6
+--- thread.c 2010/02/17 10:14:45 1.1.1.2
++++ thread.c 2010/02/24 08:41:13 1.6
+@@ -9,15 +9,22 @@
+
+ #include "thread.h"
+ #include <errno.h>
++#ifdef __FreeBSD__
++#include <pthread_np.h>
++#include <stdlib.h>
++#else
+ #include <linux/unistd.h>
+ #include <malloc.h>
++#endif
+ #include <stdarg.h>
+ #include <stdlib.h>
+ #include <sys/resource.h>
+ #include <sys/syscall.h>
+ #include <sys/time.h>
+ #include <sys/wait.h>
++#ifndef __FreeBSD__
+ #include <sys/prctl.h>
++#endif
+ #include <unistd.h>
+ #include "tools.h"
+
+@@ -143,7 +150,9 @@
+ {
+ pthread_rwlockattr_t attr;
+ pthread_rwlockattr_init(&attr);
++#ifndef __FreeBSD__
+ pthread_rwlockattr_setkind_np(&attr, PreferWriter ? PTHREAD_RWLOCK_PREFER_WRITER_NP : PTHREAD_RWLOCK_PREFER_READER_NP);
++#endif
+ pthread_rwlock_init(&rwlock, &attr);
+ }
+
+@@ -179,7 +188,11 @@
+ locked = 0;
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
++#ifdef __FreeBSD__
++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
++#else
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
++#endif
+ pthread_mutex_init(&mutex, &attr);
+ }
+
+@@ -228,8 +241,12 @@
+
+ void cThread::SetIOPriority(int Priority)
+ {
++#ifdef __FreeBSD__
++ esyslog("ERROR: syscall(SYS_ioprio_set ...) unsupported on FreeBSD");
++#else
+ if (syscall(SYS_ioprio_set, 1, 0, (Priority & 0xff) | (2 << 13)) < 0) // best effort class
+ LOG_ERROR;
++#endif
+ }
+
+ void cThread::SetDescription(const char *Description, ...)
+@@ -335,7 +352,11 @@
+
+ tThreadId cThread::ThreadId(void)
+ {
++#ifdef __FreeBSD__
++ return reinterpret_cast<long>(::pthread_self());
++#else
+ return syscall(__NR_gettid);
++#endif
+ }
+
+ void cThread::SetMainThreadId(void)
+@@ -461,7 +482,11 @@
+ int MaxPossibleFileDescriptors = getdtablesize();
+ for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
+ close(i); //close all dup'ed filedescriptors
++#ifdef __FreeBSD__
++ if (execl("/bin/sh", "sh", "-c", Command, (char *)NULL) == -1) {
++#else
+ if (execl("/bin/sh", "sh", "-c", Command, NULL) == -1) {
++#endif
+ LOG_ERROR_STR(Command);
+ close(fd[1 - iopipe]);
+ _exit(-1);
+@@ -544,7 +569,11 @@
+ int MaxPossibleFileDescriptors = getdtablesize();
+ for (int i = STDERR_FILENO + 1; i < MaxPossibleFileDescriptors; i++)
+ close(i); //close all dup'ed filedescriptors
++#ifdef __FreeBSD__
++ if (execl("/bin/sh", "sh", "-c", Command, (char *)NULL) == -1) {
++#else
+ if (execl("/bin/sh", "sh", "-c", Command, NULL) == -1) {
++#endif
+ LOG_ERROR_STR(Command);
+ _exit(-1);
+ }
+Index: thread.h
+===================================================================
+RCS file: /progs/network/ccvs/vdr/thread.h,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- thread.h 2010/02/17 10:14:44 1.1.1.2
++++ thread.h 2010/02/17 10:46:55 1.3
+@@ -13,6 +13,9 @@
+ #include <pthread.h>
+ #include <stdio.h>
+ #include <sys/types.h>
++#ifdef __FreeBSD__
++#include <signal.h>
++#endif
+
+ class cCondWait {
+ private:
+Index: timers.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/timers.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- timers.c 2010/02/17 10:14:45 1.1.1.2
++++ timers.c 2010/02/17 10:46:55 1.3
+@@ -23,6 +23,12 @@
+ // format characters in order to allow any number of blanks after a numeric
+ // value!
+
++/* FreeBSD has it's own version of isnumber(),
++ but VDR's version is incompatible */
++#ifdef __FreeBSD__
++#undef isnumber
++#endif
++
+ // --- cTimer ----------------------------------------------------------------
+
+ cTimer::cTimer(bool Instant, bool Pause, cChannel *Channel)
+@@ -292,7 +298,15 @@
+ s = s2;
+ }
+ bool result = false;
++#ifdef __FreeBSD__
++ channelbuffer = MALLOC(char, 256);
++ daybuffer = MALLOC(char, 256);
++ filebuffer = MALLOC(char, 256);
++ aux = MALLOC(char, 256);
++ if (8 <= sscanf(s, "%u :%255[^:]:%255[^:]:%d :%d :%d :%d :%255[^:\n]:%255[^\n]", &flags, channelbuffer, daybuffer, &start, &stop, &priority, &lifetime, filebuffer, aux)) {
++#else
+ if (8 <= sscanf(s, "%u :%a[^:]:%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &flags, &channelbuffer, &daybuffer, &start, &stop, &priority, &lifetime, &filebuffer, &aux)) {
++#endif
+ ClrFlags(tfRecording);
+ if (aux && !*skipspace(aux)) {
+ free(aux);
+Index: tools.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/tools.c,v
+retrieving revision 1.1.1.5
+retrieving revision 1.8
+diff -u -r1.1.1.5 -r1.8
+--- tools.c 2010/10/19 20:28:48 1.1.1.5
++++ tools.c 2010/10/19 20:32:58 1.8
+@@ -21,13 +21,24 @@
+ #include <stdarg.h>
+ #include <stdlib.h>
+ #include <sys/time.h>
++#ifdef __FreeBSD__
++#include <sys/param.h>
++#include <sys/mount.h>
++#else
+ #include <sys/vfs.h>
++#endif
+ #include <time.h>
+ #include <unistd.h>
+ #include <utime.h>
+ #include "i18n.h"
+ #include "thread.h"
+
++/* FreeBSD has it's own version of isnumber(),
++ but VDR's version is incompatible */
++#ifdef __FreeBSD__
++#undef isnumber
++#endif
++
+ int SysLogLevel = 3;
+
+ #define MAXSYSLOGBUF 256
+@@ -493,6 +504,18 @@
+ {
+ if (!FileName)
+ return NULL;
++#ifdef __FreeBSD__
++ char *resolved_path = NULL;
++ resolved_path = MALLOC(char, PATH_MAX+1);
++ if (realpath(FileName, resolved_path) == NULL)
++ {
++ if (errno != ENOENT) // some other error occurred
++ LOG_ERROR_STR(FileName);
++ else // file doesn't exist
++ resolved_path = strdup(FileName);
++ }
++ return resolved_path;
++#else
+ char *TargetName = canonicalize_file_name(FileName);
+ if (!TargetName) {
+ if (errno == ENOENT) // file doesn't exist
+@@ -501,6 +524,7 @@
+ LOG_ERROR_STR(FileName);
+ }
+ return TargetName;
++#endif
+ }
+
+ bool SpinUpDisk(const char *FileName)
+@@ -517,7 +541,11 @@
+ int f = open(buf, O_WRONLY | O_CREAT, DEFFILEMODE);
+ // O_SYNC doesn't work on all file systems
+ if (f >= 0) {
++#ifdef __FreeBSD__
++ if (fsync(f) < 0)
++#else
+ if (fdatasync(f) < 0)
++#endif
+ LOG_ERROR_STR(*buf);
+ close(f);
+ remove(buf);
+@@ -818,7 +846,11 @@
+ const char *cCharSetConv::Convert(const char *From, char *To, size_t ToLength)
+ {
+ if (cd != (iconv_t)-1 && From && *From) {
++#ifdef __FreeBSD__
++ const char *FromPtr = (char *)From;
++#else
+ char *FromPtr = (char *)From;
++#endif
+ size_t FromLength = strlen(From);
+ char *ToPtr = To;
+ if (!ToPtr) {
+@@ -920,7 +952,11 @@
+ return cString(buffer, true);
+ }
+
++#ifdef __FreeBSD__
++cString WeekDayNameReal(int WeekDay)
++#else
+ cString WeekDayName(int WeekDay)
++#endif
+ {
+ char buffer[16];
+ WeekDay = WeekDay == 0 ? 6 : WeekDay - 1; // we start with Monday==0!
+@@ -938,10 +974,18 @@
+ cString WeekDayName(time_t t)
+ {
+ struct tm tm_r;
++#ifdef __FreeBSD__
++ return WeekDayNameReal(localtime_r(&t, &tm_r)->tm_wday);
++#else
+ return WeekDayName(localtime_r(&t, &tm_r)->tm_wday);
++#endif
+ }
+
++#ifdef __FreeBSD__
++cString WeekDayNameFullReal(int WeekDay)
++#else
+ cString WeekDayNameFull(int WeekDay)
++#endif
+ {
+ WeekDay = WeekDay == 0 ? 6 : WeekDay - 1; // we start with Monday==0!
+ switch (WeekDay) {
+@@ -959,7 +1003,11 @@
+ cString WeekDayNameFull(time_t t)
+ {
+ struct tm tm_r;
++#ifdef __FreeBSD__
++ return WeekDayNameFullReal(localtime_r(&t, &tm_r)->tm_wday);
++#else
+ return WeekDayNameFull(localtime_r(&t, &tm_r)->tm_wday);
++#endif
+ }
+
+ cString DayDateTime(time_t t)
+@@ -969,7 +1017,11 @@
+ time(&t);
+ struct tm tm_r;
+ tm *tm = localtime_r(&t, &tm_r);
++#ifdef __FreeBSD__
++ snprintf(buffer, sizeof(buffer), "%s %02d.%02d. %02d:%02d", *WeekDayNameReal(tm->tm_wday), tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
++#else
+ snprintf(buffer, sizeof(buffer), "%s %02d.%02d. %02d:%02d", *WeekDayName(tm->tm_wday), tm->tm_mday, tm->tm_mon + 1, tm->tm_hour, tm->tm_min);
++#endif
+ return buffer;
+ }
+
+@@ -988,7 +1040,11 @@
+ char buf[32];
+ struct tm tm_r;
+ tm *tm = localtime_r(&t, &tm_r);
++#ifdef __FreeBSD__
++ char *p = stpcpy(buf, WeekDayNameReal(tm->tm_wday));
++#else
+ char *p = stpcpy(buf, WeekDayName(tm->tm_wday));
++#endif
+ *p++ = ' ';
+ strftime(p, sizeof(buf) - (p - buf), "%d.%m.%Y", tm);
+ return buf;
+@@ -1315,7 +1371,11 @@
+ if (!IsOpen()) {
+ f = FileDes;
+ if (f >= 0) {
++#ifdef __FreeBSD__
++ if ((uint)f < FD_SETSIZE) {
++#else
+ if (f < FD_SETSIZE) {
++#endif
+ if (f >= maxFiles)
+ maxFiles = f + 1;
+ if (!files[f])
+@@ -1356,7 +1416,11 @@
+ if (files[i])
+ FD_SET(i, &set);
+ }
++#ifdef __FreeBSD__
++ if (0 <= FileDes && (uint)FileDes < FD_SETSIZE && !files[FileDes])
++#else
+ if (0 <= FileDes && FileDes < FD_SETSIZE && !files[FileDes])
++#endif
+ FD_SET(FileDes, &set); // in case we come in with an arbitrary descriptor
+ if (TimeoutMs == 0)
+ TimeoutMs = 10; // load gets too heavy with 0
+@@ -1451,7 +1515,9 @@
+
+ // --- cUnbufferedFile -------------------------------------------------------
+
++#ifndef __FreeBSD__
+ #define USE_FADVISE
++#endif
+
+ #define WRITE_BUFFER KILOBYTE(800)
+
+@@ -1512,11 +1578,13 @@
+ readahead = ra;
+ }
+
++#ifdef USE_FADVISE
+ int cUnbufferedFile::FadviseDrop(off_t Offset, off_t Len)
+ {
+ // rounding up the window to make sure that not PAGE_SIZE-aligned data gets freed.
+ return posix_fadvise(fd, Offset - (FADVGRAN - 1), Len + (FADVGRAN - 1) * 2, POSIX_FADV_DONTNEED);
+ }
++#endif
+
+ off_t cUnbufferedFile::Seek(off_t Offset, int Whence)
+ {
+Index: tools.h
+===================================================================
+RCS file: /progs/network/ccvs/vdr/tools.h,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- tools.h 2010/02/17 10:14:44 1.1.1.2
++++ tools.h 2010/02/17 10:46:55 1.3
+@@ -26,6 +26,12 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+
++#ifdef __FreeBSD__
++#include <sys/param.h>
++typedef int (*__compar_fn_t) (__const void *, __const void *);
++#undef isnumber
++#endif
++
+ typedef unsigned char uchar;
+
+ extern int SysLogLevel;
+@@ -216,9 +222,17 @@
+ bool SpinUpDisk(const char *FileName);
+ void TouchFile(const char *FileName);
+ time_t LastModifiedTime(const char *FileName);
++#ifdef __FreeBSD__
++cString WeekDayNameReal(int WeekDay);
++#else
+ cString WeekDayName(int WeekDay);
++#endif
+ cString WeekDayName(time_t t);
++#ifdef __FreeBSD__
++cString WeekDayNameFullReal(int WeekDay);
++#else
+ cString WeekDayNameFull(int WeekDay);
++#endif
+ cString WeekDayNameFull(time_t t);
+ cString DayDateTime(time_t t = 0);
+ cString TimeToString(time_t t);
+Index: vdr.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/vdr.c,v
+retrieving revision 1.1.1.5
+retrieving revision 1.7
+diff -u -r1.1.1.5 -r1.7
+--- vdr.c 2010/06/07 09:07:28 1.1.1.5
++++ vdr.c 2010/06/07 09:12:57 1.7
+@@ -32,8 +32,10 @@
+ #include <pwd.h>
+ #include <signal.h>
+ #include <stdlib.h>
++#ifndef __FreeBSD__
+ #include <sys/capability.h>
+ #include <sys/prctl.h>
++#endif
+ #include <termios.h>
+ #include <unistd.h>
+ #include "audio.h"
+@@ -107,12 +109,15 @@
+ fprintf(stderr, "vdr: cannot set user id %u: %s\n", (unsigned int)user->pw_uid, strerror(errno));
+ return false;
+ }
++#ifndef __FreeBSD__
+ if (UserDump && prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0)
+ fprintf(stderr, "vdr: warning - cannot set dumpable: %s\n", strerror(errno));
++#endif
+ }
+ return true;
+ }
+
++#ifndef __FreeBSD__
+ static bool DropCaps(void)
+ {
+ // drop all capabilities except selected ones
+@@ -139,6 +144,7 @@
+ }
+ return true;
+ }
++#endif
+
+ static void SignalHandler(int signum)
+ {
+@@ -388,14 +394,18 @@
+ if (VdrUser && geteuid() == 0) {
+ StartedAsRoot = true;
+ if (strcmp(VdrUser, "root")) {
++#ifndef __FreeBSD__
+ if (!SetKeepCaps(true))
+ return 2;
++#endif
+ if (!SetUser(VdrUser, UserDump))
+ return 2;
++#ifndef __FreeBSD__
+ if (!SetKeepCaps(false))
+ return 2;
+ if (!DropCaps())
+ return 2;
++#endif
+ }
+ }
+
+Index: PLUGINS/src/svdrpdemo/svdrpdemo.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/PLUGINS/src/svdrpdemo/svdrpdemo.c,v
+retrieving revision 1.1.1.2
+retrieving revision 1.4
+diff -u -r1.1.1.2 -r1.4
+Index: libsi/headers.h
+===================================================================
+RCS file: /progs/network/ccvs/vdr/libsi/headers.h,v
+retrieving revision 1.1.1.2
+retrieving revision 1.3
+diff -u -r1.1.1.2 -r1.3
+--- libsi/headers.h 2010/02/17 10:14:45 1.1.1.2
++++ libsi/headers.h 2010/02/17 10:46:56 1.3
+@@ -17,7 +17,11 @@
+ #ifndef LIBSI_HEADERS_H
+ #define LIBSI_HEADERS_H
+
++#ifdef __FreeBSD__
++#include <sys/endian.h>
++#else
+ #include <endian.h>
++#endif
+
+ namespace SI {
+
+Index: libsi/si.c
+===================================================================
+RCS file: /progs/network/ccvs/vdr/libsi/si.c,v
+retrieving revision 1.1.1.4
+retrieving revision 1.7
+diff -u -r1.1.1.4 -r1.7
+--- libsi/si.c 2010/03/01 09:42:49 1.1.1.4
++++ libsi/si.c 2010/03/01 09:58:08 1.7
+@@ -13,7 +13,9 @@
+ #include "si.h"
+ #include <errno.h>
+ #include <iconv.h>
++#ifndef __FreeBSD__
+ #include <malloc.h>
++#endif
+ #include <stdlib.h> // for broadcaster stupidity workaround
+ #include <string.h>
+ #include "descriptor.h"
+@@ -381,7 +383,11 @@
+ if (SystemCharacterTable) {
+ iconv_t cd = iconv_open(SystemCharacterTable, fromCode);
+ if (cd != (iconv_t)-1) {
++#ifdef __FreeBSD__
++ const char *fromPtr = from;
++#else
+ char *fromPtr = (char *)from;
++#endif
+ while (fromLength > 0 && toLength > 1) {
+ if (iconv(cd, &fromPtr, &fromLength, &to, &toLength) == size_t(-1)) {
+ if (errno == EILSEQ) {
+--- PLUGINS/src/dvbsddevice/Makefile.orig
++++ PLUGINS/src/dvbsddevice/Makefile
+@@ -45,7 +45,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -100,7 +100,11 @@ i18n: $(I18Nmsgs) $(I18Npot)
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: $(I18Npo) clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/hello/Makefile.orig
++++ PLUGINS/src/hello/Makefile
+@@ -45,7 +45,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -100,7 +100,11 @@ i18n: $(I18Nmsgs)
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: $(I18Npo) clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/osddemo/Makefile.orig
++++ PLUGINS/src/osddemo/Makefile
+@@ -43,7 +43,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -73,7 +73,11 @@ $(DEPFILE): Makefile
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/pictures/Makefile.orig
++++ PLUGINS/src/pictures/Makefile
+@@ -45,7 +45,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -100,7 +100,11 @@ i18n: $(I18Nmsgs) $(I18Npot)
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: $(I18Npo) clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/servicedemo/Makefile.orig
++++ PLUGINS/src/servicedemo/Makefile
+@@ -45,7 +45,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -75,11 +75,19 @@ $(DEPFILE): Makefile
+
+ libvdr-$(PLUGIN1).so: $(PLUGIN1).o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN1).o -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ libvdr-$(PLUGIN2).so: $(PLUGIN2).o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN2).o -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/skincurses/Makefile.orig
++++ PLUGINS/src/skincurses/Makefile
+@@ -45,7 +45,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -100,7 +100,11 @@ i18n: $(I18Nmsgs) $(I18Npot)
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -lncursesw -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: $(I18Npo) clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/status/Makefile.orig
++++ PLUGINS/src/status/Makefile
+@@ -43,7 +43,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -73,7 +73,11 @@ $(DEPFILE): Makefile
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
+--- PLUGINS/src/svdrpdemo/Makefile.orig
++++ PLUGINS/src/svdrpdemo/Makefile
+@@ -43,7 +43,7 @@ PACKAGE = vdr-$(ARCHIVE)
+
+ ### Includes and Defines (add further entries here):
+
+-INCLUDES += -I$(VDRDIR)/include
++INCLUDES = -I$(VDRDIR)/include -I${LOCALBASE}/include
+
+ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+
+@@ -73,7 +73,11 @@ $(DEPFILE): Makefile
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
+- @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
++ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ dist: clean
+ @-rm -rf $(TMPDIR)/$(ARCHIVE)
diff --git a/multimedia/vdr/files/patch-vdr.1 b/multimedia/vdr/files/patch-vdr.1
new file mode 100644
index 000000000000..cd1218871d49
--- /dev/null
+++ b/multimedia/vdr/files/patch-vdr.1
@@ -0,0 +1,11 @@
+--- vdr.1.orig
++++ vdr.1
+@@ -45,7 +45,7 @@ Send Dolby Digital audio to stdin of com
+ .TP
+ .BI \-c\ dir ,\ \-\-config= dir
+ Read config files from directory \fIdir\fR
+-(default is to read them from the video directory).
++(default is to read them from %%CONFDIR%% on this installation.)
+ .TP
+ .B \-d, \-\-daemon
+ Run in daemon mode (implies \-\-no\-kbd).
diff --git a/multimedia/vdr/files/patch-z-Makefile b/multimedia/vdr/files/patch-z-Makefile
new file mode 100644
index 000000000000..60b41fde1ed6
--- /dev/null
+++ b/multimedia/vdr/files/patch-z-Makefile
@@ -0,0 +1,49 @@
+Index: Makefile
+@@ -25,6 +25,7 @@ PREFIX ?= /usr/local
+ MANDIR = $(PREFIX)/share/man
+ BINDIR = $(PREFIX)/bin
+ LOCDIR = ./locale
++INCDIR = $(PREFIX)/include
+ ifdef FREEBSD
+ INCLUDES = -I/usr/local/include/freetype2
+ LIBDIRS = -L/usr/local/lib
+@@ -177,7 +178,7 @@ clean-plugins:
+
+ # Install the files:
+
+-install: install-bin install-conf install-doc install-plugins install-i18n
++install: install-bin install-doc install-plugins install-header
+
+ # VDR binary:
+
+@@ -192,7 +193,6 @@ endif
+ # Configuration files:
+
+ install-conf:
+- @mkdir -p $(DESTDIR)$(VIDEODIR)
+ @if [ ! -d $(DESTDIR)$(CONFDIR) ]; then\
+ mkdir -p $(DESTDIR)$(CONFDIR);\
+ cp *.conf $(DESTDIR)$(CONFDIR);\
+@@ -208,7 +208,7 @@ install-doc:
+
+ # Plugins:
+
+-install-plugins: plugins
++install-plugins: #plugins
+ @mkdir -p $(DESTDIR)$(PLUGINLIBDIR)
+ ifdef FREEBSD
+ @cp -f $(PLUGINDIR)/lib/lib*-*.so.$(APIVERSION) $(DESTDIR)$(PLUGINLIBDIR)
+@@ -216,6 +216,13 @@ else
+ @cp --remove-destination $(PLUGINDIR)/lib/lib*-*.so.$(APIVERSION) $(DESTDIR)$(PLUGINLIBDIR)
+ endif
+
++# Header files:
++
++install-header:
++ @mkdir -p $(DESTDIR)$(INCDIR)/vdr $(DESTDIR)$(INCDIR)/vdr/libsi
++ @cp *.h Make.config Make.global $(DESTDIR)$(INCDIR)/vdr
++ @cp libsi/*.h $(DESTDIR)$(INCDIR)/vdr/libsi
++
+ # Source documentation:
+
+ srcdoc:
diff --git a/multimedia/vdr/files/patch-z-libsi-si.c b/multimedia/vdr/files/patch-z-libsi-si.c
new file mode 100644
index 000000000000..d81cc482518a
--- /dev/null
+++ b/multimedia/vdr/files/patch-z-libsi-si.c
@@ -0,0 +1,42 @@
+--- libsi/si.c.orig
++++ libsi/si.c
+@@ -308,6 +308,25 @@ static const char *CharacterTables2[] =
+ "ISO-8859-15", // 0x0F
+ };
+
++static const char *CharacterTables3[] = {
++ NULL, // 0x00
++ "ISO8859-1", // 0x01
++ "ISO8859-2", // 0x02
++ "ISO8859-3", // 0x03
++ "ISO8859-4", // 0x04
++ "ISO8859-5", // 0x05
++ "ISO8859-6", // 0x06
++ "ISO8859-7", // 0x07
++ "ISO8859-8", // 0x08
++ "ISO8859-9", // 0x09
++ "ISO8859-10", // 0x0A
++ "ISO8859-11", // 0x0B
++ "ISO8859-12", // 0x0C
++ "ISO8859-13", // 0x0D
++ "ISO8859-14", // 0x0E
++ "ISO8859-15", // 0x0F
++};
++
+ #define NumEntries(Table) (sizeof(Table) / sizeof(char *))
+
+ static const char *SystemCharacterTable = NULL;
+@@ -334,6 +353,13 @@ bool SetSystemCharacterTable(const char
+ return true;
+ }
+ }
++ for (unsigned int i = 0; i < NumEntries(CharacterTables3); i++) {
++ if (CharacterTables3[i] && strcasecmp(CharacterTable, CharacterTables3[i]) == 0) {
++ SystemCharacterTable = CharacterTables3[i];
++ SystemCharacterTableIsSingleByte = true;
++ return true;
++ }
++ }
+ } else {
+ SystemCharacterTable = NULL;
+ SystemCharacterTableIsSingleByte = true;
diff --git a/multimedia/vdr/files/remote.conf b/multimedia/vdr/files/remote.conf
new file mode 100644
index 000000000000..0d0bc1ab3075
--- /dev/null
+++ b/multimedia/vdr/files/remote.conf
@@ -0,0 +1,114 @@
+XKeySym.Up Up
+XKeySym.Down Down
+XKeySym.Menu Tab
+XKeySym.Menu Insert
+XKeySym.Ok Return
+XKeySym.Ok KP_Enter
+XKeySym.Back BackSpace
+XKeySym.Left Left
+XKeySym.Right Right
+XKeySym.Red F5
+XKeySym.Green F6
+XKeySym.Yellow F7
+XKeySym.Blue F8
+XKeySym.0 0
+XKeySym.1 1
+XKeySym.2 2
+XKeySym.3 3
+XKeySym.4 4
+XKeySym.5 5
+XKeySym.6 6
+XKeySym.7 7
+XKeySym.8 8
+XKeySym.9 9
+XKeySym.0 KP_0
+XKeySym.1 KP_1
+XKeySym.2 KP_2
+XKeySym.3 KP_3
+XKeySym.4 KP_4
+XKeySym.5 KP_5
+XKeySym.6 KP_6
+XKeySym.7 KP_7
+XKeySym.8 KP_8
+XKeySym.9 KP_9
+XKeySym.Info i
+XKeySym.Mute m
+XKeySym.Play p
+XKeySym.Pause Space
+XKeySym.Stop s
+XKeySym.Record r
+XKeySym.FastFwd w
+XKeySym.FastRew e
+XKeySym.Next n
+XKeySym.Prev v
+XKeySym.Channel+ Prior
+XKeySym.Channel- Next
+XKeySym.Volume+ KP_Add
+XKeySym.Volume- KP_Subtract
+XKeySym.Audio a
+XKeySym.Subtitles u
+XKeySym.Schedule l
+XKeySym.Channels c
+XKeySym.Timers t
+XKeySym.Recordings o
+XKeySym.Setup S
+XKeySym.Commands C
+XKeySym.User1 U
+XKeySym.User2 V
+XKeySym.User3 W
+XKeySym.User4 X
+XKeySym.User5 Y
+XKeySym.User6 Z
+KBD.Up 00000000001B5B41
+KBD.Down 00000000001B5B42
+KBD.Menu 0000000000000009
+KBD.Menu 000000001B5B327E
+KBD.Ok 000000000000000D
+KBD.Back 000000000000007F
+KBD.Back 0000000000000008
+KBD.Left 00000000001B5B44
+KBD.Right 00000000001B5B43
+KBD.Red 0000001B5B31357E
+KBD.Green 0000001B5B31377E
+KBD.Yellow 0000001B5B31387E
+KBD.Blue 0000001B5B31397E
+KBD.0 0000000000000030
+KBD.1 0000000000000031
+KBD.2 0000000000000032
+KBD.3 0000000000000033
+KBD.4 0000000000000034
+KBD.5 0000000000000035
+KBD.6 0000000000000036
+KBD.7 0000000000000037
+KBD.8 0000000000000038
+KBD.9 0000000000000039
+KBD.Info 0000000000000069
+KBD.Play 0000000000000070
+KBD.Pause 0000000000000020
+KBD.Stop 0000000000000073
+KBD.Record 0000000000000072
+KBD.FastFwd 0000000000000066
+KBD.FastRew 0000000000000077
+KBD.Next 000000000000006E
+KBD.Prev 0000000000000076
+KBD.Power 000000000000001B
+KBD.Channel+ 000000001B5B357E
+KBD.Channel- 000000001B5B367E
+KBD.PrevChannel 000000001B5B317E
+KBD.Volume+ 000000000000002B
+KBD.Volume- 000000000000002D
+KBD.Mute 000000000000006D
+KBD.Audio 0000000000000061
+KBD.Subtitles 0000000000000075
+KBD.Schedule 000000000000006C
+KBD.Channels 0000000000000063
+KBD.Timers 0000000000000074
+KBD.Recordings 000000000000006F
+KBD.Setup 0000000000000053
+KBD.Commands 0000000000000043
+KBD.User1 0000000000000055
+KBD.User2 0000000000000056
+KBD.User3 0000000000000057
+KBD.User4 0000000000000058
+KBD.User5 0000000000000059
+KBD.User6 000000000000005A
diff --git a/multimedia/vdr/files/vdr-1.7.15-disable_ca_updates.patch b/multimedia/vdr/files/vdr-1.7.15-disable_ca_updates.patch
new file mode 100644
index 000000000000..f6c788f5803a
--- /dev/null
+++ b/multimedia/vdr/files/vdr-1.7.15-disable_ca_updates.patch
@@ -0,0 +1,10 @@
+--- pat.c.orig 2010-06-06 19:11:15.000000000 +0300
++++ pat.c 2010-06-06 20:42:47.000000000 +0300
+@@ -490,6 +490,7 @@
+ }
+ if (Setup.UpdateChannels >= 2) {
+ Channel->SetPids(Vpid, Ppid, Vtype, Apids, Atypes, ALangs, Dpids, Dtypes, DLangs, Spids, SLangs, Tpid);
++ if (!cSource::IsType(Channel->Source(), 'I'))
+ Channel->SetCaIds(CaDescriptors->CaIds());
+ Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);
+ }
diff --git a/multimedia/vdr/files/vdr-1.7.15-disable_eitscan.patch b/multimedia/vdr/files/vdr-1.7.15-disable_eitscan.patch
new file mode 100644
index 000000000000..b3b3ef867eba
--- /dev/null
+++ b/multimedia/vdr/files/vdr-1.7.15-disable_eitscan.patch
@@ -0,0 +1,11 @@
+--- eitscan.c.orig 2010-06-06 19:11:14.000000000 +0300
++++ eitscan.c 2010-06-06 20:44:07.000000000 +0300
+@@ -146,7 +146,7 @@
+ if (Device) {
+ for (cScanData *ScanData = scanList->First(); ScanData; ScanData = scanList->Next(ScanData)) {
+ const cChannel *Channel = ScanData->GetChannel();
+- if (Channel) {
++ if (Channel && !cSource::IsType(Channel->Source(), 'I')) {
+ if (!Channel->Ca() || Channel->Ca() == Device->DeviceNumber() + 1 || Channel->Ca() >= CA_ENCRYPTED_MIN) {
+ if (Device->ProvidesTransponder(Channel)) {
+ if (!Device->Receiving()) {
diff --git a/multimedia/vdr/files/vdr.in b/multimedia/vdr/files/vdr.in
new file mode 100644
index 000000000000..b86f4609563e
--- /dev/null
+++ b/multimedia/vdr/files/vdr.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: vdr
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf[.local] to enable vdr:
+#
+# vdr_enable="YES"
+#
+# And if you are using vdr plugins etc. add those including any plugin
+# parameters to /etc/rc.conf[.local] similar to this:
+#
+# vdr_flags="'-Pxineliboutput --local=none --remote=127.1:37890' \
+# -Pfemon -Posdpip \
+# -Posdteletext --cache-system=packed --max-cache=128' \
+# -Pstreamdev-server '-Plive -i127.1' -Pepgsearch \
+# -Pinfosatepg"
+
+. /etc/rc.subr
+
+name=vdr
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/bin/vdr"
+command_args="-d"
+
+load_rc_config ${name}
+: ${vdr_enable="NO"}
+: ${vdr_chdir="%%VIDEODIR%%"}
+
+run_rc_command "$1"
diff --git a/multimedia/vdr/pkg-descr b/multimedia/vdr/pkg-descr
new file mode 100644
index 000000000000..b77e2804cd5d
--- /dev/null
+++ b/multimedia/vdr/pkg-descr
@@ -0,0 +1,13 @@
+Preliminary port of the vdr development branch, use at your own risk! :)
+
+See vdr/webcamd dvb thread(s) on the freebsd-multimedia list for FreeBSD
+notes, some links are here:
+
+ http://people.freebsd.org/~nox/dvb/
+
+and see these links for general vdr info:
+
+ http://www.linuxtv.org/vdrwiki/index.php/Main_Page
+ http://www.vdr-portal.de/
+
+WWW: http://www.tvdr.de/
diff --git a/multimedia/vdr/pkg-plist b/multimedia/vdr/pkg-plist
new file mode 100644
index 000000000000..9fedb1c62c55
--- /dev/null
+++ b/multimedia/vdr/pkg-plist
@@ -0,0 +1,208 @@
+bin/svdrpsend.pl
+bin/vdr
+lib/vdr/libvdr-dvbsddevice.so.1.7.17
+lib/vdr/libvdr-svcsvr.so.1.7.17
+lib/vdr/libvdr-svccli.so.1.7.17
+lib/vdr/libvdr-status.so.1.7.17
+lib/vdr/libvdr-skincurses.so.1.7.17
+lib/vdr/libvdr-pictures.so.1.7.17
+lib/vdr/libvdr-osddemo.so.1.7.17
+lib/vdr/libvdr-hello.so.1.7.17
+lib/vdr/libvdr-svdrpdemo.so.1.7.17
+%%NLS%%share/locale/ar/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/es_ES/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/es_ES/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/fr_FR/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/fr_FR/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/fr_FR/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/pt_PT/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/pt_PT/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/zh_CN/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/zh_CN/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/lt_LT/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/lt_LT/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/lt_LT/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/lt_LT/LC_MESSAGES/vdr-skincurses.mo
+%%NLS%%share/locale/mk_MK/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/uk_UA/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/tr_TR/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/tr_TR/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/sr_SR/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/sv_SE/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/sv_SE/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/sl_SI/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/sl_SI/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/sk_SK/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/sk_SK/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/sk_SK/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/sk_SK/LC_MESSAGES/vdr-skincurses.mo
+%%NLS%%share/locale/ru_RU/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/ru_RU/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/ru_RU/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/ru_RU/LC_MESSAGES/vdr-skincurses.mo
+%%NLS%%share/locale/ro_RO/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/ro_RO/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/pl_PL/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/pl_PL/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/nn_NO/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/nn_NO/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/nl_NL/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/nl_NL/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/it_IT/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/it_IT/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/it_IT/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/it_IT/LC_MESSAGES/vdr-skincurses.mo
+%%NLS%%share/locale/hu_HU/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/hu_HU/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/hr_HR/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/hr_HR/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/fi_FI/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/fi_FI/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/fi_FI/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/fi_FI/LC_MESSAGES/vdr-skincurses.mo
+%%NLS%%share/locale/et_EE/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/et_EE/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/el_GR/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/el_GR/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/de_DE/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/de_DE/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/de_DE/LC_MESSAGES/vdr-pictures.mo
+%%NLS%%share/locale/de_DE/LC_MESSAGES/vdr-skincurses.mo
+%%NLS%%share/locale/da_DK/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/da_DK/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/cs_CZ/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/cs_CZ/LC_MESSAGES/vdr-hello.mo
+%%NLS%%share/locale/ca_ES/LC_MESSAGES/vdr.mo
+%%NLS%%share/locale/ca_ES/LC_MESSAGES/vdr-hello.mo
+include/vdr/libsi/util.h
+include/vdr/libsi/si.h
+include/vdr/libsi/section.h
+include/vdr/libsi/headers.h
+include/vdr/libsi/descriptor.h
+include/vdr/audio.h
+include/vdr/Make.config
+include/vdr/videodir.h
+include/vdr/transfer.h
+include/vdr/tools.h
+include/vdr/timers.h
+include/vdr/thread.h
+include/vdr/themes.h
+include/vdr/svdrp.h
+include/vdr/status.h
+include/vdr/spu.h
+include/vdr/sources.h
+include/vdr/sourceparams.h
+include/vdr/skinsttng.h
+include/vdr/skins.h
+include/vdr/skinclassic.h
+include/vdr/shutdown.h
+include/vdr/sections.h
+include/vdr/sdt.h
+include/vdr/ringbuffer.h
+include/vdr/remux.h
+include/vdr/remote.h
+include/vdr/recording.h
+include/vdr/recorder.h
+include/vdr/receiver.h
+include/vdr/rcu.h
+include/vdr/plugin.h
+include/vdr/player.h
+include/vdr/pat.h
+include/vdr/osdbase.h
+include/vdr/osd.h
+include/vdr/nit.h
+include/vdr/menuitems.h
+include/vdr/menu.h
+include/vdr/lirc.h
+include/vdr/keys.h
+include/vdr/interface.h
+include/vdr/i18n.h
+include/vdr/font.h
+include/vdr/filter.h
+include/vdr/epg.h
+include/vdr/eitscan.h
+include/vdr/eit.h
+include/vdr/dvbsubtitle.h
+include/vdr/dvbspu.h
+include/vdr/dvbplayer.h
+include/vdr/dvbdevice.h
+include/vdr/dvbci.h
+include/vdr/diseqc.h
+include/vdr/device.h
+include/vdr/cutter.h
+include/vdr/ci.h
+include/vdr/config.h
+include/vdr/channels.h
+include/vdr/Make.global
+@exec mkdir -p %D/etc/vdr/plugins
+@exec chown %%VDR_USER%%:%%VDR_GROUP%% %D/etc/vdr %D/etc/vdr/plugins
+@unexec if cmp -s %D/etc/vdr/remote.conf.sample %D/etc/vdr/remote.conf; then rm -f %D/etc/vdr/remote.conf; fi
+etc/vdr/remote.conf.sample
+@exec if [ ! -f %D/etc/vdr/remote.conf ] ; then cp -p %D/%F %B/remote.conf; fi
+@unexec if cmp -s %D/etc/vdr/channels.conf.sample %D/etc/vdr/channels.conf; then rm -f %D/etc/vdr/channels.conf; fi
+etc/vdr/channels.conf.sample
+@exec if [ ! -f %D/etc/vdr/channels.conf ] ; then cp -p %D/%F %B/channels.conf; fi
+@unexec if cmp -s %D/etc/vdr/diseqc.conf.sample %D/etc/vdr/diseqc.conf; then rm -f %D/etc/vdr/diseqc.conf; fi
+etc/vdr/diseqc.conf.sample
+@exec if [ ! -f %D/etc/vdr/diseqc.conf ] ; then cp -p %D/%F %B/diseqc.conf; fi
+@unexec if cmp -s %D/etc/vdr/keymacros.conf.sample %D/etc/vdr/keymacros.conf; then rm -f %D/etc/vdr/keymacros.conf; fi
+etc/vdr/keymacros.conf.sample
+@exec if [ ! -f %D/etc/vdr/keymacros.conf ] ; then cp -p %D/%F %B/keymacros.conf; fi
+@unexec if cmp -s %D/etc/vdr/sources.conf.sample %D/etc/vdr/sources.conf; then rm -f %D/etc/vdr/sources.conf; fi
+etc/vdr/sources.conf.sample
+@exec if [ ! -f %D/etc/vdr/sources.conf ] ; then cp -p %D/%F %B/sources.conf; fi
+@unexec if cmp -s %D/etc/vdr/svdrphosts.conf.sample %D/etc/vdr/svdrphosts.conf; then rm -f %D/etc/vdr/svdrphosts.conf; fi
+etc/vdr/svdrphosts.conf.sample
+@exec if [ ! -f %D/etc/vdr/svdrphosts.conf ] ; then cp -p %D/%F %B/svdrphosts.conf; fi
+%%NLS%%@dirrmtry share/locale/ca_ES/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/ca_ES
+%%NLS%%@dirrmtry share/locale/cs_CZ/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/cs_CZ
+%%NLS%%@dirrmtry share/locale/da_DK/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/da_DK
+%%NLS%%@dirrmtry share/locale/de_DE/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/de_DE
+%%NLS%%@dirrmtry share/locale/el_GR/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/el_GR
+%%NLS%%@dirrmtry share/locale/et_EE/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/et_EE
+%%NLS%%@dirrmtry share/locale/fi_FI/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/fi_FI
+%%NLS%%@dirrmtry share/locale/hr_HR/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/hr_HR
+%%NLS%%@dirrmtry share/locale/hu_HU/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/hu_HU
+%%NLS%%@dirrmtry share/locale/it_IT/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/it_IT
+%%NLS%%@dirrmtry share/locale/lt_LT/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/lt_LT
+%%NLS%%@dirrmtry share/locale/mk_MK/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/mk_MK
+%%NLS%%@dirrmtry share/locale/nl_NL/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/nl_NL
+%%NLS%%@dirrmtry share/locale/nn_NO/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/nn_NO
+%%NLS%%@dirrmtry share/locale/pl_PL/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/pl_PL
+%%NLS%%@dirrmtry share/locale/ro_RO/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/ro_RO
+%%NLS%%@dirrmtry share/locale/ru_RU/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/ru_RU
+%%NLS%%@dirrmtry share/locale/sk_SK/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/sk_SK
+%%NLS%%@dirrmtry share/locale/sl_SI/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/sl_SI
+%%NLS%%@dirrmtry share/locale/tr_TR/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/tr_TR
+%%NLS%%@dirrmtry share/locale/sr_SR/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/sr_SR
+%%NLS%%@dirrmtry share/locale/sv_SE/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/sv_SE
+%%NLS%%@dirrmtry share/locale/uk_UA/LC_MESSAGES
+%%NLS%%@dirrmtry share/locale/uk_UA
+@dirrmtry etc/vdr/plugins
+@dirrmtry etc/vdr
+@dirrmtry lib/vdr
+@dirrm include/vdr/libsi
+@dirrm include/vdr
+@unexec echo "Warning: If you will *NOT* use this package anymore, please remove the vdr user and group manually."