diff --git a/multimedia/motion/Makefile b/multimedia/motion/Makefile new file mode 100644 index 00000000000..32bba2a789b --- /dev/null +++ b/multimedia/motion/Makefile @@ -0,0 +1,58 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ + +COMMENT= motion detection software for video + +GH_ACCOUNT= Mr-Dave +GH_PROJECT= motion +GH_COMMIT= 7cfdf13cd63378e45589650f7d20195cb7bf9936 +DISTNAME= motion-0.20140910 + +CATEGORIES= multimedia + +HOMEPAGE= http://www.lavrsen.dk/foswiki/bin/view/Motion/ + +MAINTAINER= Stuart Henderson + +# GPL (according to source files, v2 only. website says v2+). +PERMIT_PACKAGE_CDROM= Yes + +WANTLIB += SDL avcodec avformat avutil c jpeg m pthread sqlite3 swscale z + +FLAVOR?= +FLAVORS= mysql pgsql + +LIB_DEPENDS= graphics/jpeg \ + graphics/ffmpeg + +FAKE_FLAGS= docdir=${PREFIX}/share/doc/motion \ + examplesdir=${PREFIX}/share/examples/motion + +USE_GMAKE= Yes +CONFIGURE_STYLE= autoconf +AUTOCONF_VERSION= 2.68 +CONFIGURE_ARGS= --without-optimizecpu \ + LDFLAGS="-L${LOCALBASE}/lib" \ + CPPFLAGS="-I${LOCALBASE}/include" + +.if ${FLAVOR:L:Mmysql} +LIB_DEPENDS+= databases/mariadb +WANTLIB+= lib/mysql/mysqlclient +.else +CONFIGURE_ARGS+= --without-mysql +.endif + +.if ${FLAVOR:L:Mpgsql} +LIB_DEPENDS+= databases/postgresql +WANTLIB+= pq +CONFIGURE_ARGS+= --with-pgsql-lib=${LOCALBASE}/lib +.else +CONFIGURE_ARGS+= --without-pgsql +.endif + +NO_TEST= Yes + +pre-configure: + perl -pi -e s,/usr/local/etc,${SYSCONFDIR},g \ + ${WRKSRC}/motion-dist.conf.in + +.include diff --git a/multimedia/motion/distinfo b/multimedia/motion/distinfo new file mode 100644 index 00000000000..35509b5cb15 --- /dev/null +++ b/multimedia/motion/distinfo @@ -0,0 +1,2 @@ +SHA256 (motion-0.20140910.tar.gz) = dtjbbv3ZPH7y5sttM1oMPXWxx4tTFbqks7N3Tp7kan8= +SIZE (motion-0.20140910.tar.gz) = 454091 diff --git a/multimedia/motion/patches/patch-configure_ac b/multimedia/motion/patches/patch-configure_ac new file mode 100644 index 00000000000..874761608bf --- /dev/null +++ b/multimedia/motion/patches/patch-configure_ac @@ -0,0 +1,30 @@ +$OpenBSD: patch-configure_ac,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- configure.ac.orig Wed Sep 10 03:53:41 2014 ++++ configure.ac Fri Oct 10 11:41:32 2014 +@@ -37,7 +37,7 @@ if test "${Darwin}" = ""; then + AC_MSG_RESULT(no) + AC_MSG_CHECKING(for *BSD) + +- FreeBSD=`uname -a | grep "BSD"` ++ FreeBSD=`uname -a | grep "FreeBSD"` + if test "${FreeBSD}" = ""; then + AC_MSG_RESULT(no) + VIDEO="video.o video2.o video_common.o" +@@ -915,7 +915,7 @@ fi + + #Checks for header files. + AC_HEADER_STDC +-AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h) ++AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h sys/videoio.h) + + AC_CHECK_FUNCS(get_current_dir_name) + +@@ -931,7 +931,7 @@ else + [SUPPORTED_V4L2=true], + [SUPPORTED_V4L2=false], + [#include +- #include ]) ++ #include ]) + + AC_MSG_CHECKING(for V42L support) + if test x$SUPPORTED_V4L2 = xtrue; then diff --git a/multimedia/motion/patches/patch-motion-dist_conf_in b/multimedia/motion/patches/patch-motion-dist_conf_in new file mode 100644 index 00000000000..52ae2e28ff4 --- /dev/null +++ b/multimedia/motion/patches/patch-motion-dist_conf_in @@ -0,0 +1,14 @@ +$OpenBSD: patch-motion-dist_conf_in,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- motion-dist.conf.in.orig Wed Sep 10 03:53:41 2014 ++++ motion-dist.conf.in Fri Oct 10 12:53:44 2014 +@@ -72,8 +72,8 @@ v4l2_palette 17 + ; tunerdevice /dev/tuner0 + + # The video input to be used (default: -1) +-# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras +-input -1 ++# On OpenBSD, set to 0 - uvideo_enum_input() does not support other inputs. ++input 0 + + # The video norm to use (only for video capture and TV tuner cards) + # Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) diff --git a/multimedia/motion/patches/patch-motion_c b/multimedia/motion/patches/patch-motion_c new file mode 100644 index 00000000000..8140ffb8749 --- /dev/null +++ b/multimedia/motion/patches/patch-motion_c @@ -0,0 +1,11 @@ +$OpenBSD: patch-motion_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- motion.c.orig Wed Sep 10 03:53:41 2014 ++++ motion.c Fri Oct 10 11:37:35 2014 +@@ -25,6 +25,7 @@ + /* Forward declarations */ + static int motion_init(struct context *cnt); + static void motion_cleanup(struct context *cnt); ++static void setup_signals(struct sigaction *, struct sigaction *); + + + /** diff --git a/multimedia/motion/patches/patch-netcam_rtsp_c b/multimedia/motion/patches/patch-netcam_rtsp_c new file mode 100644 index 00000000000..658044e819d --- /dev/null +++ b/multimedia/motion/patches/patch-netcam_rtsp_c @@ -0,0 +1,11 @@ +$OpenBSD: patch-netcam_rtsp_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- netcam_rtsp.c.orig Fri Oct 10 11:43:35 2014 ++++ netcam_rtsp.c Fri Oct 10 11:43:36 2014 +@@ -18,6 +18,7 @@ + * + ***********************************************************/ + ++#include + #include + #include "netcam_rtsp.h" + #include "rotate.h" /* already includes motion.h */ diff --git a/multimedia/motion/patches/patch-pwc-ioctl_h b/multimedia/motion/patches/patch-pwc-ioctl_h new file mode 100644 index 00000000000..e0410ed2b5a --- /dev/null +++ b/multimedia/motion/patches/patch-pwc-ioctl_h @@ -0,0 +1,22 @@ +$OpenBSD: patch-pwc-ioctl_h,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- pwc-ioctl.h.orig Wed Sep 10 03:53:41 2014 ++++ pwc-ioctl.h Fri Oct 10 11:37:35 2014 +@@ -61,6 +61,9 @@ + typedef __u16 __le16; + #endif + ++#else /* ( !BSD ) */ ++typedef u_int16_t __le16; ++typedef u_int8_t __u8; + #endif /* ( !BSD ) */ + + /* Enumeration of image sizes */ +@@ -309,7 +312,7 @@ struct pwc_table_init_buffer { + * use interface offer by v4l2. + */ + +-#if (defined(MOTION_V4L2)) && (!defined(BSD)) ++#if defined(MOTION_V4L2) + + #define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0) + #define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1) diff --git a/multimedia/motion/patches/patch-track_c b/multimedia/motion/patches/patch-track_c new file mode 100644 index 00000000000..eb43b2b8936 --- /dev/null +++ b/multimedia/motion/patches/patch-track_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-track_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- track.c.orig Wed Sep 10 03:53:41 2014 ++++ track.c Fri Oct 10 11:37:35 2014 +@@ -9,7 +9,7 @@ + #include + #include "motion.h" + +-#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L)) ++#if (defined(HAVE_LINUX_VIDEODEV_H) || defined(HAVE_SYS_VIDEOIO_H)) && (!defined(WITHOUT_V4L)) + #include "pwc-ioctl.h" + #endif + diff --git a/multimedia/motion/patches/patch-video2_c b/multimedia/motion/patches/patch-video2_c new file mode 100644 index 00000000000..d72d1f8416c --- /dev/null +++ b/multimedia/motion/patches/patch-video2_c @@ -0,0 +1,12 @@ +$OpenBSD: patch-video2_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- video2.c.orig Fri Oct 10 12:47:52 2014 ++++ video2.c Fri Oct 10 12:48:03 2014 +@@ -179,7 +179,7 @@ typedef struct { + /** + * xioctl + */ +-static int xioctl(int fd, int request, void *arg) ++static int xioctl(int fd, unsigned long request, void *arg) + { + int ret; + diff --git a/multimedia/motion/patches/patch-video_h b/multimedia/motion/patches/patch-video_h new file mode 100644 index 00000000000..42cad67065a --- /dev/null +++ b/multimedia/motion/patches/patch-video_h @@ -0,0 +1,17 @@ +$OpenBSD: patch-video_h,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +--- video.h.orig Wed Sep 10 03:53:41 2014 ++++ video.h Fri Oct 10 11:37:35 2014 +@@ -14,8 +14,12 @@ + #include + + +-#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L)) ++#if !defined(WITHOUT_V4L) ++#if defined(HAVE_LINUX_VIDEODEV_H) + #include ++#elif defined(HAVE_SYS_VIDEOIO_H) ++#include ++#endif + #include "vloopback_motion.h" + #include "pwc-ioctl.h" + #endif diff --git a/multimedia/motion/pkg/DESCR b/multimedia/motion/pkg/DESCR new file mode 100644 index 00000000000..9510c778557 --- /dev/null +++ b/multimedia/motion/pkg/DESCR @@ -0,0 +1,15 @@ +Motion is a C program that monitors the video signal from one or +more V4L2/video(4) cameras or network-based webcams, and is able to +detect if a significant part of the picture has changed. Or in +other words, it can detect motion. + +Motion is a command line based tool. It has absolutely no graphical +user interface. Everything is setup either via the command line or +via a set of configuration files (simple ASCII files that can be +edited by any ASCII editor). + +Motion can output JPEG/PPM images and MPEG video sequences, call +external programs, log to a database, etc. + +Motion hasn't had an official release for some time; at present, +this package uses the forked code at https://github.com/Mr-Dave/motion/ diff --git a/multimedia/motion/pkg/PLIST b/multimedia/motion/pkg/PLIST new file mode 100644 index 00000000000..49ad7eb6831 --- /dev/null +++ b/multimedia/motion/pkg/PLIST @@ -0,0 +1,23 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ +@newgroup _motion:704 +@newuser _motion:704:_motion:daemon:motion user:/nonexistent:/sbin/nologin +@bin bin/motion +@man man/man1/motion.1 +share/doc/motion/ +share/doc/motion/CHANGELOG +share/doc/motion/COPYING +share/doc/motion/CREDITS +share/doc/motion/INSTALL +share/doc/motion/README +share/doc/motion/motion_guide.html +share/examples/motion/ +share/examples/motion/motion-dist.conf +@sample ${SYSCONFDIR}/motion.conf +@comment share/examples/motion/motion.init-Debian +@comment share/examples/motion/motion.init-Fedora +@comment share/examples/motion/motion.init-FreeBSD.sh +share/examples/motion/thread1.conf +share/examples/motion/thread2.conf +share/examples/motion/thread3.conf +share/examples/motion/thread4.conf +@rcscript ${RCDIR}/motion diff --git a/multimedia/motion/pkg/motion.rc b/multimedia/motion/pkg/motion.rc new file mode 100644 index 00000000000..15082c09988 --- /dev/null +++ b/multimedia/motion/pkg/motion.rc @@ -0,0 +1,14 @@ +#!/bin/sh +# +# $OpenBSD: motion.rc,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $ + +daemon="${TRUEPREFIX}/bin/motion" +daemon_user="_motion" + +. /etc/rc.d/rc.subr + +rc_pre() { + install -d -o _motion /var/run/motion +} + +rc_cmd $1