summaryrefslogtreecommitdiff
path: root/security/zoneminder
diff options
context:
space:
mode:
authordsainty <dsainty@pkgsrc.org>2013-03-15 02:01:46 +0000
committerdsainty <dsainty@pkgsrc.org>2013-03-15 02:01:46 +0000
commit7b999a73a6ece307e9b4d0b69ae12f5e9293607d (patch)
treee0ce89ce2870dc2db84ebf1b44aa2a2c01a381e9 /security/zoneminder
parent8ba70d7b3ec1cdd5f29e0a208fd430534674a188 (diff)
downloadpkgsrc-7b999a73a6ece307e9b4d0b69ae12f5e9293607d.tar.gz
ZoneMinder version 1.25.0:
ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child, family member or home monitoring and other domestic care scenarios such as nanny cam installations. It supports capture, analysis, recording, and monitoring of video data coming from one or more video or network cameras attached to a system. ZoneMinder also support web and semi-automatic control of Pan/Tilt/Zoom cameras using a variety of protocols. It is suitable for use as a DIY home video security system and for commercial or professional video security and surveillance. It can also be integrated into a home automation system via X.10 or other protocols.
Diffstat (limited to 'security/zoneminder')
-rw-r--r--security/zoneminder/DESCR10
-rw-r--r--security/zoneminder/Makefile195
-rw-r--r--security/zoneminder/PLIST300
-rw-r--r--security/zoneminder/distinfo18
-rw-r--r--security/zoneminder/files/zoneminder.conf18
-rw-r--r--security/zoneminder/patches/patch-Makefile_am27
-rw-r--r--security/zoneminder/patches/patch-configure_ac128
-rw-r--r--security/zoneminder/patches/patch-scripts_zm_in51
-rw-r--r--security/zoneminder/patches/patch-src_Makefile_am18
-rw-r--r--security/zoneminder/patches/patch-src_zm_comms_cpp16
-rw-r--r--security/zoneminder/patches/patch-src_zm_comms_h24
-rw-r--r--security/zoneminder/patches/patch-src_zm_logger_cpp16
-rw-r--r--security/zoneminder/patches/patch-src_zm_remote_camera_h15
-rw-r--r--security/zoneminder/patches/patch-src_zm_signal_h14
-rw-r--r--security/zoneminder/patches/patch-src_zm_thread_cpp23
-rw-r--r--security/zoneminder/patches/patch-src_zmc_cpp25
-rw-r--r--security/zoneminder/patches/patch-src_zmf_cpp89
-rw-r--r--security/zoneminder/patches/patch-web_ajax_stream_php15
18 files changed, 1002 insertions, 0 deletions
diff --git a/security/zoneminder/DESCR b/security/zoneminder/DESCR
new file mode 100644
index 00000000000..55951b15566
--- /dev/null
+++ b/security/zoneminder/DESCR
@@ -0,0 +1,10 @@
+ZoneMinder is intended for use in single or multi-camera video security
+applications, including commercial or home CCTV, theft prevention and child,
+family member or home monitoring and other domestic care scenarios such as
+nanny cam installations. It supports capture, analysis, recording, and
+monitoring of video data coming from one or more video or network cameras
+attached to a system. ZoneMinder also support web and semi-automatic control
+of Pan/Tilt/Zoom cameras using a variety of protocols. It is suitable for use
+as a DIY home video security system and for commercial or professional video
+security and surveillance. It can also be integrated into a home automation
+system via X.10 or other protocols.
diff --git a/security/zoneminder/Makefile b/security/zoneminder/Makefile
new file mode 100644
index 00000000000..932cdc77893
--- /dev/null
+++ b/security/zoneminder/Makefile
@@ -0,0 +1,195 @@
+# $NetBSD: Makefile,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+#
+
+DISTNAME= ZoneMinder-1.25.0
+PKGNAME= ${DISTNAME:S/ZoneMinder-/zoneminder-/}
+CATEGORIES= security
+MASTER_SITES= http://www2.zoneminder.com/downloads/
+
+MAINTAINER= dsainty@NetBSD.org
+HOMEPAGE= http://www.zoneminder.com/
+COMMENT= Video camera security and surveillance solution
+LICENSE= gnu-gpl-v2
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.zoneminder
+PKG_SUPPORTED_OPTIONS= apache
+PKG_SUGGESTED_OPTIONS= apache
+
+.include "../../mk/bsd.options.mk"
+
+GNU_CONFIGURE= yes
+USE_LANGUAGES= c c++
+USE_TOOLS+= aclocal autoconf autoheader automake gmake perl
+
+# MIME::Entity is needed from p5-MIME-tools
+# LWP::UserAgent is needed from p5-libwww
+DEPENDS+= p5-Archive-Zip-[0-9]*:../../archivers/p5-Archive-Zip
+DEPENDS+= p5-Date-Manip-[0-9]*:../../devel/p5-Date-Manip
+DEPENDS+= p5-Device-SerialPort-[0-9]*:../../comms/p5-Device-SerialPort
+DEPENDS+= p5-DBD-mysql-[0-9]*:../../databases/p5-DBD-mysql
+DEPENDS+= p5-MIME-Lite-[0-9]*:../../mail/p5-MIME-Lite
+DEPENDS+= p5-MIME-tools-[0-9]*:../../mail/p5-MIME-tools
+DEPENDS+= p5-PHP-Serialization-[0-9]*:../../devel/p5-PHP-Serialization
+DEPENDS+= p5-Time-HiRes-[0-9]*:../../time/p5-Time-HiRes
+DEPENDS+= p5-libwww-[0-9]*:../../www/p5-libwww
+
+CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
+
+ZM_HTTPD_ROOT= share/zoneminder/htdocs
+PLIST_SUBST+= ZM_HTTPD_ROOT=${ZM_HTTPD_ROOT:Q}
+OWN_DIRS+= ${ZM_HTTPD_ROOT:Q}
+
+ZM_HTTPD_CGIBIN= libexec/zoneminder/cgi-bin
+PLIST_SUBST+= ZM_HTTPD_CGIBIN=${ZM_HTTPD_CGIBIN:Q}
+BUILD_DEFS+= ZM_HTTPD_CGIBIN
+OWN_DIRS+= ${ZM_HTTPD_CGIBIN:Q}
+
+INSTALLATION_DIRS+= share/zoneminder ${ZM_HTTPD_ROOT}
+INSTALLATION_DIRS+= libexec/zoneminder ${ZM_HTTPD_CGIBIN}
+
+BUILD_DEFS+= VARBASE
+CONFIGURE_ARGS+= --with-webdir=${PREFIX}/${ZM_HTTPD_ROOT:Q}
+CONFIGURE_ARGS+= --with-cgidir=${PREFIX}/${ZM_HTTPD_CGIBIN:Q}
+CONFIGURE_ARGS+= --with-mysql=${BUILDLINK_PREFIX.mysql-client}
+CONFIGURE_ARGS+= --localstatedir=${VARBASE}
+
+CONFIGURE_ENV+= OPT_NETPBM=yes
+CONFIGURE_ENV+= PATH_NETPBM=${PREFIX}/bin/pnmscale
+
+.include "../../multimedia/ffmpeg010/buildlink3.mk"
+CONFIGURE_ARGS+= --with-ffmpeg=${BUILDLINK_PREFIX.ffmpeg010}
+CONFIGURE_ENV+= PATH_FFMPEG=${BUILDLINK_PREFIX.ffmpeg010}/bin/ffmpeg010
+CONFIGURE_ENV+= OPT_FFMPEG=yes
+
+# The backtrace requires Linux's unportable <execinfo.h> header.
+CONFIGURE_ARGS+= --enable-crashtrace=no
+
+# Need Perl Sys::Mmap module for (default) mmap support.
+CONFIGURE_ARGS+= --enable-mmap=no
+
+# This is somewhat awkward. ffmpeg's libavformat/avformat.h requires
+# constant macros from stdint.h, but these are only defined under C++ if
+# __STDC_CONSTANT_MACROS is requested, so we have to do that on behalf
+# of ffmpeg. Failure to do so causes configure time failures, and
+# build failures complaining about UINT64_C not being defined.
+CFLAGS+= -D__STDC_CONSTANT_MACROS
+
+# Since MySQL uses openssl, use the same library instead of defaulting to
+# gnutls.
+CONFIGURE_ENV+= ZM_SSL_LIB=openssl
+
+# Control where run-time state (PID file) gets stored.
+CONFIGURE_ENV+= ZM_RUNDIR=${VARBASE}/run
+
+.if !empty(PKG_OPTIONS:Mapache)
+.include "../../mk/apache.mk"
+
+PKG_USERS_VARS+= APACHE_USER
+PKG_GROUPS_VARS+= APACHE_GROUP
+BUILD_DEFS+= APACHE_USER APACHE_GROUP
+
+# This directory contains no useful state, so use MAKE_DIRS instead of
+# OWN_DIRS.
+MAKE_DIRS_PERMS+= ${VARBASE}/run/zm ${ROOT_USER} ${APACHE_GROUP} 775
+
+CONFIGURE_ARGS+= --with-webuser=${APACHE_USER}
+CONFIGURE_ARGS+= --with-webgroup=${APACHE_GROUP}
+
+# If we're using Apache we're going to need PHP, and PHP MySQL support.
+.include "../../lang/php/phpversion.mk"
+DEPENDS+= ${APACHE_PKG_PREFIX}-${PHP_PKG_PREFIX}-[0-9]*:../../www/ap-php
+DEPENDS+= ${PHP_PKG_PREFIX}-mysql-[0-9]*:../../databases/php-mysql
+.endif
+
+# This directory contains state, so use OWN_DIRS instead of MAKE_DIRS.
+ZM_CACHE= ${VARBASE}/cache/zoneminder
+OWN_DIRS_PERMS+= ${ZM_CACHE} ${ROOT_USER} ${ROOT_GROUP} 755
+OWN_DIRS_PERMS+= ${ZM_CACHE}/temp ${ROOT_USER} ${APACHE_GROUP} 775
+OWN_DIRS_PERMS+= ${ZM_CACHE}/images ${ROOT_USER} ${APACHE_GROUP} 775
+OWN_DIRS_PERMS+= ${ZM_CACHE}/events ${ROOT_USER} ${APACHE_GROUP} 775
+
+REPLACE_PERL+= scripts/zmaudit.pl.in
+REPLACE_PERL+= scripts/zmcontrol.pl.in
+REPLACE_PERL+= scripts/zmdc.pl.in
+REPLACE_PERL+= scripts/zmfilter.pl.in
+REPLACE_PERL+= scripts/zmpkg.pl.in
+REPLACE_PERL+= scripts/zmtrack.pl.in
+REPLACE_PERL+= scripts/zmtrigger.pl.in
+REPLACE_PERL+= scripts/zmupdate.pl.in
+REPLACE_PERL+= scripts/zmvideo.pl.in
+REPLACE_PERL+= scripts/zmwatch.pl.in
+REPLACE_PERL+= scripts/zmx10.pl.in
+
+SUBST_CLASSES+= dbpaths-path
+SUBST_MESSAGE.dbpaths-path= Adjusting default paths in configuration.
+SUBST_STAGE.dbpaths-path= pre-configure
+SUBST_FILES.dbpaths-path= db/zm_create.sql.in
+SUBST_SED.dbpaths-path= -e 's|/usr/local/bin/|${PREFIX}/bin/|g'
+SUBST_SED.dbpaths-path+= -e 's|/usr/bin|${PREFIX}/bin|g'
+SUBST_SED.dbpaths-path+= -e 's|/cgi-bin/nph-zms|/zm/cgi-bin/nph-zms|g'
+
+# Required to find the 'mysql' client executable.
+SUBST_CLASSES+= script-path
+SUBST_MESSAGE.script-path= Adjusting paths in scripts.
+SUBST_STAGE.script-path= pre-configure
+SUBST_FILES.script-path= scripts/zmupdate.pl.in
+SUBST_SED.script-path= -e 's|/usr/local/bin|${PREFIX}/bin|g'
+
+SUBST_CLASSES+= files
+SUBST_STAGE.files= pre-configure
+SUBST_FILES.files= zoneminder.conf
+SUBST_SED.files= -e "s|@ZM_HTTPD_ROOT@|${PREFIX}/${ZM_HTTPD_ROOT}|g"
+SUBST_SED.files+= -e "s|@ZM_HTTPD_CGIBIN@|${PREFIX}/${ZM_HTTPD_CGIBIN}|g"
+SUBST_MESSAGE.files= Fixing ZoneMinder configuration file for Apache.
+
+post-extract:
+ ${CP} ${FILESDIR}/zoneminder.conf ${WRKSRC}/zoneminder.conf
+
+pre-configure:
+ set -e; cd ${WRKSRC}; \
+ aclocal; autoheader; automake -a --foreign -i; autoconf
+
+#
+# Arrange for module.mk to perform its magic here on top of the non-Perl
+# build tasks.
+#
+PERL5_REQD+= 5.6.0
+PERL5_CONFIGURE= no
+PERL5_CONFIGURE_DIRS= ${WRKSRC}/scripts/ZoneMinder
+PERL5_PACKLIST= auto/ZoneMinder/.packlist
+.include "../../lang/perl5/module.mk"
+
+post-configure: perl5-configure
+
+EGDIR= share/examples/${PKGBASE}
+INSTALLATION_DIRS+= ${EGDIR} ${EGDIR}/config ${EGDIR}/apache
+CONF_FILES+= ${PREFIX}/${EGDIR}/config/zm.conf ${PKG_SYSCONFDIR}/zm.conf
+INSTALLATION_DIRS+= bin share/examples/rc.d share/zoneminder/db
+post-install:
+ ${INSTALL_DATA} ${WRKSRC}/zoneminder.conf ${DESTDIR}${PREFIX}/${EGDIR}/apache/zoneminder.conf
+ ${INSTALL_DATA} ${WRKSRC}/zm.conf ${DESTDIR}${PREFIX}/${EGDIR}/config/zm.conf
+ ${INSTALL_SCRIPT} ${WRKSRC}/scripts/zm ${DESTDIR}${PREFIX}/share/examples/rc.d/zoneminder
+ ${INSTALL_DATA} ${WRKSRC}/db/*.sql ${DESTDIR}${PREFIX}/share/zoneminder/db/
+ rmdir ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/temp
+ rmdir ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/events
+ rmdir ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/images
+ ${LN} -s ${ZM_CACHE}/temp ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/temp
+ ${LN} -s ${ZM_CACHE}/events ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/events
+ ${LN} -s ${ZM_CACHE}/images ${DESTDIR}${PREFIX}/${ZM_HTTPD_ROOT:Q}/images
+
+
+#DL_AUTO_VARS= yes
+.include "../../mk/dlopen.buildlink3.mk"
+
+.include "../../mk/jpeg.buildlink3.mk"
+.include "../../mk/mysql.buildlink3.mk"
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../archivers/bzip2/buildlink3.mk"
+.include "../../devel/pcre/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+#.include "../../graphics/libv4l/buildlink3.mk"
+.include "../../graphics/netpbm/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/security/zoneminder/PLIST b/security/zoneminder/PLIST
new file mode 100644
index 00000000000..a520826c620
--- /dev/null
+++ b/security/zoneminder/PLIST
@@ -0,0 +1,300 @@
+@comment $NetBSD: PLIST,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+bin/zma
+bin/zmaudit.pl
+bin/zmc
+bin/zmcontrol.pl
+bin/zmdc.pl
+bin/zmf
+bin/zmfilter.pl
+bin/zmfix
+bin/zmpkg.pl
+bin/zmstreamer
+bin/zmtrack.pl
+bin/zmtrigger.pl
+bin/zmu
+bin/zmupdate.pl
+bin/zmvideo.pl
+bin/zmwatch.pl
+bin/zmx10.pl
+${ZM_HTTPD_CGIBIN}/nph-zms
+${ZM_HTTPD_CGIBIN}/zms
+share/examples/rc.d/zoneminder
+share/examples/zoneminder/apache/zoneminder.conf
+share/examples/zoneminder/config/zm.conf
+share/zoneminder/db/zm_create.sql
+share/zoneminder/db/zm_update-0.0.1.sql
+share/zoneminder/db/zm_update-0.9.10.sql
+share/zoneminder/db/zm_update-0.9.11.sql
+share/zoneminder/db/zm_update-0.9.12.sql
+share/zoneminder/db/zm_update-0.9.13.sql
+share/zoneminder/db/zm_update-0.9.15.sql
+share/zoneminder/db/zm_update-0.9.16.sql
+share/zoneminder/db/zm_update-0.9.7.sql
+share/zoneminder/db/zm_update-0.9.8.sql
+share/zoneminder/db/zm_update-0.9.9.sql
+share/zoneminder/db/zm_update-1.17.1.sql
+share/zoneminder/db/zm_update-1.17.2.sql
+share/zoneminder/db/zm_update-1.18.0.sql
+share/zoneminder/db/zm_update-1.18.1.sql
+share/zoneminder/db/zm_update-1.19.0.sql
+share/zoneminder/db/zm_update-1.19.1.sql
+share/zoneminder/db/zm_update-1.19.2.sql
+share/zoneminder/db/zm_update-1.19.3.sql
+share/zoneminder/db/zm_update-1.19.4.sql
+share/zoneminder/db/zm_update-1.19.5.sql
+share/zoneminder/db/zm_update-1.20.0.sql
+share/zoneminder/db/zm_update-1.20.1.sql
+share/zoneminder/db/zm_update-1.21.0.sql
+share/zoneminder/db/zm_update-1.21.1.sql
+share/zoneminder/db/zm_update-1.21.2.sql
+share/zoneminder/db/zm_update-1.21.3.sql
+share/zoneminder/db/zm_update-1.21.4.sql
+share/zoneminder/db/zm_update-1.22.0.sql
+share/zoneminder/db/zm_update-1.22.1.sql
+share/zoneminder/db/zm_update-1.22.2.sql
+share/zoneminder/db/zm_update-1.22.3.sql
+share/zoneminder/db/zm_update-1.23.0.sql
+share/zoneminder/db/zm_update-1.23.1.sql
+share/zoneminder/db/zm_update-1.23.2.sql
+share/zoneminder/db/zm_update-1.23.3.sql
+share/zoneminder/db/zm_update-1.24.0.sql
+share/zoneminder/db/zm_update-1.24.1.sql
+share/zoneminder/db/zm_update-1.24.2.sql
+share/zoneminder/db/zm_update-1.24.3.sql
+share/zoneminder/db/zm_update-1.24.4.sql
+${ZM_HTTPD_ROOT}/ajax/alarm.php
+${ZM_HTTPD_ROOT}/ajax/control.php
+${ZM_HTTPD_ROOT}/ajax/event.php
+${ZM_HTTPD_ROOT}/ajax/log.php
+${ZM_HTTPD_ROOT}/ajax/status.php
+${ZM_HTTPD_ROOT}/ajax/stream.php
+${ZM_HTTPD_ROOT}/ajax/zone.php
+${ZM_HTTPD_ROOT}/css/overlay.css
+${ZM_HTTPD_ROOT}/css/reset.css
+${ZM_HTTPD_ROOT}/css/spinner.css
+${ZM_HTTPD_ROOT}/events
+${ZM_HTTPD_ROOT}/graphics/favicon.ico
+${ZM_HTTPD_ROOT}/graphics/spinner.gif
+${ZM_HTTPD_ROOT}/graphics/transparent.gif
+${ZM_HTTPD_ROOT}/images
+${ZM_HTTPD_ROOT}/includes/actions.php
+${ZM_HTTPD_ROOT}/includes/config.php
+${ZM_HTTPD_ROOT}/includes/control_functions.php
+${ZM_HTTPD_ROOT}/includes/database.php
+${ZM_HTTPD_ROOT}/includes/functions.php
+${ZM_HTTPD_ROOT}/includes/lang.php
+${ZM_HTTPD_ROOT}/includes/logger.php
+${ZM_HTTPD_ROOT}/index.php
+${ZM_HTTPD_ROOT}/js/logger.js
+${ZM_HTTPD_ROOT}/js/mootools.ext.js
+${ZM_HTTPD_ROOT}/js/overlay.js
+${ZM_HTTPD_ROOT}/lang/big5_big5.php
+${ZM_HTTPD_ROOT}/lang/cn_zh.php
+${ZM_HTTPD_ROOT}/lang/cs_cz.php
+${ZM_HTTPD_ROOT}/lang/de_de.php
+${ZM_HTTPD_ROOT}/lang/dk_dk.php
+${ZM_HTTPD_ROOT}/lang/en_gb.php
+${ZM_HTTPD_ROOT}/lang/en_us.php
+${ZM_HTTPD_ROOT}/lang/es_ar.php
+${ZM_HTTPD_ROOT}/lang/et_ee.php
+${ZM_HTTPD_ROOT}/lang/fr_fr.php
+${ZM_HTTPD_ROOT}/lang/he_il.php
+${ZM_HTTPD_ROOT}/lang/hu_hu.php
+${ZM_HTTPD_ROOT}/lang/it_it.php
+${ZM_HTTPD_ROOT}/lang/ja_jp.php
+${ZM_HTTPD_ROOT}/lang/nl_nl.php
+${ZM_HTTPD_ROOT}/lang/pl_pl.php
+${ZM_HTTPD_ROOT}/lang/pt_br.php
+${ZM_HTTPD_ROOT}/lang/ro_ro.php
+${ZM_HTTPD_ROOT}/lang/ru_ru.php
+${ZM_HTTPD_ROOT}/lang/se_se.php
+${ZM_HTTPD_ROOT}/skins/classic/css/control.css
+${ZM_HTTPD_ROOT}/skins/classic/css/export.css
+${ZM_HTTPD_ROOT}/skins/classic/css/skin.css
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-d.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-dl.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-dr.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-l-d.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-l-u.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-l.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-r.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-s-d.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-s-u.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-u.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-ul.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/arrow-ur.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/center.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/point-g.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/point-o.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/point-r.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/seq-d.gif
+${ZM_HTTPD_ROOT}/skins/classic/graphics/seq-u.gif
+${ZM_HTTPD_ROOT}/skins/classic/includes/config.php
+${ZM_HTTPD_ROOT}/skins/classic/includes/control_functions.php
+${ZM_HTTPD_ROOT}/skins/classic/includes/export_functions.php
+${ZM_HTTPD_ROOT}/skins/classic/includes/functions.php
+${ZM_HTTPD_ROOT}/skins/classic/includes/init.php
+${ZM_HTTPD_ROOT}/skins/classic/includes/timeline_functions.php
+${ZM_HTTPD_ROOT}/skins/classic/js/skin.js
+${ZM_HTTPD_ROOT}/skins/classic/js/skin.js.php
+${ZM_HTTPD_ROOT}/skins/classic/skin.php
+${ZM_HTTPD_ROOT}/skins/classic/views/Makefile.am
+${ZM_HTTPD_ROOT}/skins/classic/views/bandwidth.php
+${ZM_HTTPD_ROOT}/skins/classic/views/blank.php
+${ZM_HTTPD_ROOT}/skins/classic/views/console.php
+${ZM_HTTPD_ROOT}/skins/classic/views/control.php
+${ZM_HTTPD_ROOT}/skins/classic/views/controlcap.php
+${ZM_HTTPD_ROOT}/skins/classic/views/controlcaps.php
+${ZM_HTTPD_ROOT}/skins/classic/views/controlpreset.php
+${ZM_HTTPD_ROOT}/skins/classic/views/css/console.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/control.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/controlcaps.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/devices.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/event.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/events.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/export.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/filter.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/frame.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/frames.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/groups.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/log.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/monitor.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/montage.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/montage_2wide.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/montage_3wide.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/montage_3wide50enlarge.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/montage_4wide.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/montage_freeform.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/options.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/stats.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/timeline.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/timeline.css.php
+${ZM_HTTPD_ROOT}/skins/classic/views/css/video.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/watch.css
+${ZM_HTTPD_ROOT}/skins/classic/views/css/zone.css
+${ZM_HTTPD_ROOT}/skins/classic/views/cycle.php
+${ZM_HTTPD_ROOT}/skins/classic/views/device.php
+${ZM_HTTPD_ROOT}/skins/classic/views/devices.php
+${ZM_HTTPD_ROOT}/skins/classic/views/donate.php
+${ZM_HTTPD_ROOT}/skins/classic/views/error.php
+${ZM_HTTPD_ROOT}/skins/classic/views/event.php
+${ZM_HTTPD_ROOT}/skins/classic/views/eventdetail.php
+${ZM_HTTPD_ROOT}/skins/classic/views/events.php
+${ZM_HTTPD_ROOT}/skins/classic/views/export.php
+${ZM_HTTPD_ROOT}/skins/classic/views/filter.php
+${ZM_HTTPD_ROOT}/skins/classic/views/filtersave.php
+${ZM_HTTPD_ROOT}/skins/classic/views/frame.php
+${ZM_HTTPD_ROOT}/skins/classic/views/frames.php
+${ZM_HTTPD_ROOT}/skins/classic/views/function.php
+${ZM_HTTPD_ROOT}/skins/classic/views/group.php
+${ZM_HTTPD_ROOT}/skins/classic/views/groups.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/Makefile.am
+${ZM_HTTPD_ROOT}/skins/classic/views/js/console.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/console.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/control.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/controlpreset.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/controlpreset.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/cycle.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/cycle.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/devices.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/donate.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/donate.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/event.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/event.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/events.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/events.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/export.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/export.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/filter.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/filter.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/group.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/groups.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/log.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/login.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/monitor.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/monitor.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/monitorpreset.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/monitorprobe.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/montage.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/montage.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/options.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/postlogin.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/state.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/state.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/timeline.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/timeline.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/user.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/version.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/version.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/video.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/video.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/watch.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/watch.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/js/zone.js
+${ZM_HTTPD_ROOT}/skins/classic/views/js/zone.js.php
+${ZM_HTTPD_ROOT}/skins/classic/views/log.php
+${ZM_HTTPD_ROOT}/skins/classic/views/login.php
+${ZM_HTTPD_ROOT}/skins/classic/views/logout.php
+${ZM_HTTPD_ROOT}/skins/classic/views/monitor.php
+${ZM_HTTPD_ROOT}/skins/classic/views/monitorpreset.php
+${ZM_HTTPD_ROOT}/skins/classic/views/monitorprobe.php
+${ZM_HTTPD_ROOT}/skins/classic/views/montage.php
+${ZM_HTTPD_ROOT}/skins/classic/views/none.php
+${ZM_HTTPD_ROOT}/skins/classic/views/optionhelp.php
+${ZM_HTTPD_ROOT}/skins/classic/views/options.php
+${ZM_HTTPD_ROOT}/skins/classic/views/postlogin.php
+${ZM_HTTPD_ROOT}/skins/classic/views/settings.php
+${ZM_HTTPD_ROOT}/skins/classic/views/state.php
+${ZM_HTTPD_ROOT}/skins/classic/views/stats.php
+${ZM_HTTPD_ROOT}/skins/classic/views/status.php
+${ZM_HTTPD_ROOT}/skins/classic/views/timeline.php
+${ZM_HTTPD_ROOT}/skins/classic/views/user.php
+${ZM_HTTPD_ROOT}/skins/classic/views/version.php
+${ZM_HTTPD_ROOT}/skins/classic/views/video.php
+${ZM_HTTPD_ROOT}/skins/classic/views/watch.php
+${ZM_HTTPD_ROOT}/skins/classic/views/zone.php
+${ZM_HTTPD_ROOT}/skins/classic/views/zones.php
+${ZM_HTTPD_ROOT}/skins/mobile/css/skin.css
+${ZM_HTTPD_ROOT}/skins/mobile/includes/config.php
+${ZM_HTTPD_ROOT}/skins/mobile/includes/control_functions.php
+${ZM_HTTPD_ROOT}/skins/mobile/includes/functions.php
+${ZM_HTTPD_ROOT}/skins/mobile/includes/init.php
+${ZM_HTTPD_ROOT}/skins/mobile/skin.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/console.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/css/console.css
+${ZM_HTTPD_ROOT}/skins/mobile/views/devices.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/error.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/event.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/eventdetails.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/events.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/filter.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/frame.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/function.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/login.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/montage.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/state.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/video.php
+${ZM_HTTPD_ROOT}/skins/mobile/views/watch.php
+${ZM_HTTPD_ROOT}/skins/xml/includes/config.php
+${ZM_HTTPD_ROOT}/skins/xml/includes/functions.php
+${ZM_HTTPD_ROOT}/skins/xml/includes/init.php
+${ZM_HTTPD_ROOT}/skins/xml/skin.php
+${ZM_HTTPD_ROOT}/skins/xml/views/actions.php
+${ZM_HTTPD_ROOT}/skins/xml/views/console.php
+${ZM_HTTPD_ROOT}/skins/xml/views/none.php
+${ZM_HTTPD_ROOT}/skins/xml/views/notfound.png
+${ZM_HTTPD_ROOT}/temp
+${ZM_HTTPD_ROOT}/tools/mootools/mootools-core-1.3.2-nc.js
+${ZM_HTTPD_ROOT}/tools/mootools/mootools-core-1.3.2-yc.js
+${ZM_HTTPD_ROOT}/tools/mootools/mootools-core.js
+${ZM_HTTPD_ROOT}/tools/mootools/mootools-more-1.3.2.1-nc.js
+${ZM_HTTPD_ROOT}/tools/mootools/mootools-more-1.3.2.1-yc.js
+${ZM_HTTPD_ROOT}/tools/mootools/mootools-more.js
+${ZM_HTTPD_ROOT}/views/file.php
+${ZM_HTTPD_ROOT}/views/image.php
+@pkgdir ${ZM_HTTPD_ROOT}/sounds
+@pkgdir ${ZM_HTTPD_ROOT}/skins/mobile/lang
+@pkgdir ${ZM_HTTPD_ROOT}/skins/mobile/graphics
+@pkgdir ${ZM_HTTPD_ROOT}/skins/mobile/ajax
+@pkgdir ${ZM_HTTPD_ROOT}/skins/classic/lang
+@pkgdir ${ZM_HTTPD_ROOT}/skins/classic/ajax
diff --git a/security/zoneminder/distinfo b/security/zoneminder/distinfo
new file mode 100644
index 00000000000..1d3291b1c38
--- /dev/null
+++ b/security/zoneminder/distinfo
@@ -0,0 +1,18 @@
+$NetBSD: distinfo,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+SHA1 (ZoneMinder-1.25.0.tar.gz) = a93a976a5cd82f1e197f4d7bd626d3f0387c4231
+RMD160 (ZoneMinder-1.25.0.tar.gz) = 32a4f503770103e55bfe592864c1cab82e7395a6
+Size (ZoneMinder-1.25.0.tar.gz) = 1119091 bytes
+SHA1 (patch-Makefile_am) = a66d11a5743a945801bec23c0611e1ec34b9e207
+SHA1 (patch-configure_ac) = 5f839d3f619096f843620079f491393d74d751ad
+SHA1 (patch-scripts_zm_in) = e8dd80bb6d00f17199a0e44d0b6490567bc005eb
+SHA1 (patch-src_Makefile_am) = 54ed8c43b964cc549ee6b78a569de552f617f5a7
+SHA1 (patch-src_zm_comms_cpp) = 8b786fa7c0a61ce94b9310df4ff14b4daec785c8
+SHA1 (patch-src_zm_comms_h) = 3436a563a8c1fedfca6daa325c017b9d2ed22f21
+SHA1 (patch-src_zm_logger_cpp) = 486f9ae99623ed4a8b20ddc0543f83217d85805d
+SHA1 (patch-src_zm_remote_camera_h) = b02a58a2422007aa6ab23338d4ffa9bb7679f165
+SHA1 (patch-src_zm_signal_h) = c40fb8c3265e042771058794c2f13f7a519a7390
+SHA1 (patch-src_zm_thread_cpp) = f1957ab1ea7bc80a1f8c2c129fddb7e4b541b87b
+SHA1 (patch-src_zmc_cpp) = bf8e745ceda9dc61c2d11c92e2ea9a9eb242a3b6
+SHA1 (patch-src_zmf_cpp) = 23707dd6493b11fd2b79dcbf9e09598ce286c07f
+SHA1 (patch-web_ajax_stream_php) = a3be6ae58c98c90807c764937ffe0f9a782a9de2
diff --git a/security/zoneminder/files/zoneminder.conf b/security/zoneminder/files/zoneminder.conf
new file mode 100644
index 00000000000..bd47180953a
--- /dev/null
+++ b/security/zoneminder/files/zoneminder.conf
@@ -0,0 +1,18 @@
+# This Apache configuration puts ZoneMinder under /zm.
+
+ScriptAlias /zm/cgi-bin/ "@ZM_HTTPD_CGIBIN@/"
+
+<Directory "@ZM_HTTPD_CGIBIN@">
+ Order allow,deny
+ Allow from all
+</Directory>
+
+Alias /zm "@ZM_HTTPD_ROOT@"
+
+<Directory "@ZM_HTTPD_ROOT@">
+ php_flag register_globals off
+ php_flag short_open_tag on
+ DirectoryIndex index.php
+ Order allow,deny
+ Allow from all
+</Directory>
diff --git a/security/zoneminder/patches/patch-Makefile_am b/security/zoneminder/patches/patch-Makefile_am
new file mode 100644
index 00000000000..2160ebdee65
--- /dev/null
+++ b/security/zoneminder/patches/patch-Makefile_am
@@ -0,0 +1,27 @@
+$NetBSD: patch-Makefile_am,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Disable the hacks around ownership setup so Pkgsrc can take responsibility.
+Don't install zm.conf at all - let Pkgsrc install it into EGDIR.
+
+--- Makefile.am.orig 2009-03-21 01:07:10.000000000 +1300
++++ Makefile.am 2010-11-23 00:34:37.003586001 +1300
+@@ -4,8 +4,8 @@
+ webuser = @WEB_USER@
+ webgroup = @WEB_GROUP@
+
+-sysconf_DATA = \
+- zm.conf
++#sysconf_DATA = \
++# zm.conf
+
+ SUBDIRS = \
+ src \
+@@ -19,7 +19,7 @@
+ zmconfgen.pl.in
+
+ # Yes, you are correct. This is a HACK!
+-install-data-hook:
++pkgsrc-disabled-install-data-hook:
+ ( cd $(DESTDIR)$(sysconfdir); chown $(webuser):$(webgroup) $(sysconf_DATA); chmod 600 $(sysconf_DATA) )
+ ( if ! test -e $(ZM_RUNDIR); then mkdir -p $(ZM_RUNDIR); fi; if test "$(ZM_RUNDIR)" != "/var/run"; then chown $(webuser):$(webgroup) $(ZM_RUNDIR); chmod u+w $(ZM_RUNDIR); fi )
+ ( if ! test -e $(ZM_TMPDIR); then mkdir -m 700 -p $(ZM_TMPDIR); fi; if test "$(ZM_TMPDIR)" != "/tmp"; then chown $(webuser):$(webgroup) $(ZM_TMPDIR); chmod u+w $(ZM_TMPDIR); fi )
diff --git a/security/zoneminder/patches/patch-configure_ac b/security/zoneminder/patches/patch-configure_ac
new file mode 100644
index 00000000000..110bba0f50e
--- /dev/null
+++ b/security/zoneminder/patches/patch-configure_ac
@@ -0,0 +1,128 @@
+$NetBSD: patch-configure_ac,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Set PATH_BUILD to PREFIX/share/zoneminder, so that zmupdate.pl can locate the
+database build scripts as installed files, not out of a probably non-existent
+build directory. Correct shell syntax. Allow Pkgsrc to manage dlopen()
+support.
+
+--- configure.ac.orig 2011-08-24 03:10:32.000000000 +1200
++++ configure.ac 2013-02-13 14:09:57.143689856 +1300
+@@ -2,9 +2,9 @@
+ AC_INIT(zm,1.25.0,[http://www.zoneminder.com/forums/ - Please check FAQ first],ZoneMinder,http://www.zoneminder.com/downloads.html)
+ AM_INIT_AUTOMAKE
+ AC_CONFIG_SRCDIR(src/zm.h)
+-AM_CONFIG_HEADER(config.h)
++AC_CONFIG_HEADERS(config.h)
+
+-PATH_BUILD=`pwd`
++AC_DEFINE_DIR([DATA_ROOT_DIR],[datarootdir],[Expanded data directory])
+-AC_SUBST(PATH_BUILD)
++AC_SUBST(PATH_BUILD, "$DATA_ROOT_DIR/zoneminder")
+ TIME_BUILD=`date +'%s'`
+ AC_SUBST(TIME_BUILD)
+@@ -19,31 +19,31 @@
+ AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm])
+ AC_ARG_VAR(ZM_LOGDIR,[Location of generated log files, default /var/log/zm])
+
+-if test "$ZM_DB_HOST" == ""; then
++if test "$ZM_DB_HOST" = ""; then
+ AC_SUBST(ZM_DB_HOST,[localhost])
+ fi
+-if test "$ZM_DB_NAME" == ""; then
++if test "$ZM_DB_NAME" = ""; then
+ AC_SUBST(ZM_DB_NAME,[zm])
+ fi
+-if test "$ZM_DB_USER" == ""; then
++if test "$ZM_DB_USER" = ""; then
+ AC_SUBST(ZM_DB_USER,[zmuser])
+ fi
+-if test "$ZM_DB_PASS" == ""; then
++if test "$ZM_DB_PASS" = ""; then
+ AC_SUBST(ZM_DB_PASS,[zmpass])
+ fi
+-if test "$ZM_SSL_LIB" == ""; then
++if test "$ZM_SSL_LIB" = ""; then
+ AC_SUBST(ZM_SSL_LIB,gnutls)
+ fi
+-if test "$ZM_MYSQL_ENGINE" == ""; then
++if test "$ZM_MYSQL_ENGINE" = ""; then
+ AC_SUBST(ZM_MYSQL_ENGINE,MyISAM)
+ fi
+-if test "$ZM_RUNDIR" == ""; then
++if test "$ZM_RUNDIR" = ""; then
+ AC_SUBST(ZM_RUNDIR,[/var/run/zm])
+ fi
+-if test "$ZM_TMPDIR" == ""; then
++if test "$ZM_TMPDIR" = ""; then
+ AC_SUBST(ZM_TMPDIR,[/tmp/zm])
+ fi
+-if test "$ZM_LOGDIR" == ""; then
++if test "$ZM_LOGDIR" = ""; then
+ AC_SUBST(ZM_LOGDIR,[/var/log/zm])
+ fi
+
+@@ -203,7 +203,7 @@
+ filesystem which will normally be the case by default.
+ e.g. --enable-mmap=yes or --disable-mmap])
+ )
+-if test "$ENABLE_MMAP" == "yes"; then
++if test "$ENABLE_MMAP" = "yes"; then
+ AC_DEFINE(ZM_MEM_MAPPED,1,"Whether to use mapped rather than shared memory")
+ else
+ AC_DEFINE(ZM_MEM_MAPPED,0,"Whether to use mapped rather than shared memory")
+@@ -254,7 +254,7 @@
+ AC_PATH_PROG(PATH_FFMPEG,ffmpeg)
+ AC_CHECK_PROG(OPT_NETPBM,pnmscale,yes,no)
+ AC_PATH_PROG(PATH_NETPBM,pnmscale)
+-if test "$OPT_NETPBM" == "yes"; then
++if test "$OPT_NETPBM" = "yes"; then
+ PATH_NETPBM=`dirname $PATH_NETPBM`
+ fi
+
+@@ -262,8 +262,8 @@
+ AC_CHECK_LIB(mysqlclient,mysql_init,,AC_MSG_ERROR(zm requires libmysqlclient.a))
+ AC_CHECK_LIB(jpeg,jpeg_start_compress,,AC_MSG_ERROR(zm requires libjpeg.a))
+ AC_CHECK_LIB(pthread,pthread_create,,AC_MSG_ERROR(zm requires libpthread.a))
+-AC_CHECK_LIB(dl,dlsym,,AC_MSG_ERROR(zm requires libdl.a))
+-if test "$ZM_SSL_LIB" == "openssl"; then
++#AC_CHECK_LIB(dl,dlsym,,AC_MSG_ERROR(zm requires libdl.a))
++if test "$ZM_SSL_LIB" = "openssl"; then
+ AC_CHECK_LIB(crypto,MD5,,AC_MSG_WARN([libcrypto.a is required for authenticated streaming - use ZM_SSL_LIB option to select gnutls instead]))
+ else
+ AC_CHECK_HEADERS(gcrypt.h,,AC_MSG_WARN(zm requires libgcrypt headers to be installed for gnutls),)
+@@ -293,7 +293,7 @@
+ AC_CHECK_HEADERS(pthread.h,,,)
+ AC_CHECK_HEADERS(linux/videodev.h,AC_SUBST(ZM_HAS_V4L1,1),AC_SUBST(ZM_HAS_V4L1,0),)
+ AC_CHECK_HEADERS(linux/videodev2.h,AC_SUBST(ZM_HAS_V4L2,1),AC_SUBST(ZM_HAS_V4L2,0),)
+-if test "$ZM_HAS_V4L1" == "1" || test "$ZM_HAS_V4L2" == "1"; then
++if test "$ZM_HAS_V4L1" = "1" || test "$ZM_HAS_V4L2" = "1"; then
+ AC_SUBST(ZM_HAS_V4L,1)
+ else
+ AC_SUBST(ZM_HAS_V4L,0)
+@@ -307,7 +307,7 @@
+ AC_CHECK_HEADERS(libswscale/swscale.h,,,)
+ AC_CHECK_HEADERS(pcre/pcre.h,AC_SUBST(ZM_PCRE,"1"),,)
+ AC_CHECK_HEADERS(pcre.h,AC_SUBST(ZM_PCRE,"1"),,)
+-if test "$ENABLE_MMAP" == "yes"; then
++if test "$ENABLE_MMAP" = "yes"; then
+ AC_CHECK_HEADERS(sys/mman.h,,,)
+ AC_CHECK_HEADERS(fcntl.h,,,)
+ else
+@@ -317,7 +317,7 @@
+ AC_CHECK_HEADERS(zlib.h,,,)
+
+ AC_CHECK_DECLS(round,,,[#include <math.h>])
+-if test "$ZM_SSL_LIB" == "openssl"; then
++if test "$ZM_SSL_LIB" = "openssl"; then
+ AC_CHECK_DECLS(MD5,,AC_MSG_ERROR([zm requires openssl/md5.h - use ZM_SSL_LIB option to select gnutls instead]),[#include <stdlib.h>
+ #include <openssl/md5.h>])
+ else
+@@ -339,7 +339,7 @@
+ AC_PROG_PERL_MODULES(Date::Manip,,AC_MSG_ERROR(zm requires Date::Manip))
+ AC_PROG_PERL_MODULES(LWP::UserAgent,,AC_MSG_ERROR(zm requires LWP::UserAgent))
+ AC_PROG_PERL_MODULES(ExtUtils::MakeMaker,,AC_MSG_ERROR(zm requires ExtUtils::MakeMaker))
+-if test "$ENABLE_MMAP" == "yes"; then
++if test "$ENABLE_MMAP" = "yes"; then
+ AC_PROG_PERL_MODULES(Sys::Mmap,,AC_MSG_ERROR(zm requires Sys::Mmap for mapped memory - set --enable-mmap=no to use IPC shared memory instead))
+ fi
+
diff --git a/security/zoneminder/patches/patch-scripts_zm_in b/security/zoneminder/patches/patch-scripts_zm_in
new file mode 100644
index 00000000000..7a78342238a
--- /dev/null
+++ b/security/zoneminder/patches/patch-scripts_zm_in
@@ -0,0 +1,51 @@
+$NetBSD: patch-scripts_zm_in,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+/etc/rc.d/init.d/functions doesn't commonly exist.
+
+The LOCKFILE feature appears unused, and requires a /var/lock/subsys directory
+we don't have.
+
+--- scripts/zm.in.orig 2010-11-23 01:26:38.000000000 +1300
++++ scripts/zm.in 2010-11-23 01:26:46.000000000 +1300
+@@ -4,12 +4,12 @@
+ # processname: zmpkg.pl
+
+ # Source function library.
+-. /etc/rc.d/init.d/functions
++#. /etc/rc.d/init.d/functions
+
+ prog=ZoneMinder
+ ZM_CONFIG="@ZM_CONFIG@"
+ pidfile="@ZM_RUNDIR@"
+-LOCKFILE=/var/lock/subsys/zm
++#LOCKFILE=/var/lock/subsys/zm
+
+ loadconf()
+ {
+@@ -50,7 +50,7 @@
+ RETVAL=$?
+ [ $RETVAL = 0 ] && success || failure
+ echo
+- [ $RETVAL = 0 ] && touch $LOCKFILE
++ #[ $RETVAL = 0 ] && touch $LOCKFILE
+ return $RETVAL
+ }
+
+@@ -62,7 +62,7 @@
+ RETVAL=$?
+ [ $RETVAL = 0 ] && success || failure
+ echo
+- [ $RETVAL = 0 ] && rm -f $LOCKFILE
++ #[ $RETVAL = 0 ] && rm -f $LOCKFILE
+ }
+
+ zmstatus()
+@@ -103,7 +103,7 @@
+ result=`$ZM_PATH_BIN/zmdc.pl check`
+ if [ "$result" = "running" ]; then
+ $ZM_PATH_BIN/zmdc.pl shutdown > /dev/null
+- rm -f $LOCKFILE
++ #rm -f $LOCKFILE
+ start
+ fi
+ ;;
diff --git a/security/zoneminder/patches/patch-src_Makefile_am b/security/zoneminder/patches/patch-src_Makefile_am
new file mode 100644
index 00000000000..8cb9faae75f
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_Makefile_am
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_Makefile_am,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Don't pointlessly chown zms. Don't setuid zmfix here, let Pkgsrc deal with
+that.
+
+--- src/Makefile.am.orig 2010-11-23 01:57:40.000000000 +1300
++++ src/Makefile.am 2010-11-23 01:58:47.000000000 +1300
+@@ -124,8 +124,8 @@
+ # Yes, you are correct. This is a HACK!
+ install-exec-hook:
+ ( cd $(DESTDIR)@bindir@; mkdir -p $(DESTDIR)$(cgidir); mv zms $(DESTDIR)$(cgidir) )
+- ( cd $(DESTDIR)$(cgidir); chown $(webuser):$(webgroup) zms; ln -f zms nph-zms )
+- ( cd $(DESTDIR)@bindir@; chmod u+s zmfix )
++ ( cd $(DESTDIR)$(cgidir); ln -f zms nph-zms )
++# ( cd $(DESTDIR)@bindir@; chmod u+s zmfix )
+
+ uninstall-hook:
+ ( cd $(DESTDIR)$(cgidir); rm -f zms nph-zms )
diff --git a/security/zoneminder/patches/patch-src_zm_comms_cpp b/security/zoneminder/patches/patch-src_zm_comms_cpp
new file mode 100644
index 00000000000..ce21a69367a
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zm_comms_cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_zm_comms_cpp,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Don't attempt to include headers that don't exist.
+
+--- src/zm_comms.cpp.orig 2013-03-08 08:26:27.000000000 +1300
++++ src/zm_comms.cpp 2013-03-08 08:27:10.000000000 +1300
+@@ -25,7 +25,9 @@
+ #include <fcntl.h>
+ #include <stdarg.h>
+ //#include <memory.h>
++#ifdef HAVE_ALLOCA_H
+ #include <alloca.h>
++#endif
+ #include <string.h>
+ //#include <unistd.h>
+ #include <sys/ioctl.h>
diff --git a/security/zoneminder/patches/patch-src_zm_comms_h b/security/zoneminder/patches/patch-src_zm_comms_h
new file mode 100644
index 00000000000..a44bcfab74d
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zm_comms_h
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_zm_comms_h,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+extern "C" system headers.
+
+Include missing system headers for NetBSD.
+
+--- src/zm_comms.h 2009-10-15 02:08:49.000000000 +1300
++++ src/zm_comms.h 2013-03-08 09:07:38.000000000 +1300
+@@ -22,10 +23,15 @@
+
+ #include "zm_exception.h"
+
++extern "C" {
+ #include <unistd.h>
+ #include <netdb.h>
+ #include <errno.h>
++#include <sys/socket.h>
++#include <sys/uio.h>
+ #include <sys/un.h>
++#include <netinet/in.h>
++}
+
+ #include <set>
+ #include <vector>
diff --git a/security/zoneminder/patches/patch-src_zm_logger_cpp b/security/zoneminder/patches/patch-src_zm_logger_cpp
new file mode 100644
index 00000000000..376b2b4b280
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zm_logger_cpp
@@ -0,0 +1,16 @@
+$NetBSD: patch-src_zm_logger_cpp,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+If the system has syscall() but not SYS_gettid [E.g. NetBSD], don't attempt
+to use SYS_gettid.
+
+--- src/zm_logger.cpp.orig 2013-03-08 10:51:36.000000000 +1300
++++ src/zm_logger.cpp 2013-03-08 10:52:17.000000000 +1300
+@@ -515,7 +515,7 @@
+ #endif
+
+ pid_t tid;
+-#ifdef HAVE_SYSCALL
++#if defined(HAVE_SYSCALL) && defined(SYS_gettid)
+ if ( (tid = syscall(SYS_gettid)) < 0 ) // Thread/Process id
+ #endif // HAVE_SYSCALL
+ tid = getpid(); // Process id
diff --git a/security/zoneminder/patches/patch-src_zm_remote_camera_h b/security/zoneminder/patches/patch-src_zm_remote_camera_h
new file mode 100644
index 00000000000..38cc89851bf
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zm_remote_camera_h
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_zm_remote_camera_h,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Declare sockaddr_in.
+
+--- src/zm_remote_camera.h.orig 2013-03-08 11:09:05.000000000 +1300
++++ src/zm_remote_camera.h 2013-03-08 11:10:42.000000000 +1300
+@@ -22,6 +22,8 @@
+
+ #include "zm_camera.h"
+
++#include <netinet/in.h>
++
+ #include <string>
+ #include <netdb.h>
+
diff --git a/security/zoneminder/patches/patch-src_zm_signal_h b/security/zoneminder/patches/patch-src_zm_signal_h
new file mode 100644
index 00000000000..d5716b24565
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zm_signal_h
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_zm_signal_h,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Don't include <execinfo.h> for lack of portability.
+
+--- src/zm_signal.h.orig 2010-11-09 00:11:24.876121001 +1300
++++ src/zm_signal.h 2010-11-09 00:11:32.692121001 +1300
+@@ -21,7 +21,6 @@
+ #define ZM_SIGNAL_H
+
+ #include <signal.h>
+-#include <execinfo.h>
+
+ #include "zm.h"
+
diff --git a/security/zoneminder/patches/patch-src_zm_thread_cpp b/security/zoneminder/patches/patch-src_zm_thread_cpp
new file mode 100644
index 00000000000..56b1a41394e
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zm_thread_cpp
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_zm_thread_cpp,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+pthread_mutex_timedlock() is not available on NetBSD 5.0, and not required
+in ZoneMinder.
+
+--- src/zm_thread.cpp.orig 2013-03-08 11:32:29.000000000 +1300
++++ src/zm_thread.cpp 2013-03-08 11:32:58.000000000 +1300
+@@ -72,6 +72,7 @@
+ throw ThreadException( stringtf( "Unable to lock pthread mutex: %s", strerror(errno) ) );
+ }
+
++#if 0
+ void Mutex::lock( int secs )
+ {
+ struct timespec timeout = getTimeout( secs );
+@@ -85,6 +86,7 @@
+ if ( pthread_mutex_timedlock( &mMutex, &timeout ) < 0 )
+ throw ThreadException( stringtf( "Unable to timedlock pthread mutex: %s", strerror(errno) ) );
+ }
++#endif
+
+ void Mutex::unlock()
+ {
diff --git a/security/zoneminder/patches/patch-src_zmc_cpp b/security/zoneminder/patches/patch-src_zmc_cpp
new file mode 100644
index 00000000000..6ce06d66e28
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zmc_cpp
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_zmc_cpp,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+Use a more appropriate initialisation for a long, and use the definition out
+of <limits.h>, for portability.
+
+--- src/zmc.cpp.orig 2010-11-08 23:51:08.000000000 +1300
++++ src/zmc.cpp 2010-11-08 23:51:45.000000000 +1300
+@@ -19,7 +19,7 @@
+
+ #include <getopt.h>
+ #include <signal.h>
+-#include <values.h>
++#include <limits.h>
+
+ #include "zm.h"
+ #include "zm_db.h"
+@@ -224,7 +224,7 @@
+ sigprocmask( SIG_BLOCK, &block_set, 0 );
+ for ( int i = 0; i < n_monitors; i++ )
+ {
+- long min_delay = MAXINT;
++ long min_delay = LONG_MAX;
+
+ gettimeofday( &now, NULL );
+ for ( int j = 0; j < n_monitors; j++ )
diff --git a/security/zoneminder/patches/patch-src_zmf_cpp b/security/zoneminder/patches/patch-src_zmf_cpp
new file mode 100644
index 00000000000..c65375c84eb
--- /dev/null
+++ b/security/zoneminder/patches/patch-src_zmf_cpp
@@ -0,0 +1,89 @@
+$NetBSD: patch-src_zmf_cpp,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+http://www.zoneminder.com/wiki/index.php/1.24.2_Patches
+
+Fix Incomplete Image errors in zmf
+
+This patch changes the socket reader in zmf from a single read, to a loop
+read. Incomplete reads would be reported even though the image writer wrote
+the whole image to the socket. The problem was when the read went to read the
+image frame from the socket, all the data had not yet been written to the
+socket by the writer, so the reader thought there was a problem. The loop
+reads from the socket until a full image frame is read, or there is an error.
+
+--- src/zmf.cpp.orig 2010-11-04 12:10:08.824894001 +1300
++++ src/zmf.cpp 2010-11-04 12:10:15.992894001 +1300
+@@ -231,16 +231,39 @@
+ }
+ Debug( 1, "Read frame header, expecting %ld bytes of image", frame_header.image_length );
+ static unsigned char image_data[ZM_MAX_IMAGE_SIZE];
+- n_bytes = read( sd, image_data, frame_header.image_length );
+- if ( n_bytes != (ssize_t)frame_header.image_length )
++
++ // Read for pipe and loop until bytes expected have been read or an error occures
++ int bytes_read = 0;
++ do
+ {
+- if ( n_bytes < 0 )
++ n_bytes = read( sd, image_data+bytes_read, frame_header.image_length-bytes_read );
++ if (n_bytes < 0) break; // break on error
++ if (n_bytes < frame_header.image_length)
+ {
+- Error( "Can't read frame image data: %s", strerror(errno) );
++ // print some informational messages
++ if (bytes_read == 0)
++ {
++ Warning("Image read : Short read %d bytes of %d expected bytes",n_bytes,frame_header.image_length);
++ }
++ else if (bytes_read+n_bytes == frame_header.image_length)
++ {
++ Warning("Image read : Read rest of short read: %d bytes read total of %d bytes",n_bytes,frame_header.image_length);
++ }
++ else
++ {
++ Warning("Image read : continuing, read %d bytes (%d so far)", n_bytes, bytes_read+n_bytes);
++ }
+ }
+- else if ( n_bytes > 0 )
++ bytes_read+= n_bytes;
++ } while (n_bytes>0 && (bytes_read < (ssize_t)frame_header.image_length) );
++
++ // Print errors if there was a problem
++ if ( n_bytes < 1 )
++ {
++ Error( "Only read %d bytes of %d\n", bytes_read, frame_header.image_length);
++ if ( n_bytes < 0 )
+ {
+- Error( "Incomplete read of frame image data, %d bytes only", n_bytes );
++ Error( "Can't read frame image data: %s", strerror(errno) );
+ }
+ else
+ {
+@@ -249,16 +272,18 @@
+ ReopenSocket( sd, monitor->Id() );
+ continue;
+ }
++
+ static char subpath[PATH_MAX] = "";
+- if ( config.use_deep_storage )
+- {
+- struct tm *time = localtime( &frame_header.event_time );
+- snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec );
+- }
+- else
+- {
+- snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
+- }
++ if ( config.use_deep_storage )
++ {
++ struct tm *time = localtime( &frame_header.event_time );
++ snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec );
++ }
++ else
++ {
++ snprintf( subpath, sizeof(subpath), "%ld", frame_header.event_id );
++ }
++
+ static char path[PATH_MAX] = "";
+ snprintf( path, sizeof(path), frame_header.alarm_frame?anal_path:capt_path, subpath, frame_header.frame_id );
+ Debug( 1, "Got image, writing to %s", path );
diff --git a/security/zoneminder/patches/patch-web_ajax_stream_php b/security/zoneminder/patches/patch-web_ajax_stream_php
new file mode 100644
index 00000000000..b92ba4384b3
--- /dev/null
+++ b/security/zoneminder/patches/patch-web_ajax_stream_php
@@ -0,0 +1,15 @@
+$NetBSD: patch-web_ajax_stream_php,v 1.1 2013/03/15 02:01:47 dsainty Exp $
+
+http://www.zoneminder.com/forums/viewtopic.php?t=13322
+
+--- web/ajax/stream.php 2010-10-31 14:54:06.262326001 +1300
++++ web/ajax/stream.php 2010-11-18 22:21:34.802226529 +1300
+@@ -60,7 +60,7 @@
+ $eSockets = NULL;
+ $numSockets = @socket_select( $rSockets, $wSockets, $eSockets, intval(MSG_TIMEOUT/1000), (MSG_TIMEOUT%1000)*1000 );
+
+-if ( $numSockets === false )
++if ( $numSockets === false || $numSockets < 0)
+ {
+ ajaxError( "socket_select failed: ".socket_strerror(socket_last_error()) );
+ }