aboutsummaryrefslogtreecommitdiff
path: root/multimedia/vdr-plugin-markad
diff options
context:
space:
mode:
Diffstat (limited to 'multimedia/vdr-plugin-markad')
-rw-r--r--multimedia/vdr-plugin-markad/Makefile58
-rw-r--r--multimedia/vdr-plugin-markad/distinfo2
-rw-r--r--multimedia/vdr-plugin-markad/files/patch-command-Makefile33
-rw-r--r--multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp36
-rw-r--r--multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp105
-rw-r--r--multimedia/vdr-plugin-markad/files/patch-plugin-Makefile18
-rw-r--r--multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp19
-rw-r--r--multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp83
-rw-r--r--multimedia/vdr-plugin-markad/pkg-descr5
-rw-r--r--multimedia/vdr-plugin-markad/pkg-plist12
10 files changed, 371 insertions, 0 deletions
diff --git a/multimedia/vdr-plugin-markad/Makefile b/multimedia/vdr-plugin-markad/Makefile
new file mode 100644
index 000000000000..cfea1f3ef1f7
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/Makefile
@@ -0,0 +1,58 @@
+# New ports collection makefile for: vdr-plugin-markad
+# Date created: Wed Mar 30 22:35:19 CEST 2011
+# Whom: Juergen Lock <nox@freebsd.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= vdr-plugin-markad
+PORTVERSION= 0.1.2
+CATEGORIES= multimedia
+MASTER_SITES= http://projects.vdr-developer.org/attachments/download/578/
+DISTNAME= ${PORTNAME:S/-plugin-/-/}-${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= nox@FreeBSD.org
+COMMENT= Video Disk Recorder - MarkAd plugin
+
+LIB_DEPENDS+= avcodec:${PORTSDIR}/multimedia/ffmpeg \
+ execinfo.1:${PORTSDIR}/devel/libexecinfo
+
+PATCH_STRIP= -p1
+HAVE_CONFIGURE= yes
+PORTDOCS= COPYING README
+PORTDATA= logos
+MAKE_JOBS_SAFE= yes
+WRKSRC= ${WRKDIR}/${PLUGIN}-${DISTVERSION}
+VDR_PLUGIN_MAKEFILES= ${WRKSRC}/command/Makefile ${WRKSRC}/plugin/Makefile
+DEFINES+= -DDATADIR=\\\"${DATADIR}\\\" -DPREFIX=\\\"${PREFIX}\\\"
+MAKE_ARGS+= DATADIR=${DATADIR} FREEBSD=1
+MAKE_ENV+= DEFINES="${DEFINES}"
+
+RESTRICTED= installs station logos
+
+.include <bsd.port.pre.mk>
+
+.include "${.CURDIR}/../vdr/Makefile.plugins"
+
+.if ${OSVERSION} < 800000
+IGNORE= needs getline(3)
+.endif
+
+# for libexecinfo: (so that __builtin_frame_address() finds the top
+# of the stack)
+.if ${ARCH} == "amd64"
+CFLAGS+= -fno-omit-frame-pointer
+CPPFLAGS+= -fno-omit-frame-pointer
+.endif
+
+post-patch: post-patch-plugin
+ @${LN} -s ../lib ../locale ${WRKSRC}
+
+post-install: post-install-pluginlocales
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ (cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR})
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/multimedia/vdr-plugin-markad/distinfo b/multimedia/vdr-plugin-markad/distinfo
new file mode 100644
index 000000000000..e40bbd8c1539
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/distinfo
@@ -0,0 +1,2 @@
+SHA256 (vdr/vdr-markad-0.1.2.tgz) = ca2b855435a11b8bd814e031cca3f37fdd8da866d8b7eec889d1a624c5861d6b
+SIZE (vdr/vdr-markad-0.1.2.tgz) = 100832
diff --git a/multimedia/vdr-plugin-markad/files/patch-command-Makefile b/multimedia/vdr-plugin-markad/files/patch-command-Makefile
new file mode 100644
index 000000000000..6a550cec1a62
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/files/patch-command-Makefile
@@ -0,0 +1,33 @@
+--- a/command/Makefile
++++ b/command/Makefile
+@@ -16,6 +16,10 @@ CXXFLAGS ?= -g -rdynamic -O3 -funroll-lo
+ PKG-CONFIG ?= pkg-config
+ STRIP ?= strip
+
++ifdef FREEBSD
++LIBS+=-lintl -lexecinfo
++endif
++
+ ### Includes and Defines (add further entries here):
+
+ PKG-LIBS += libavcodec libavutil
+@@ -88,11 +100,19 @@ markad: $(OBJS)
+ $(CXX) $(CXXFLAGS) $(OBJS) $(LIBS) -o $@
+
+ install: markad $(I18Nmsgs)
++ifdef FREEBSD
++ @mkdir -p $(PREFIX)/bin
++ @cp -f markad $(PREFIX)/bin/markad
++ @$(STRIP) $(PREFIX)/bin/markad
++ @mkdir -p $(DATADIR)/logos
++ @cp logos/* $(DATADIR)/logos
++else
+ @mkdir -p $(DESTDIR)/usr/bin
+ @cp --remove-destination markad $(DESTDIR)/usr/bin/markad
+ @$(STRIP) $(DESTDIR)/usr/bin/markad
+ @mkdir -p $(DESTDIR)/var/lib/markad
+ @cp logos/* $(DESTDIR)/var/lib/markad
++endif
+ @echo markad installed
+
+ clean:
diff --git a/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp b/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp
new file mode 100644
index 000000000000..d66a0b13e4f7
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/files/patch-command-decoder.cpp
@@ -0,0 +1,36 @@
+--- a/command/decoder.cpp
++++ b/command/decoder.cpp
+@@ -6,7 +6,12 @@
+ */
+
+ #include <stdint.h>
++#ifndef __FreeBSD__
+ #include <sched.h>
++#else
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <string.h>
+@@ -107,6 +112,7 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH
+ noticeERRMP2=false;
+ noticeERRAC3=false;
+
++#ifndef __FreeBSD__
+ cpu_set_t cpumask;
+ uint len = sizeof(cpumask);
+ int cpucount;
+@@ -118,6 +124,12 @@ cMarkAdDecoder::cMarkAdDecoder(bool useH
+ {
+ cpucount=CPU_COUNT(&cpumask);
+ }
++#else
++ int cpucount;
++ size_t cpus_size = sizeof(cpucount);
++ if (sysctlbyname("hw.ncpu", &cpucount, &cpus_size, NULL, 0) == -1)
++ cpucount = 1;
++#endif
+
+ if (Threads==-1)
+ {
diff --git a/multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp b/multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp
new file mode 100644
index 000000000000..d14e130e4e4f
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/files/patch-command-markad-standalone.cpp
@@ -0,0 +1,105 @@
+--- a/command/markad-standalone.cpp
++++ b/command/markad-standalone.cpp
+@@ -24,7 +24,13 @@
+ #include <locale.h>
+ #include <libintl.h>
+ #include <execinfo.h>
++#ifndef __FreeBSD__
+ #include <mntent.h>
++#else
++#include <netinet/in.h>
++#include <sys/socket.h>
++#include <sys/mount.h>
++#endif
+ #include <utime.h>
+ #include <math.h>
+ #include <limits.h>
+@@ -1389,6 +1395,7 @@ bool cMarkAdStandalone::SaveInfo()
+ time_t cMarkAdStandalone::GetBroadcastStart(time_t start, int fd)
+ {
+ // get broadcast start from atime of directory (if the volume is mounted with noatime)
++#ifndef __FreeBSD__
+ struct mntent *ent;
+ struct stat statbuf;
+ FILE *mounts=setmntent(_PATH_MOUNTED,"r");
+@@ -1415,6 +1422,14 @@ time_t cMarkAdStandalone::GetBroadcastSt
+ }
+ }
+ endmntent(mounts);
++#else
++ struct stat statbuf;
++ struct statfs statfsbuf;
++ bool useatime=false;
++ if ((statfs(directory, &statfsbuf) == 0) &&
++ !(statfsbuf.f_flags & MNT_NOATIME))
++ useatime=true;
++#endif
+
+ if ((useatime) && (stat(directory,&statbuf)!=-1))
+ {
+@@ -1900,10 +1915,14 @@ bool cMarkAdStandalone::CreatePidfile()
+ int pid;
+ if (fscanf(oldpid,"%i\n",&pid)==1)
+ {
++#ifndef __FreeBSD__
+ char procname[256]="";
+ snprintf(procname,sizeof(procname),"/proc/%i",pid);
+ struct stat statbuf;
+ if (stat(procname,&statbuf)!=-1)
++#else
++ if (kill(pid, 0) == 0)
++#endif
+ {
+ // found another, running markad
+ isyslog("another instance is running on this recording");
+@@ -2212,7 +2231,7 @@ cMarkAdStandalone::~cMarkAdStandalone()
+ RemovePidfile();
+ }
+
+-bool isnumber(const char *s)
++bool str_isnumber(const char *s)
+ {
+ while (*s)
+ {
+@@ -2238,7 +2257,11 @@ int usage(int svdrpport)
+ " ignores hints from info(.vdr) file\n"
+ " <info> 4 = ignore timer info\n"
+ "-l --logocachedir\n"
++#ifdef DATADIR
++ " directory where logos stored, default " DATADIR "/logos\n"
++#else
+ " directory where logos stored, default /var/lib/markad\n"
++#endif
+ "-p --priority=<priority>\n"
+ " software priority of markad when running in background\n"
+ " <priority> from -20...19, default 19\n"
+@@ -2382,7 +2405,11 @@ int main(int argc, char *argv[])
+ config.logoHeight=-1;
+ config.threads=-1;
+ strcpy(config.svdrphost,"127.0.0.1");
++#ifdef DATADIR
++ strcpy(config.logoDirectory,DATADIR "/logos");
++#else
+ strcpy(config.logoDirectory,"/var/lib/markad");
++#endif
+
+ struct servent *serv=getservbyname("svdrp","tcp");
+ if (serv)
+@@ -2513,7 +2540,7 @@ int main(int argc, char *argv[])
+
+ case 'p':
+ // --priority
+- if (isnumber(optarg) || *optarg=='-')
++ if (str_isnumber(optarg) || *optarg=='-')
+ niceLevel = atoi(optarg);
+ else
+ {
+@@ -2699,7 +2726,7 @@ int main(int argc, char *argv[])
+ break;
+
+ case 9: // --svdrpport
+- if (isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536)
++ if (str_isnumber(optarg) && atoi(optarg) > 0 && atoi(optarg) < 65536)
+ {
+ config.svdrpport=atoi(optarg);
+ }
diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin-Makefile b/multimedia/vdr-plugin-markad/files/patch-plugin-Makefile
new file mode 100644
index 000000000000..15ca635394a9
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/files/patch-plugin-Makefile
@@ -0,0 +1,18 @@
+--- a/plugin/Makefile
++++ b/plugin/Makefile
+@@ -100,10 +100,15 @@ i18n: $(I18Nmsgs) $(I18Npot)
+ ### Targets:
+
+ install:
++ ${INSTALL_PROGRAM} $(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION) $(PREFIX)/lib/vdr/libvdr-$(PLUGIN).so.$(APIVERSION)
+
+ libvdr-$(PLUGIN).so: $(OBJS)
+ $(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
++ifdef FREEBSD
++ @cp -f $@ $(LIBDIR)/$@.$(APIVERSION)
++else
+ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
++endif
+
+ clean:
+ @-rm -f $(OBJS) $(DEPFILE) *.so *.so.* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp b/multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp
new file mode 100644
index 000000000000..3bafd37e0f4b
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/files/patch-plugin-markad.cpp
@@ -0,0 +1,19 @@
+--- a/plugin/markad.cpp
++++ b/plugin/markad.cpp
+@@ -15,8 +15,16 @@
+
+ #include "markad.h"
+
++#ifdef PREFIX
++#define DEF_BINDIR PREFIX "/bin"
++#else
+ #define DEF_BINDIR "/usr/bin"
++#endif
++#ifdef DATADIR
++#define DEF_LOGODIR DATADIR "/logos"
++#else
+ #define DEF_LOGODIR "/var/lib/markad"
++#endif
+
+ cPluginMarkAd::cPluginMarkAd(void)
+ {
diff --git a/multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp b/multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp
new file mode 100644
index 000000000000..5c7b6c22b13b
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/files/patch-plugin-status.cpp
@@ -0,0 +1,83 @@
+--- a/plugin/status.cpp
++++ b/plugin/status.cpp
+@@ -6,6 +6,12 @@
+ */
+
+ #include <signal.h>
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <sys/user.h>
++#include <sys/vmmeter.h>
++#endif
+
+ #include "status.h"
+
+@@ -223,6 +229,7 @@ bool cStatusMarkAd::getStatus(int Positi
+ if (Position<0) return false;
+ if (!recs[Position].Pid) return false;
+ int ret=0;
++#ifndef __FreeBSD__
+ char procname[256]="";
+ snprintf(procname,sizeof(procname),"/proc/%i/stat",recs[Position].Pid);
+ FILE *fstat=fopen(procname,"r");
+@@ -242,6 +249,59 @@ bool cStatusMarkAd::getStatus(int Positi
+ }
+ }
+ return (ret==1);
++#else
++ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, recs[Position].Pid};
++ size_t len = 0;
++ struct kinfo_proc *kipp = NULL;
++ if (sysctl(mib, sizeof(mib)/sizeof(*mib), NULL, &len, NULL, 0) >= 0 &&
++ (kipp = (kinfo_proc *)malloc(len)) != NULL &&
++ sysctl(mib, sizeof(mib)/sizeof(*mib), kipp, &len, NULL, 0) >= 0 &&
++ len == sizeof(*kipp) && kipp->ki_structsize == sizeof(*kipp) &&
++ kipp->ki_pid == recs[Position].Pid) {
++
++ int tdflags = kipp->ki_tdflags; /* XXXKSE */
++
++ ret = 1;
++
++ switch (kipp->ki_stat) {
++
++ case SSTOP:
++ recs[Position].Status = 'T';
++ break;
++
++ case SSLEEP:
++ if (tdflags & TDF_SINTR) /* interruptable (long) */
++ recs[Position].Status = /* kipp->ki_slptime >= MAXSLP ? 'I' : */ 'S';
++ else
++ recs[Position].Status = 'D';
++ break;
++
++ case SRUN:
++ case SIDL:
++ recs[Position].Status = 'R';
++ break;
++
++ case SWAIT:
++ recs[Position].Status = 'W';
++ break;
++
++ case SLOCK:
++ recs[Position].Status = 'L';
++ break;
++
++ case SZOMB:
++ recs[Position].Status = 'Z';
++ break;
++
++ default:
++ recs[Position].Status = '?';
++ }
++ } else {
++ Remove(Position);
++ }
++ free(kipp);
++ return ret;
++#endif
+ }
+
+ bool cStatusMarkAd::getPid(int Position)
diff --git a/multimedia/vdr-plugin-markad/pkg-descr b/multimedia/vdr-plugin-markad/pkg-descr
new file mode 100644
index 000000000000..e9f277fec173
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/pkg-descr
@@ -0,0 +1,5 @@
+http://www.vdr-wiki.de/wiki/index.php/Markad-plugin
+
+MarkAd marks advertisements in VDR recordings.
+
+WWW: http://projects.vdr-developer.org/projects/plg-markad
diff --git a/multimedia/vdr-plugin-markad/pkg-plist b/multimedia/vdr-plugin-markad/pkg-plist
new file mode 100644
index 000000000000..64292070f396
--- /dev/null
+++ b/multimedia/vdr-plugin-markad/pkg-plist
@@ -0,0 +1,12 @@
+bin/markad
+lib/vdr/libvdr-markad.so.1.7.17
+%%NLS%%share/locale/de_DE/LC_MESSAGES/vdr-markad.mo
+%%NLS%%share/locale/es_ES/LC_MESSAGES/vdr-markad.mo
+%%NLS%%share/locale/fi_FI/LC_MESSAGES/vdr-markad.mo
+%%NLS%%share/locale/it_IT/LC_MESSAGES/vdr-markad.mo
+%%NLS%%share/locale/sk_SK/LC_MESSAGES/vdr-markad.mo
+%%NLS%%share/locale/cs_CZ/LC_MESSAGES/markad.mo
+%%NLS%%share/locale/de_DE/LC_MESSAGES/markad.mo
+%%NLS%%share/locale/fi_FI/LC_MESSAGES/markad.mo
+%%NLS%%share/locale/it_IT/LC_MESSAGES/markad.mo
+%%NLS%%share/locale/sk_SK/LC_MESSAGES/markad.mo