zoneminder132: Add version 1.32.3

This is cloned from ../zoneminder, intended to be left as 1.32 while
../zoneminder is updated further.  It's not being hoisted to pkgsrc
because of unresolved issues that I don't want to be responsible for.
master
Greg Troxel 2024-01-14 11:41:05 -05:00
parent 47f03f60cc
commit 4d080ddfbb
32 changed files with 9464 additions and 0 deletions

View File

@ -5860,6 +5860,7 @@ SUBDIR+= zlua
SUBDIR+= zmap
SUBDIR+= zodiac
SUBDIR+= zoneminder
SUBDIR+= zoneminder132
SUBDIR+= zpaq
SUBDIR+= zrepl

65
zoneminder132/COMMIT_MSG Normal file
View File

@ -0,0 +1,65 @@
security/zoneminder: Update to 1.32.3
Welcome to 2018.
Packaging changes:
- Change config to etc/zm from etc, and provide etc/zm/conf.d, because
migration from 1.30 writes there.
- Rototill hard the cmake build options, and try to document what
must be set as path configuration.
- Upstream removed zmf; drop patch.
- Depend on mp4v2.
Upstream NEWS
Summarized from: https://github.com/ZoneMinder/zoneminder/releases/tag/1.32.0)
A re-worked web console, compared to the previous 1.30.4 release
record to mp4 container
record audio
support for php 7.x
Arbitrary website as a non-recordable, interactive monitor.
Updated Montage Review
Options-> Paths moved into config files under conf.d folder
Multiple storage paths are supported. See Options -> Storage
The old method of bind mounting the event folder is no longer needed nor recommended
Additional system statistics on the web console
Raspberry pi OMX hardware h264 decoder support
Event thumbnails play video on mouseover
Drag and drop sorting of monitors
Scalability improvements
Support for Redhat el6 distros and clones has been removed
Upstream upgrade notes (tweaked for pkgsrc):
The upgrade scripts will take longer than normal to run,
especially if you have many events.
Your previous settings on the Options -> Paths tab have been moved
into the file zmcustom.conf which is found under
${PKGSYSCONFDIR}/etc/zm/conf.d
Consider migrating your events folder from the former bind mount
method to the new method under Options -> Storage
You should no longer have symbolic links in your webroot
folder. This resolves a long standing security issue.
The Apache config file has changed. Hand merge it and review your
web setup.

13
zoneminder132/DESCR Normal file
View File

@ -0,0 +1,13 @@
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.
Users are cautioned that this release is old and that it is fairly
cantankerous to get running.

366
zoneminder132/Makefile Normal file
View File

@ -0,0 +1,366 @@
# $NetBSD: Makefile,v 1.42 2019/06/18 12:36:59 gdt Exp $
VERSION= 1.32.3
PKGREVISION= 9
# Distfile is ZoneMinder but package and tarball contents are zoneminder.
NAME_DIST= ZoneMinder
NAME_LOWER= zoneminder
PKGNAME= ${DISTNAME:S/${NAME_DIST}-/${NAME_LOWER}-/}
DISTNAME= ${NAME_DIST}-${VERSION}
WRKSRC= ${WRKDIR}/${NAME_LOWER}-${VERSION}
CATEGORIES= security
MASTER_SITES= ${MASTER_SITE_GITHUB:=${NAME_DIST}/}
GITHUB_PROJECT= ${NAME_DIST}
GITHUB_TYPE= tag
GITHUB_TAG= ${PKGVERSION_NOREV}
# Submodules as per ZoneMinder's .gitmodules file, except that crud is no longer
# at ZoneMinder so we use FriendsOfCake instead.
# \todo Consider 3.0 vs v3.0.10, as the .gitmodules points to 3.0.
GITHUB_SUBMODULES+= FriendsOfCake crud v3.0.10 web/api/app/Plugin/Crud
GITHUB_SUBMODULES+= ZoneMinder CakePHP-Enum-Behavior master web/api/app/Plugin/CakePHP-Enum-Behavior
MAINTAINER= dsainty@NetBSD.org
#MAINTAINER+= gdt@NetBSD.org
HOMEPAGE= https://www.zoneminder.com/
COMMENT= Video camera security and surveillance solution
LICENSE= gnu-gpl-v2
# ZoneMinder without a web server does not really make sense, and if
# it did, what is omitted is surely not right. For now, require a
# choice of webserver.
PKG_OPTIONS_VAR= PKG_OPTIONS.zoneminder
PKG_OPTIONS_REQUIRED_GROUPS= webserver
PKG_OPTIONS_GROUP.webserver= apache nginx
PKG_SUGGESTED_OPTIONS= apache
.include "../../mk/bsd.options.mk"
## MAIN BUILD
# As of 1.32, ZoneMinder has removed autoconf support.
USE_CMAKE= yes
USE_LANGUAGES= c c++
USE_TOOLS+= gmake perl pkg-config
# For now, lean to debugging.
CMAKE_ARGS+= -DCMAKE_VERBOSE_MAKEFILE=true
CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Debug
## PATHS
# zoneminder has a dizzying array of variables for various paths.
# Consolidate the settings in an attempt to reduce confusion.
# ZoneMinder prefers a subdirectory of etc. Further, it demands a
# conf.d subdirectory within its config directory, which would be
# irregular at top level.
CMAKE_ARGS+= -DZM_CONFIG_DIR=${PKG_SYSCONFDIR}/zm
OWN_DIRS_PERMS+= ${PKG_SYSCONFDIR}/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
OWN_DIRS_PERMS+= ${PKG_SYSCONFDIR}/zm/conf.d ${REAL_ROOT_USER} ${APACHE_GROUP} 775
# \todo We prepare a webroot, even without the apache option.
ZM_HTTPD_ROOT= share/zoneminder/htdocs
CMAKE_ARGS+= -DZM_WEBDIR=${PREFIX}/${ZM_HTTPD_ROOT:Q}
PLIST_SUBST+= ZM_HTTPD_ROOT=${ZM_HTTPD_ROOT:Q}
PRINT_PLIST_AWK+= { gsub(/${ZM_HTTPD_ROOT:S|/|\\/|g}/, "$${ZM_HTTPD_ROOT}") }
OWN_DIRS+= ${ZM_HTTPD_ROOT:Q}
INSTALLATION_DIRS+= share/zoneminder ${ZM_HTTPD_ROOT}
ZM_HTTPD_CGIBIN= libexec/zoneminder/cgi-bin
CMAKE_ARGS+= -DZM_CGIDIR=${PREFIX}/${ZM_HTTPD_CGIBIN:Q}
PLIST_SUBST+= ZM_HTTPD_CGIBIN=${ZM_HTTPD_CGIBIN:Q}
PRINT_PLIST_AWK+= { gsub(/${ZM_HTTPD_CGIBIN:S|/|\\/|g}/, "$${ZM_HTTPD_CGIBIN}") }
BUILD_DEFS+= ZM_HTTPD_CGIBIN
OWN_DIRS+= ${ZM_HTTPD_CGIBIN:Q}
INSTALLATION_DIRS+= libexec/zoneminder ${ZM_HTTPD_CGIBIN}
BUILD_DEFS+= VARBASE
CMAKE_ARGS+= -DZM_RUNDIR=${VARBASE}/run/zm
# \todo Consider a way to clean up on de-install as anything left
# should just be removed.
OWN_DIRS_PERMS+= ${VARBASE}/run/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
# NB: Startup script must create /var/run/zm.
CMAKE_ARGS+= -DZM_SOCKDIR=${VARBASE}/run/zm
# Choose /var/tmp for now. \todo Revisit.
CMAKE_ARGS+= -DZM_TMPDIR=${VARBASE}/tmp/zm
OWN_DIRS_PERMS+= ${VARBASE}/tmp/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
CMAKE_ARGS+= -DZM_LOGDIR=${VARBASE}/log/zm
OWN_DIRS_PERMS+= ${VARBASE}/log/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
# \todo Define this per-OS; /var/shm is for NetBSD
ZM_SHM= /var/shm
CMAKE_ARGS+= -DZM_PATH_MAP=${ZM_SHM}
# Cache directory is for js files to be served. For now, use
# /var/cache/zoneminder. \todo Consider /tmp/zm instead.
ZM_CACHE= ${VARBASE}/cache/zoneminder
CMAKE_ARGS+= -DZM_CACHEDIR=${ZM_CACHE}
OWN_DIRS_PERMS+= ${ZM_CACHE} ${REAL_ROOT_USER} ${APACHE_GROUP} 775
# Storage of events; this should persist and is hence in /var/db.
# \todo Understand how and why /images is used.
ZM_CONTENT= ${VARBASE}/db/zoneminder
CMAKE_ARGS+= -DZM_CONTENTDIR=${ZM_CONTENT}
OWN_DIRS_PERMS+= ${ZM_CONTENT} ${REAL_ROOT_USER} ${APACHE_GROUP} 775
CMAKE_ARGS+= -DZM_DIR_EVENTS=${ZM_CONTENT}/events
OWN_DIRS_PERMS+= ${ZM_CONTENT}/events ${APACHE_USER} ${APACHE_GROUP} 775
CMAKE_ARGS+= -DZM_DIR_IMAGES=${ZM_CONTENT}/images
OWN_DIRS_PERMS+= ${ZM_CONTENT}/images ${APACHE_USER} ${APACHE_GROUP} 775
## Dependencies other than perl and php.
PTHREAD_AUTO_VARS= yes
.include "../../mk/pthread.buildlink3.mk"
# This should probably be ffmpeg4 at least.
# \todo Try higher versions with 1.32.
.include "../../multimedia/ffmpeg2/buildlink3.mk"
.if ${OPSYS} == "Darwin"
SOEXT= dylib
.else
SOEXT= so
.endif
.for lib in AVFORMAT AVCODEC AVDEVICE AVUTIL SWSCALE
CMAKE_ARGS+= -D${lib}_INCLUDE_DIR=${BUILDLINK_PREFIX.ffmpeg2}/include/ffmpeg2
CMAKE_ARGS+= -D${lib}_LIBRARIES=${BUILDLINK_PREFIX.ffmpeg2}/lib/ffmpeg2/lib${lib:tl}.${SOEXT}
.endfor
# 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_T not being defined.
CFLAGS+= -D__STDC_CONSTANT_MACROS
# MySQL uses openssl. Force zoneminder not to choose otherwise by
# finding libraries that are present but not buildlinked.
CMAKE_ARGS+= -DGNUTLS_LIBRARIES=""
CMAKE_ARGS+= -DGCRYPT_LIBRARIES=""
# Darwin does have sendfile(), but the API differs from ZoneMinder's
# expectation.
# \todo Convert to cmake.
# CONFIGURE_ARGS.Darwin+= ac_cv_func_sendfile=no ac_cv_header_sys_sendfile_h=no
# \todo After finding execinfo.h, cmake looks for and fails to find
# "backtrace".
# \todo Explain why we don't just depend on devel/libexecinfo.
.if ${OPSYS} == "NetBSD" && exists(/usr/include/execinfo.h)
LIBS+= -lexecinfo
.endif
## PERL
PERL5_REQD+= 5.6.0
# \todo Thoroughly review and rototill this section.
#
# Arrange for module.mk to perform its magic here on top of the non-Perl
# build tasks.
#
# Set ZM_PERL_MM_PARMS in order to inhibit NO_PACKLIST
#
#PERL5_CONFIGURE= no
#PERL5_CONFIGURE_DIRS= ${WRKSRC}/scripts/ZoneMinder
#PERL5_CONFIGURE_DIRS+= ${WRKSRC}/onvif/proxy
#PERL5_CONFIGURE_DIRS+= ${WRKSRC}/onvif/modules
#PERL5_PACKLIST= auto/ZoneMinder/.packlist
#PERL5_PACKLIST+= auto/ONVIF/.packlist
#CMAKE_ARGS+= -DZM_PERL_MM_PARMS="INSTALLDIRS=vendor"
#.include "../../lang/perl5/module.mk"
# ZoneMinder discourages building from source and does not appear to
# document the list of dependencies. We take the view that if an
# installation can be reasonably configured to use a module, that
# module should be a dependency, absent some reason that it is so
# heavyweight that it should be an option.
DEPENDS+= p5-Archive-Zip-[0-9]*:../../archivers/p5-Archive-Zip
DEPENDS+= p5-Device-SerialPort-[0-9]*:../../comms/p5-Device-SerialPort
DEPENDS+= p5-DBD-mysql-[0-9]*:../../databases/p5-DBD-mysql
DEPENDS+= p5-Class-Std-[0-9]*:../../devel/p5-Class-Std
DEPENDS+= p5-Class-Std-Fast-[0-9]*:../../devel/p5-Class-Std-Fast
DEPENDS+= p5-Data-Dump-[0-9]*:../../devel/p5-Data-Dump
DEPENDS+= p5-Data-UUID-[0-9]*:../../devel/p5-Data-UUID
DEPENDS+= p5-Date-Manip-[0-9]*:../../devel/p5-Date-Manip
DEPENDS+= p5-File-Slurp-[0-9]*:../../devel/p5-File-Slurp
DEPENDS+= p5-PHP-Serialization-[0-9]*:../../devel/p5-PHP-Serialization
DEPENDS+= p5-Sys-Mmap-[0-9]*:../../devel/p5-Sys-Mmap
DEPENDS+= p5-MIME-Lite-[0-9]*:../../mail/p5-MIME-Lite
DEPENDS+= p5-MIME-tools-[0-9]*:../../mail/p5-MIME-tools
DEPENDS+= p5-IO-Socket-Multicast-[0-9]*:../../net/p5-IO-Socket-Multicast
DEPENDS+= p5-Net-SFTP-Foreign-[0-9]*:../../net/p5-Net-SFTP-Foreign
DEPENDS+= p5-SOAP-WSDL-[0-9]*:../../net/p5-SOAP-WSDL
DEPENDS+= p5-Sys-MemInfo-[0-9]*:../../sysutils/p5-Sys-MemInfo
DEPENDS+= p5-XML-Parser-[0-9]*:../../textproc/p5-XML-Parser
DEPENDS+= p5-Number-Bytes-Human-[0-9]*:../../textproc/p5-Number-Bytes-Human
DEPENDS+= p5-libwww-[0-9]*:../../www/p5-libwww
# All perl scripts need interpreter patching (REPLACE_PERL), while a large
# subset also need an include PATH line modified (ZM_REPLACE_PERL).
ZM_REPLACE_PERL+= scripts/zmaudit.pl.in
ZM_REPLACE_PERL+= scripts/zmcamtool.pl.in
ZM_REPLACE_PERL+= scripts/zmcontrol.pl.in
ZM_REPLACE_PERL+= scripts/zmdc.pl.in
ZM_REPLACE_PERL+= scripts/zmfilter.pl.in
REPLACE_PERL+= scripts/zmonvif-probe.pl.in
ZM_REPLACE_PERL+= scripts/zmpkg.pl.in
ZM_REPLACE_PERL+= scripts/zmstats.pl.in
REPLACE_PERL+= scripts/zmsystemctl.pl.in
ZM_REPLACE_PERL+= scripts/zmtelemetry.pl.in
ZM_REPLACE_PERL+= scripts/zmtrack.pl.in
ZM_REPLACE_PERL+= scripts/zmtrigger.pl.in
ZM_REPLACE_PERL+= scripts/zmupdate.pl.in
ZM_REPLACE_PERL+= scripts/zmvideo.pl.in
ZM_REPLACE_PERL+= scripts/zmwatch.pl.in
ZM_REPLACE_PERL+= scripts/zmx10.pl.in
REPLACE_PERL+= ${ZM_REPLACE_PERL}
# The intention of zmsystemctl.pl is to use bin/pkexec to allow the
# apache user to start and stop the ZoneMinder services on operating
# systems using systemd and adequately recent Polkit. Rather than
# trying to express dependencies, we just let it be and hope that it
# will work in environments where it can. In other environments, we
# hope that no one runs the command.
CHECK_INTERPRETER_SKIP+= bin/zmsystemctl.pl
# \todo Why isn't this just REPLACE_PERL?
SUBST_CLASSES+= systemd-perl
SUBST_MESSAGE.systemd-perl= Adjusting systemd pkexec perl.
SUBST_STAGE.systemd-perl= pre-configure
SUBST_FILES.systemd-perl= scripts/zmsystemctl.pl.in
SUBST_SED.systemd-perl= -e 's|/usr/bin/perl|${PERL5}|g'
## PHP
# ZoneMinder 1.32 with PHP 7.4 does not appear to have PHP-related problems.
# Under PHP 8.0 <1.30 was logging at Error level type errors out of skin.js.
# Under PHP 8.1 <1.30 was logging at Panic level that strftime is deprecated.
#
# Therefore 74 is the standard approach and it is \todo to try higher.
PHP_VERSIONS_ACCEPTED= 74
.include "../../lang/php/phpversion.mk"
DEPENDS+= ${PHP_PKG_PREFIX}-pdo_mysql-[0-9]*:../../databases/php-pdo_mysql
DEPENDS+= ${PHP_PKG_PREFIX}-gd-[0-9]*:../../graphics/php-gd
DEPENDS+= ${PHP_PKG_PREFIX}-sockets-[0-9]*:../../net/php-sockets
DEPENDS+= ${PHP_PKG_PREFIX}-json-[0-9]*:../../textproc/php-json
DEPENDS+= ${PHP_PKG_PREFIX}-apcu-[0-9]*:../../www/php-apcu
## WEB
# \todo We need to choose user/group, and somehow make this play well
# with apache, nginx, and php_fpm. For now, assume that anyone using
# nginx/fpm will align that to APACHE_*, and treat the larger question
# as beyond scope.
PKG_USERS_VARS+= APACHE_USER
PKG_GROUPS_VARS+= APACHE_GROUP
BUILD_DEFS+= APACHE_USER APACHE_GROUP
CMAKE_ARGS+= -DZM_WEB_USER=${APACHE_USER}
CMAKE_ARGS+= -DZM_WEB_GROUP=${APACHE_GROUP}
CMAKE_ARGS+= -DZM_PATH_ZMS=zm/cgi-bin/nph-zms
.if !empty(PKG_OPTIONS:Mapache)
.include "../../mk/apache.mk"
DEPENDS+= ${APACHE_PKG_PREFIX}-${PHP_PKG_PREFIX}-[0-9]*:../../www/ap-php
.endif
.if !empty(PKG_OPTIONS:Mnginx)
# \todo Actually test this option.
DEPENDS+= nginx-[0-9]*:../../www/nginx
DEPENDS+= ${PHP_PKG_PREFIX}-fpm-[0-9]*:../../www/php-fpm
.endif
## PATH FIXUPS
# Patch the db creation script so that default paths installed in the
# db match how we have configured the package.
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'
# In most perl scripts, set the path to include $prefix/bin, rather
# than looking in /usr/local/bin, so that mysql, sudo, and so on are
# found. (Scripts are in ZM_REPLACE_PERL rather than just
# REPLACE_PERL if they should get this substitution.)
SUBST_CLASSES+= script-path
SUBST_MESSAGE.script-path= Adjusting paths in scripts.
SUBST_STAGE.script-path= pre-configure
SUBST_FILES.script-path= ${ZM_REPLACE_PERL}
SUBST_SED.script-path= -e "s|^\\([\$$]ENV{PATH} *= *'\\).*';\$$|\\1${PREFIX}/bin:/bin:/usr/bin';|g"
# Substitute configured path in pkgsrc-provided apache config.
SUBST_CLASSES+= files
SUBST_STAGE.files= pre-configure
SUBST_FILES.files= httpd-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.
## INIT SCRIPTS
# \todo Figure out if this is really for pkgsrc rc.d, and maybe write one for
# files/
PLIST_VARS+= rcd
.if ${INIT_SYSTEM} == "rc.d"
PLIST.rcd= yes
# \todo fix
#RCD_SCRIPTS+= zoneminder
.endif
PRINT_PLIST_AWK+= { gsub(/^.+\/examples\/rc.d/, "$${PLIST.rcd}&"); }
## PKGSRC PHASE FIXUPS
# Pretend our apache config is part of the distribution.
# Avoid conflict with C++20 <version> - intertwined with patch-CMakeLists.txt
post-extract:
${CP} ${FILESDIR}/httpd-zoneminder.conf ${WRKSRC}/httpd-zoneminder.conf
${MV} ${WRKSRC}/version ${WRKSRC}/version.txt
# Omit patchfiles from PLIST if present. The pre-configure step below
# should prevent this from being necessary.
PRINT_PLIST_AWK+= /.orig$$/ { next; }
# After patching, remove .orig versions of .pm, because they are
# wrongly installed due to wildcard rules.
pre-configure:
${FIND} ${WRKSRC} -name "*.pm*.orig" -type f | ${XARGS} ${RM} -f
# \todo Review if the cmake build now supports installation.
# \todo Document the symlink game with ZM_CONTENT.
EGDIR= share/examples/${PKGBASE}
DOCDIR= share/doc/${PKGBASE}
INSTALLATION_DIRS+= ${EGDIR} ${EGDIR}/config ${EGDIR}/apache
CONF_FILES+= ${PREFIX}/${EGDIR}/config/zm.conf ${PKG_SYSCONFDIR}/zm/zm.conf
INSTALLATION_DIRS+= bin share/examples/rc.d share/zoneminder/db
INSTALLATION_DIRS+= ${DOCDIR}
post-install:
${INSTALL_DATA} ${WRKSRC}/httpd-zoneminder.conf ${DESTDIR}${PREFIX}/${EGDIR}/apache/httpd-zoneminder.conf
${INSTALL_DATA} ${WRKSRC}/zm.conf ${DESTDIR}${PREFIX}/${EGDIR}/config/zm.conf
.if ${INIT_SYSTEM} == "rc.d"
${INSTALL_SCRIPT} ${WRKSRC}/scripts/zm ${DESTDIR}${PREFIX}/share/examples/rc.d/zoneminder
.endif
${INSTALL_DATA} ${WRKSRC}/db/*.sql ${DESTDIR}${PREFIX}/share/zoneminder/db/
${INSTALL_DATA} files/README-pkgsrc.md ${DESTDIR}${PREFIX}/${DOCDIR}
.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"
# \todo Consider graphics/libv4l.
.include "../../devel/glib2/buildlink3.mk"
.include "../../devel/pcre/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../multimedia/mp4v2/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

7877
zoneminder132/PLIST Normal file

File diff suppressed because it is too large Load Diff

11
zoneminder132/TODO Normal file
View File

@ -0,0 +1,11 @@
- Consider installing conf.d/zmpaths.conf setting the paths we set,
because that seems necessary.
- Resolve zmc startup hang. zmdc.pl expects zmc to exit, but
sometimes it doesn't. Killing zmc if it remains running results
in continuing and respawning and then it's ok.
- Resolve nph-zms vs zms, or decide it's an upstream choice that this
package doesn't need to address.

34
zoneminder132/distinfo Normal file
View File

@ -0,0 +1,34 @@
$NetBSD: distinfo,v 1.12 2018/07/14 15:03:57 gdt Exp $
BLAKE2s (FriendsOfCake-crud-v3.0.10.tar.gz) = e04238f274c6ce5b27f4a106630ef224fe6cb61a8172d32474e8660af7adea81
SHA512 (FriendsOfCake-crud-v3.0.10.tar.gz) = 2f60557f2c783bb448e06c1ca40b536a1d7d5f3caf0626fa6716a28f808492d4799e238f16c022571be96921105b074b6763920fd7b9cc77b76d17ceadae2040
Size (FriendsOfCake-crud-v3.0.10.tar.gz) = 72960 bytes
BLAKE2s (ZoneMinder-1.32.3.tar.gz) = 7b82f17c3584afc882f0dbfc6ccdbaa9f5659cbd6aa0e4cf90f03f3a94a23ec7
SHA512 (ZoneMinder-1.32.3.tar.gz) = 1226127a1352ebc6e80ba0cbdb3ecbae27cf64a75b7652abc651e1440b709456f71f5a7f700e37575a8f4c8cd2a0904e5be7721f61ae040365b60ed05447a9c8
Size (ZoneMinder-1.32.3.tar.gz) = 10656921 bytes
BLAKE2s (ZoneMinder-CakePHP-Enum-Behavior-master.tar.gz) = 618af60eff56f659a700ff3bc9a3721c1b5a1ba8d15bc2a4213a4022297553bc
SHA512 (ZoneMinder-CakePHP-Enum-Behavior-master.tar.gz) = fa51aa34749cf0e7c9c484c4d65718696230291780df1bac9a5ca8144a230d5cdfdf2ff2fae413248a09ddd14615dbe88b111713e11173aa9d9078c5b3c9064c
Size (ZoneMinder-CakePHP-Enum-Behavior-master.tar.gz) = 3506 bytes
SHA1 (patch-CMakeLists.txt) = cfc565e597d48c6b3c54e1aba53e5f1b4e19f34a
SHA1 (patch-cmake_Modules_Pod2Man.cmake) = f0a1462037fc63fa9f35d0595f4f50946f5518e7
SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_ConfigData.pm.in) = 3bf4e5e8276a682695db640e6608dd14c7315320
SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm) = 84a1db650e90aa8e4dfe4c7633f1e5b41022fd01
SHA1 (patch-scripts_ZoneMinder_lib_ZoneMinder_Memory_Shared.pm) = b97c104f6ac102fc4510eb0977169375cdd97197
SHA1 (patch-scripts_zm_in) = a05727261bb8be6b707e9a14ae4ff52ea3770d51
SHA1 (patch-scripts_zmpkg_pl_in) = eb3166ae3cd9bb0ce1b828b64722506aa4e82368
SHA1 (patch-src_zm__event.cpp) = ba65b91fd62c2840819a71b23ffdae87b0ebe487
SHA1 (patch-src_zm__eventstream.cpp) = 63040024a69c9362e544e8950da57d831824f2f8
SHA1 (patch-src_zm__monitor.cpp) = 5611aa37187bc9910ba1ccd9ddd5d0f421438b53
SHA1 (patch-src_zm__rtp__ctrl.h) = 4e0fd8e80932de8d77b3386a356cc026ddc23113
SHA1 (patch-src_zm__rtp__source.cpp) = 2488ae3655f529a71d8b98fa29a9e0435bbdf182
SHA1 (patch-src_zm__thread.h) = 03e7cce589b62b95676a72df0d6707816c477ffa
SHA1 (patch-src_zm__timer.h) = 18ab09cd1ce92c80c43d34a2f2f8b9fe614bedeb
SHA1 (patch-src_zm__utils.cpp) = 0326a092f441a481975548a73d0c8f7af1fc702c
SHA1 (patch-src_zm_comms_cpp) = bd3c3e6dd4d11ea0845d2da662e99169cd6e6680
SHA1 (patch-src_zm_comms_h) = e9e25dced4ad54aa118f153fbd3390d1eb525e65
SHA1 (patch-src_zm_logger_cpp) = aed07139cd8adc11c7b43d4fefc24bc158b5617c
SHA1 (patch-src_zm_remote_camera_h) = 87da3e6326df5f9ab3c98fed5c7c9bae20cd6dc5
SHA1 (patch-src_zm_signal_cpp) = af9625702518648b8d62ed20d0d52c1a2a27841a
SHA1 (patch-src_zm_thread_cpp) = 165a1e38eb76f5cfe72606b1071177e619d73fe6
SHA1 (patch-src_zmc_cpp) = 1499eb3e2d92372a0dea036f22f429efeefe4d95
SHA1 (patch-src_zmu.cpp) = c2097766ecd0707728d29353ffaf590b234d8902

View File

@ -0,0 +1,158 @@
# Introduction
This is a local pkgsrc README for the zoneminder package. It attempts
not to duplicate the upstream documentation. (Arguably, some of this
should be pushed upstream.) This REAMDE presumes familiarity with
zoneminder, adminstering a web server, adminstering mysql, and
hand-typing SQL UPDATE statements.
We write /var for ${VARBASE}, /usr/pkg for ${PREFIX}, and /usr/pkg/etc
for ${PKG_SYSCONFDIR}, without loss of generality.
# pkgsrc-specific notes
## Choice of jpeg implementation
ZoneMinder claims to benefit dramatically from using libjpeg-turbo.
Consider setting that as default in mk.conf
`JPEG_DEFAULT=libjpeg-turbo` and then *everything*.
## User and Group
zoneminder uses APACHE_USER and APACHE_GROUP. These are www by
default, but people set them to fpm for use with nginx and php_fpm.
It is important that apache, zoneminder, and any existing directories
all agree.
# MySQL configuration and initial database creation
(It seems that zoneminder only works with MySQL.)
Condider adding `bind-address=127.0.0.1` to `etc/my.conf`, if you are
using mysql only for zoneminder and do not want it accessible from the
network.
See upstream instructions at
https://zoneminder.readthedocs.io/en/1.32.3/installationguide/ubuntu.html
which are for Ubuntu, but seem mostly generic.
Specifically, see "Step 5: Configure the ZoneMinder Database".
The default password is "zmpass". You may (probably should) change
this to something else, and set ZM_DB_PASS in
e.g. /usr/pkg/etc/zm/zmpass.conf.
# Other setup
See "Step 6: Set permissions", and use APACHE_GROUP.
See "Step 9: Edit Timezone in PHP". Otherwise, access to streams will
fail. See https://github.com/ZoneMinder/ZoneMinder/issues/1552 for
more information.
# Web setup
## apache
See "Step 7: Configure Apache correctly", but edit the apache config
file instead of using the not-in-pkgsrc a2enmod command.
mod_cgid is a hard requirement. zm appears to work without rewrite
and expire. headers is default on. Enabling a zoneminder apache
module does not make sense, but upstream maybe implies that you
should.
For now One needs to use prefork instead of event with cgid, because
php is built without threads.
Zoneminder installs
/usr/pkg/share/examples/zoneminder/apache/httpd-zoneminder.conf,
which does two things:
- aliases /zm to the zm main dir and /zm/cgi-bin/ to the zm cgi directory
- allows those paths to 127.0.0.1
Either `Include` this, copy/modify and `Include`, or insert into
httpd.conf. (You will need to adjust the IP acl if you want
off-machine access.)
It is for future study to use www/ap2-fcgid instead of mod_cgid, and
then one could use the event MPM.
## nginx
After you figure it out, please send patches to add an nginx config
file. Likely one would use php_fpm; Makefile guesses so.
# Problems not clearly attributed
In theory `zmpkg.pl start` should start everything. In practice, the
first `zmdc.pl start` invocation does start the daemon but then fails
to exit, hanging the startup process. While there is an attempt to
avoid this in `zmpkg.pl`, it is likely necessary to kill the hanging
start script, and thus to write a script to do so, to enable reliable
starting. This is likely an upstream issue, to be debugged after
pkgsrc is up to date.
# Upgrading from previous versions
As always, backup everything, diff all configs from upstream before
and minimize, save deltas, and merge to new upstreams keeping intended
changes. This is going to be worse than most upgrades.
## Standard zoneminder advice
Upgrade a database from an older version of ZoneMinder via:
zmupdate.pl -u root [-p <password>]
NB: Zoneminder 1.32 will attempt to remove config from the database
and place it in e.g. `/usr/pkg/etc/zm/conf.d/zmcustom.conf`. The
package attempts to create the directory, but make one more backup
than you think you need.
## Zoneminder path woes
In theory, one wouldn't have to set paths, but it seems one does. Go
over the list at
https://github.com/ZoneMinder/zoneminder/blob/release-1.32/INSTALL and
set some.
## Issues due to pkgsrc changes from 1.30 to 1.32
pkgsrc changed the config dir from /usr/pkg/etc to /usr/pkg/etc/zm, so
you should move zm.conf.
When editing in conf.d, beware zmcustom.conf~ which might or might not
also be read.
pkgsrc changed from /var/cache/zoneminder to /var/db/zoneminder.
While merging configs, pay extra attention to stray /var/cache
pathnames.
### Storage
Zoneminder has "Storage" configured (Options, Storage), and it is
possible that it used to be /var/cache/zoneminder/events and should
now be /var/db/zoneminder/events.
### Upload temp dir
One can configure uploads and a temp dir in which to create them.
That path is in the database as UPLOAD_LOC_DIR and can be a stray
source of /var/cache/zoneminder.
# Shared memory
Zoneminder tries to use a shm filesystem to store files that are then
mmap'd. (1.28 used SysV shm but that is no longer relevant.)
On NetBSD, the compiled default might be /dev/shm but the right place
is /var/shm. This can be changed in zmcustom.conf via ZM_PATH_MAP.
(One might need a lot of space, or to turn the buffer down to fewer
frames; this is not about pkgsrc.)
Somtimes, the shm file can get into a bad state and be zero length.
This might be a bad error path during camera timeouts; it seems to
happen more with bad wifi connections. Turning up the timeouts in the
config (e.g. wait 10s or 30s before giving up instead of 2s) probably
also helps. This is also not about pkgsrc.

View File

@ -0,0 +1,69 @@
# pkgsrc Apache configuration for zoneminder, intended to be copied to
# ${PKG_SYSCONFDIR}/httpd and then included via
# Include etc/httpd/httpd-zoneminder.conf
# This configuration puts ZoneMinder under /zm. Access is limited to
# localhost, as a safe default until intentionally changed.
LoadModule cgid_module lib/httpd/mod_cgid.so
# \todo Consider fcgi intead.
# <IfModule mod_fcgid.c>
# <Directory /usr/share/zoneminder/www>
# Options -Indexes +ExecCGI
# AllowOverride All
# AddHandler fcgid-script .php
# FCGIWrapper /usr/bin/php5-cgi
# Order allow,deny
# Allow from all
# </Directory>
# </IfModule>
LoadModule php7_module lib/httpd/mod_php7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# Upstream had
# <IfModule mod_php5.c>
# <Directory /usr/share/zoneminder/www>
# Options -Indexes +FollowSymLinks
# <IfModule mod_dir.c>
# DirectoryIndex index.php
# </IfModule>
# </Directory>
# </IfModule>
ScriptAlias /zm/cgi-bin/ "@ZM_HTTPD_CGIBIN@/"
<Directory "@ZM_HTTPD_CGIBIN@">
<RequireAny>
Require ip 127.0.0.1
Require ip ::
</RequireAny>
</Directory>
Alias /zm/cache "/var/cache/zoneminder"
<Directory "/var/cache/zoneminder">
<RequireAny>
Require ip 127.0.0.1
Require ip ::
</RequireAny>
</Directory>
Alias /zm/events "/var/db/zoneminder/events"
Alias /zm/images "/var/db/zoneminder/images"
<Directory "/var/db/zoneminder">
<RequireAny>
Require ip 127.0.0.1
Require ip ::
</RequireAny>
</Directory>
# \todo Upstream sets Options.
Alias /zm "@ZM_HTTPD_ROOT@"
<Directory "@ZM_HTTPD_ROOT@">
DirectoryIndex index.php
<RequireAny>
Require ip 127.0.0.1
Require ip ::
</RequireAny>
</Directory>

View File

@ -0,0 +1,55 @@
$NetBSD$
Don't have a file called "version", to avoid conflict with C++20 <version>.
CMake will detect the MacOS 6-argument sendfile() support and configure
HAVE_SENDFILE, but the code itself doesn't support this interface. So don't
probe for HAVE_SENDFILE if we HAVE_SENDFILE6_SUPPORT.
Just because librt doesn't exist does not mean that clock_gettime() doesn't
exist, so don't insist on librt being present. Fixes the build on MacOS.
Let Pkgsrc be responsible for zm.conf into examples, rather than overwriting
the existing configuration file.
--- CMakeLists.txt.orig 2018-12-08 14:22:36.000000000 +0000
+++ CMakeLists.txt
@@ -4,7 +4,7 @@
#
cmake_minimum_required (VERSION 2.8.7)
project (zoneminder)
-file (STRINGS "version" zoneminder_VERSION)
+file (STRINGS "version.txt" zoneminder_VERSION)
# make API version a minor of ZM version
set(zoneminder_API_VERSION "${zoneminder_VERSION}.1")
@@ -282,7 +282,9 @@ check_include_file("ucontext.h" HAVE_UCO
check_include_file("sys/sendfile.h" HAVE_SYS_SENDFILE_H)
check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
check_function_exists("syscall" HAVE_SYSCALL)
+if(NOT HAVE_SENDFILE6_SUPPORT)
check_function_exists("sendfile" HAVE_SENDFILE)
+endif(NOT HAVE_SENDFILE6_SUPPORT)
check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN)
check_type_size("siginfo_t" HAVE_SIGINFO_T)
check_type_size("ucontext_t" HAVE_UCONTEXT_T)
@@ -293,7 +295,7 @@ if (UNIX)
include (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if(NOT HAVE_CLOCK_GETTIME)
- message(FATAL_ERROR "clock_gettime not found")
+ #message(FATAL_ERROR "clock_gettime not found")
else(NOT HAVE_CLOCK_GETTIME)
list(APPEND ZM_BIN_LIBS "-lrt")
endif(NOT HAVE_CLOCK_GETTIME)
@@ -891,8 +893,8 @@ else(zmconfgen_result EQUAL 0)
endif(zmconfgen_result EQUAL 0)
# Install zm.conf
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
-install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE)
+#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/zm.conf" DESTINATION "${ZM_CONFIG_DIR}")
+#install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/conf.d/" DESTINATION "${ZM_CONFIG_SUBDIR}" PATTERN "*.in" EXCLUDE)
# Uninstall target
configure_file(

View File

@ -0,0 +1,19 @@
$NetBSD$
Change man install path to pkgsrc norms.
Not reported upstream until we are caught up. Then, the bug is not
the value, but that it isn't configurable via a cmake command-line
argument.
--- cmake/Modules/Pod2Man.cmake.orig 2019-02-22 15:38:47.000000000 +0000
+++ cmake/Modules/Pod2Man.cmake
@@ -58,7 +58,7 @@ MACRO(POD2MAN PODFILE MANFILE SECTION)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${MANFILE}.${SECTION}.gz
- DESTINATION share/man/man${SECTION}
+ DESTINATION man/man${SECTION}
)
ENDMACRO(POD2MAN PODFILE MANFILE SECTION)

View File

@ -0,0 +1,19 @@
$NetBSD$
Inhibit a couple of "phone home" options that are enabled by default. These
should be opt-in rather than opt-out.
The ConfigData.pm module determines what the default setting is for new
options during an upgrade as well as on an initial installation.
--- scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in.orig 2018-12-08 14:22:36.000000000 +0000
+++ scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in
@@ -2693,7 +2693,7 @@ our @options = (
},
{
name => 'ZM_CHECK_FOR_UPDATES',
- default => 'yes',
+ default => 'no',
description => 'Check with zoneminder.com for updated versions',
help => q`
From ZoneMinder version 1.17.0 onwards new versions are

View File

@ -0,0 +1,32 @@
$NetBSD: patch-scripts_ZoneMinder_lib_ZoneMinder_General_pm,v 1.2 2015/04/05 08:51:08 dsainty Exp $
Perl doesn't really support "> /dev/null", so just capture into $output.
% ktruss -i perl -e 'qx(does-not-exist >/dev/null 2>&1);'|egrep 'dup2.*2'
does-not-exist: not found
% ktruss -i perl -e 'qx(does-not-exist 2>&1);'|egrep 'dup2.*2'
16954 1 perl dup2(0x1, 0x2) = 2
The problem is that, whilst Perl supports 2>&1 internally (and does not use
the shell at all) if there is no other redirection, it does not support file
redirection - it defers that (and therefore necessarily must also defer the
stderr redirection) to the shell. If the system's shell happens to report
"Not found" errors before redirection is processed (E.g. NetBSD shell) then
the stderr redirection is happening too late to be captured.
That leads to unintended errors reported on stderr - primarily if sudo is not
installed on the system, or not in the $PATH.
Use the -m parameter to su, as ZM_WEB_USER shouldn't require a login shell.
--- scripts/ZoneMinder/lib/ZoneMinder/General.pm.orig 2018-12-08 14:22:36.000000000 +0000
+++ scripts/ZoneMinder/lib/ZoneMinder/General.pm
@@ -104,7 +104,7 @@ sub getCmdFormat {
chomp($output);
Debug("Test failed, '$output'");
- $prefix = "su ".$Config{ZM_WEB_USER}." -c '";
+ $prefix = "su -m ".$Config{ZM_WEB_USER}." -c '";
$suffix = "'";
$command = $prefix.$null_command.$suffix;
Debug("Testing \"$command\"");

View File

@ -0,0 +1,17 @@
$NetBSD$
Adjust for (more) modern perl.
Not submitted upstream because pkgsrc is woefully out of date.
--- scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm.orig 2016-02-03 18:40:30.000000000 +0000
+++ scripts/ZoneMinder/lib/ZoneMinder/Memory/Shared.pm
@@ -158,7 +158,7 @@ sub zmMemClean
."'"
;
Debug( "Checking for shared memory with '$command'\n" );
- open( my $CMD, '<', "$command |" )
+ open( my $CMD, '-|', "$command" )
or Fatal( "Can't execute '$command': $!" );
while( <$CMD> )
{

View File

@ -0,0 +1,51 @@
$NetBSD: patch-scripts_zm_in,v 1.3 2015/04/05 08:51:08 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 2016-02-03 18:40:30.000000000 +0000
+++ scripts/zm.in
@@ -7,12 +7,12 @@
# For systemd environments, use the ZoneMinder systemd unit file instead
# 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()
{
@@ -54,7 +54,7 @@ start()
RETVAL=$?
[ $RETVAL = 0 ] && success || failure
echo
- [ $RETVAL = 0 ] && touch $LOCKFILE
+ #[ $RETVAL = 0 ] && touch $LOCKFILE
return $RETVAL
}
@@ -66,7 +66,7 @@ stop()
RETVAL=$?
[ $RETVAL = 0 ] && success || failure
echo
- [ $RETVAL = 0 ] && rm -f $LOCKFILE
+ #[ $RETVAL = 0 ] && rm -f $LOCKFILE
}
zmstatus()
@@ -107,7 +107,7 @@ case "$1" in
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
;;

View File

@ -0,0 +1,39 @@
$NetBSD$
The systemd check in zmpkg.pl does not work, even on systems that use
systemd. It fails to start, eventually timing out, if there is any
parent process between zmpkg.pl and systemd or init - such as
/etc/init.d/zoneminder. But everything does seem to work ok from
systemd without this roundabout code anyway, so just inhibit it.
Add sleep to avoid suspected race condition.
\todo After catching up, actually debug and/or send upstream.
--- scripts/zmpkg.pl.in.orig 2018-12-08 14:22:36.000000000 +0000
+++ scripts/zmpkg.pl.in
@@ -143,7 +143,7 @@ if ( $command eq 'state' ) {
} # end if command = state
# Check if we are running systemd and if we have been called by the system
-if ( $command =~ /^(start|stop|restart)$/ ) {
+if ( 0 && $command =~ /^(start|stop|restart)$/ ) {
# We have to detaint to keep perl from complaining
$command = $1;
@@ -191,6 +191,15 @@ if ( $command =~ /^(?:start|restart)$/ )
zmMemTidy();
runCommand('zmdc.pl startup');
+ Info("Sleeping 2 seconds to avoid zmdc.pl race.");
+ # Somehow, on at least NetBSD 9 amd64, a future zmdc.pl start
+ # command succeeds in starting the daemon, but does not exit.
+ # Based on an unsubstantiated theory that the startup invocation
+ # exits before startup is complete, sleep for 2 seconds
+ # afterwards. Experimentally, this results in normal startup
+ # without hanging.
+ sleep(2);
+ Info("Sleeping complete.");
my $Server = undef;
my $sql;

View File

@ -0,0 +1,89 @@
$NetBSD: patch-src_zm__event.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
zoneminder uses %ld for time_t, which is troublesome on NetBSD arm and
presumably i386. (Note that there are multiple patch files for the
same issue.)
Not yet sent upstream -- needs update to latest release first, where
it might be fixed, or the patch might simply need to be rebased.
Also, this fix is expedient and probably a better fix is appropriate.
Avoid sendfile code when sendfile doesn't exist.
--- src/zm_event.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_event.cpp
@@ -87,10 +87,10 @@ Event::Event(
char sql[ZM_SQL_MED_BUFSIZ];
struct tm *stime = localtime(&start_time.tv_sec);
- snprintf( sql, sizeof(sql), "INSERT INTO Events ( MonitorId, StorageId, Name, StartTime, Width, Height, Cause, Notes, StateId, Orientation, Videoed, DefaultVideo, SaveJPEGs, Scheme ) values ( %d, %d, 'New Event', from_unixtime( %ld ), %d, %d, '%s', '%s', %d, %d, %d, '', %d, '%s' )",
+ snprintf( sql, sizeof(sql), "INSERT INTO Events ( MonitorId, StorageId, Name, StartTime, Width, Height, Cause, Notes, StateId, Orientation, Videoed, DefaultVideo, SaveJPEGs, Scheme ) values ( %d, %d, 'New Event', from_unixtime( %jd ), %d, %d, '%s', '%s', %d, %d, %d, '', %d, '%s' )",
monitor->Id(),
storage->Id(),
- start_time.tv_sec,
+ (intmax_t) start_time.tv_sec,
monitor->Width(),
monitor->Height(),
cause.c_str(),
@@ -247,8 +247,8 @@ Event::~Event() {
if ( frames > last_db_frame ) {
Debug(1, "Adding closing frame %d to DB", frames);
snprintf(sql, sizeof(sql),
- "INSERT INTO Frames ( EventId, FrameId, TimeStamp, Delta ) VALUES ( %" PRIu64 ", %d, from_unixtime( %ld ), %s%ld.%02ld )",
- id, frames, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec);
+ "INSERT INTO Frames ( EventId, FrameId, TimeStamp, Delta ) VALUES ( %" PRIu64 ", %d, from_unixtime( %jd ), %s%jd.%02ld )",
+ id, frames, (intmax_t) end_time.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec);
db_mutex.lock();
if ( mysql_query(&dbconn, sql) ) {
Error("Can't insert frame: %s", mysql_error(&dbconn));
@@ -259,8 +259,8 @@ Event::~Event() {
}
snprintf(sql, sizeof(sql),
- "UPDATE Events SET Name='%s %" PRIu64 "', EndTime = from_unixtime( %ld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d, DefaultVideo = '%s' WHERE Id = %" PRIu64,
- monitor->EventPrefix(), id, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, video_name, id );
+ "UPDATE Events SET Name='%s %" PRIu64 "', EndTime = from_unixtime( %jd ), Length = %s%jd.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d, DefaultVideo = '%s' WHERE Id = %" PRIu64,
+ monitor->EventPrefix(), id, (intmax_t) end_time.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, video_name, id );
db_mutex.lock();
while ( mysql_query(&dbconn, sql) && !zm_terminate ) {
Error("Can't update event: %s reason: %s", sql, mysql_error(&dbconn));
@@ -479,13 +479,13 @@ void Event::AddFramesInternal( int n_fra
DELTA_TIMEVAL( delta_time, *(timestamps[i]), start_time, DT_PREC_2 );
// Delta is Decimal(8,2) so 6 integer digits and 2 decimal digits
if ( delta_time.sec > 999999 ) {
- Warning("Invalid delta_time from_unixtime(%ld), %s%ld.%02ld",
- timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
+ Warning("Invalid delta_time from_unixtime(%jd), %s%jd.%02ld",
+ (intmax_t) timestamps[i]->tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec );
delta_time.sec = 0;
}
int sql_len = strlen(sql);
- snprintf(sql+sql_len, sizeof(sql)-sql_len, "( %" PRIu64 ", %d, from_unixtime(%ld), %s%ld.%02ld ), ", id, frames, timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec);
+ snprintf(sql+sql_len, sizeof(sql)-sql_len, "( %" PRIu64 ", %d, from_unixtime(%jd), %s%jd.%02ld ), ", id, frames, (intmax_t) timestamps[i]->tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec);
frameCount++;
} // end foreach frame
@@ -548,8 +548,8 @@ Debug(3, "Writing video");
static char sql[ZM_SQL_MED_BUFSIZ];
snprintf(sql, sizeof(sql),
"INSERT INTO Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score )"
- " VALUES ( %" PRIu64 ", %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )",
- id, frames, frame_type_names[frame_type], timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score);
+ " VALUES ( %" PRIu64 ", %d, '%s', from_unixtime( %jd ), %s%jd.%02ld, %d )",
+ id, frames, frame_type_names[frame_type], (intmax_t) timestamp.tv_sec, delta_time.positive?"":"-", (intmax_t) delta_time.sec, delta_time.fsec, score);
db_mutex.lock();
if ( mysql_query(&dbconn, sql) ) {
Error("Can't insert frame: %s", mysql_error(&dbconn));
@@ -563,9 +563,9 @@ Debug(3, "Writing video");
// We are writing a Bulk frame
if ( frame_type == BULK ) {
snprintf(sql, sizeof(sql),
- "UPDATE Events SET Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %" PRIu64,
+ "UPDATE Events SET Length = %s%jd.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %" PRIu64,
( delta_time.positive?"":"-" ),
- delta_time.sec, delta_time.fsec,
+ (intmax_t) delta_time.sec, delta_time.fsec,
frames,
alarm_frames,
tot_score,

View File

@ -0,0 +1,23 @@
$NetBSD$
Only include local sendfile header if there is sendfile support, to
avoid #error for no sendfile implementation.
--- src/zm_eventstream.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_eventstream.cpp
@@ -39,12 +39,14 @@
#include "zm_storage.h"
#include "zm_monitor.h"
+#if HAVE_SENDFILE
#include "zm_sendfile.h"
+#endif
bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) {
static char sql[ZM_SQL_SML_BUFSIZ];
- snprintf(sql, sizeof(sql), "SELECT Id FROM Events WHERE MonitorId = %d AND unix_timestamp(EndTime) > %ld ORDER BY Id ASC LIMIT 1", monitor_id, event_time);
+ snprintf(sql, sizeof(sql), "SELECT Id FROM Events WHERE MonitorId = %d AND unix_timestamp(EndTime) > %jd ORDER BY Id ASC LIMIT 1", monitor_id, (intmax_t) event_time);
if ( mysql_query(&dbconn, sql) ) {
Error("Can't run query: %s", mysql_error(&dbconn));

View File

@ -0,0 +1,38 @@
$NetBSD: patch-src_zm__monitor.cpp,v 1.1 2017/02/15 00:54:25 joerg Exp $
The shmat() error return is (apparently) -1 as a pointer. Some compilers
(E.g. clang on MacOS) refuse to consider testing if a pointer is less than
zero as legal code. Fix compilation by converting to explicit tests for
particular values that might make sense.
Avoid type error (suseconds_t is not long). To be addressed upstream once caught up.
--- src/zm_monitor.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_monitor.cpp
@@ -180,7 +180,7 @@ bool Monitor::MonitorLink::connect() {
return( false );
}
mem_ptr = (unsigned char *)shmat( shm_id, 0, 0 );
- if ( mem_ptr < (void *)0 ) {
+ if ( mem_ptr == (void *)-1 ) {
Debug( 3, "Can't shmat link memory: %s", strerror(errno) );
connected = false;
return( false );
@@ -210,7 +210,7 @@ bool Monitor::MonitorLink::disconnect()
connected = false;
#if ZM_MEM_MAPPED
- if ( mem_ptr > (void *)0 ) {
+ if ( mem_ptr != (void *)0 && mem_ptr != (void *)-1) {
msync( mem_ptr, mem_size, MS_ASYNC );
munmap( mem_ptr, mem_size );
}
@@ -2531,7 +2531,7 @@ void Monitor::TimestampImage( Image *ts_
found_macro = true;
break;
case 'f' :
- d_ptr += snprintf( d_ptr, sizeof(label_text)-(d_ptr-label_text), "%02ld", ts_time->tv_usec/10000 );
+ d_ptr += snprintf( d_ptr, sizeof(label_text)-(d_ptr-label_text), "%02ld", (long) ts_time->tv_usec/10000 );
found_macro = true;
break;
}

View File

@ -0,0 +1,18 @@
$NetBSD: patch-src_zm__rtp__ctrl.h,v 1.1 2020/07/12 16:58:42 gdt Exp $
Work around:
zm_rtp_ctrl.h:128:31: error: flexible array member 'RtpCtrlThread::RtcpPacket::<unnamed union>::Bye::srcN' in an otherwise empty 'struct RtpCtrlThread::RtcpPacket::<unnamed union>::Bye'
Not reported upstream because pkgsrc is out of date; to be done if this is not resolved by updating.
--- src/zm_rtp_ctrl.h.orig 2019-02-22 15:38:47.000000000 +0000
+++ src/zm_rtp_ctrl.h
@@ -125,7 +125,7 @@ private:
// BYE
struct
{
- uint32_t srcN[]; // list of sources
+ uint32_t srcN[0]; // list of sources
// can't express trailing text for reason (what does this mean? it's not even english!)
} bye;
} body;

View File

@ -0,0 +1,26 @@
$NetBSD: patch-src_zm__rtp__source.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
Fix type issue with tv_sec; see earlier patches.
--- src/zm_rtp_source.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_rtp_source.cpp
@@ -197,7 +197,7 @@ void RtpSource::updateRtcpData( uint32_t
{
struct timeval ntpTime = tvMake( ntpTimeSecs, suseconds_t((USEC_PER_SEC*(ntpTimeFrac>>16))/(1<<16)) );
- Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
+ Debug( 5, "ntpTime: %jd.%06ld, rtpTime: %x", (intmax_t) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
if ( mBaseTimeNtp.tv_sec == 0 )
{
@@ -207,8 +207,8 @@ void RtpSource::updateRtcpData( uint32_t
}
else if ( !mRtpClock )
{
- Debug( 5, "lastSrNtpTime: %ld.%06ld, rtpTime: %x", mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
- Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
+ Debug( 5, "lastSrNtpTime: %jd.%06ld, rtpTime: %x", (intmax_t) mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
+ Debug( 5, "ntpTime: %jd.%06ld, rtpTime: %x", (intmax_t) ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
double diffNtpTime = tvDiffSec( mBaseTimeNtp, ntpTime );
uint32_t diffRtpTime = rtpTime - mBaseTimeRtp;

View File

@ -0,0 +1,91 @@
$NetBSD: patch-src_zm__thread.h,v 1.4 2015/04/10 02:58:49 dsainty Exp $
Fix build with Clang.
pthread_t is opaque, and under NetBSD is a pointer. It's being abused here,
but the value is only used for logging, and casting pthread_self() is more
portable than syscall(SYS_gettid).
\todo Fix correctly upstream.
--- src/zm_thread.h.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_thread.h
@@ -22,19 +22,20 @@
#include <unistd.h>
#include <pthread.h>
+#include <stdint.h>
#include <unistd.h>
-#ifdef HAVE_SYS_SYSCALL_H
-#include <sys/syscall.h>
-#endif // HAVE_SYS_SYSCALL_H
#include "zm_exception.h"
#include "zm_utils.h"
#ifdef __FreeBSD__
#include <sys/thr.h>
#endif
+#ifdef __NetBSD__
+#include <lwp.h>
+#endif
class ThreadException : public Exception {
private:
-#ifndef SOLARIS
+#ifndef USE_PTHREAD
pid_t pid() {
pid_t tid;
#ifdef __FreeBSD__
@@ -44,6 +45,8 @@ private:
#else
#ifdef __FreeBSD_kernel__
if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
+ #elif defined(__NetBSD__)
+ tid = _lwp_self();
# else
tid=syscall(SYS_gettid);
#endif
@@ -54,7 +57,7 @@ private:
pthread_t pid() { return( pthread_self() ); }
#endif
public:
- explicit ThreadException( const std::string &message ) : Exception( stringtf("(%d) ", (long int)pid())+message ) {
+ explicit ThreadException( const std::string &message ) : Exception( stringtf("(%jd) ", (intmax_t)pid())+message ) {
}
};
@@ -209,7 +212,7 @@ protected:
Mutex mThreadMutex;
Condition mThreadCondition;
-#ifndef SOLARIS
+#ifndef USE_PTHREAD
pid_t mPid;
#else
pthread_t mPid;
@@ -222,7 +225,7 @@ protected:
Thread();
virtual ~Thread();
-#ifndef SOLARIS
+#ifndef USE_PTHREAD
pid_t id() const {
pid_t tid;
#ifdef __FreeBSD__
@@ -233,6 +236,8 @@ protected:
#ifdef __FreeBSD_kernel__
if ( (syscall(SYS_thr_self, &tid)) < 0 ) // Thread/Process id
+ #elif defined(__NetBSD__)
+ tid = _lwp_self();
#else
tid=syscall(SYS_gettid);
#endif
@@ -257,7 +262,7 @@ public:
void join();
void kill( int signal );
bool isThread() {
- return( mPid > -1 && pthread_equal( pthread_self(), mThread ) );
+ return( /* mPid > -1 && */ pthread_equal( pthread_self(), mThread ) );
}
bool isStarted() const { return mStarted; }
bool isRunning() const { return mRunning; }

View File

@ -0,0 +1,28 @@
$NetBSD: patch-src_zm__timer.h,v 1.3 2015/04/10 02:58:49 dsainty Exp $
Fix build with Clang.
pthread_t is opaque, and under NetBSD is a pointer. It's being abused here,
but the value is only used for logging, and casting pthread_self() is more
portable than syscall(SYS_gettid).
--- src/zm_timer.h.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_timer.h
@@ -33,7 +33,7 @@ private:
class TimerException : public Exception
{
private:
-#ifndef SOLARIS
+#if !defined(SOLARIS) && !defined(__NetBSD__)
pid_t pid() {
pid_t tid;
#ifdef __FreeBSD__
@@ -53,7 +53,7 @@ private:
pthread_t pid() { return( pthread_self() ); }
#endif
public:
- explicit TimerException( const std::string &message ) : Exception( stringtf("(%d) ", (long int)pid())+message ) {
+ explicit TimerException( const std::string &message ) : Exception( stringtf( ("(%d) "+message).c_str(), (long int)pid() ) ) {
}
};

View File

@ -0,0 +1,45 @@
$NetBSD$
Avoid assuming linux on arm. For now, assume neon.
Fix time types (sizes).
--- src/zm_utils.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_utils.cpp
@@ -26,7 +26,7 @@
#include <stdarg.h>
#include <fcntl.h> /* Definition of AT_* constants */
#include <sys/stat.h>
-#if defined(__arm__)
+#if defined(__arm__) && defined(__linux__)
#include <sys/auxv.h>
#endif
@@ -305,6 +305,7 @@ void hwcaps_detect() {
Debug(1,"Detected a x86\\x86-64 processor");
}
#elif defined(__arm__)
+# if defined(__linux__)
// ARM processor in 32bit mode
// To see if it supports NEON, we need to get that information from the kernel
unsigned long auxval = getauxval(AT_HWCAP);
@@ -314,6 +315,10 @@ void hwcaps_detect() {
} else {
Debug(1,"Detected ARM (AArch32) processor");
}
+# else
+ Debug(1,"!!ASSUMING!! ARM (AArch32) processor with Neon");
+ neonversion = 1;
+# endif
#elif defined(__aarch64__)
// ARM processor in 64bit mode
// Neon is mandatory, no need to check for it
@@ -397,7 +402,7 @@ char *timeval_to_string( struct timeval
nowtime = tv.tv_sec;
nowtm = localtime(&nowtime);
strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", nowtm);
- snprintf(buf, sizeof buf, "%s.%06ld", tmbuf, tv.tv_usec);
+ snprintf(buf, sizeof buf, "%s.%06jd", tmbuf, (intmax_t) tv.tv_usec);
return buf;
}

View File

@ -0,0 +1,17 @@
$NetBSD: patch-src_zm_comms_cpp,v 1.2 2013/03/24 16:47:47 joerg Exp $
Don't attempt to include headers that don't exist.
--- src/zm_comms.cpp.orig 2016-02-03 18:40:30.000000000 +0000
+++ src/zm_comms.cpp
@@ -28,8 +28,10 @@
#if defined(BSD)
#include <stdlib.h>
#else
+#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
+#endif
//#include <unistd.h>
#include <sys/ioctl.h>

View File

@ -0,0 +1,39 @@
$NetBSD: patch-src_zm_comms_h,v 1.5 2022/01/12 11:53:26 dsainty Exp $
extern "C" system headers.
Include missing system headers for NetBSD.
To fix Linux readv/writev, back-port:
https://github.com/ZoneMinder/zoneminder/commit/417421b1d869d1b71c8ec1a1e3b082fcede6ce58#diff-484f666f58ec13f38fa402143f2f6ad8e63a013909d3941ffbb3d66745b20c8d
--- src/zm_comms.h.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_comms.h
@@ -22,20 +22,24 @@
#include "zm_exception.h"
+extern "C" {
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include <sys/un.h>
-
-#include <set>
-#include <vector>
+#include <stdlib.h>
+#include <time.h>
#include <sys/uio.h>
#if defined(BSD)
#include <sys/socket.h>
#include <netinet/in.h>
#endif
+}
+
+#include <set>
+#include <vector>
class CommsException : public Exception {
public:

View File

@ -0,0 +1,39 @@
$NetBSD: patch-src_zm_logger_cpp,v 1.5 2018/07/14 15:03:57 gdt Exp $
Use libgen.h for basename.
Kludge around const for basename.
If the system has syscall() but not SYS_gettid [E.g. NetBSD], don't attempt
to use SYS_gettid.
Fix time types (sizes).
--- src/zm_logger.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_logger.cpp
@@ -464,12 +464,12 @@ void Logger::logPrint( bool hex, const c
subtractTime( &timeVal, &logStart );
- snprintf( timeString, sizeof(timeString), "%ld.%03ld", timeVal.tv_sec, timeVal.tv_usec/1000 );
+ snprintf( timeString, sizeof(timeString), "%jd.%03ld", (intmax_t) timeVal.tv_sec, timeVal.tv_usec/1000 );
} else {
#endif
char *timePtr = timeString;
timePtr += strftime(timePtr, sizeof(timeString), "%x %H:%M:%S", localtime(&timeVal.tv_sec));
- snprintf(timePtr, sizeof(timeString)-(timePtr-timeString), ".%06ld", timeVal.tv_usec);
+ snprintf(timePtr, sizeof(timeString)-(timePtr-timeString), ".%06jd", (intmax_t) timeVal.tv_usec);
#if 0
}
#endif
@@ -548,8 +548,8 @@ void Logger::logPrint( bool hex, const c
"INSERT INTO Logs "
"( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line )"
" VALUES "
- "( %ld.%06ld, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
- timeVal.tv_sec, timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
+ "( %jd.%06jd, '%s', %d, %d, %d, '%s', '%s', '%s', %d )",
+ (intmax_t) timeVal.tv_sec, (intmax_t) timeVal.tv_usec, mId.c_str(), staticConfig.SERVER_ID, tid, level, classString, escapedString, file, line
);
if ( mysql_query(&dbconn, sql) ) {
Level tempDatabaseLevel = mDatabaseLevel;

View File

@ -0,0 +1,22 @@
$NetBSD: patch-src_zm_remote_camera_h,v 1.4 2015/04/05 08:51:08 dsainty Exp $
Declare sockaddr_in.
--- src/zm_remote_camera.h.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_remote_camera.h
@@ -23,11 +23,15 @@
#include "zm_camera.h"
#include "zm_rtsp_auth.h"
+
+
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
+#include <time.h>
#define SOCKET_BUF_SIZE 8192

View File

@ -0,0 +1,28 @@
$NetBSD: patch-src_zm_signal_cpp,v 1.2 2020/08/25 16:42:21 gdt Exp $
Don't assume machine-dependent IP register details are available for any
platform except Linux. Only Linux is sure to have this style of mcontext_t.
Resolves build on systems that have ucontext_t but an mcontext_t that
doesn't look like Linux.
--- src/zm_signal.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_signal.cpp
@@ -66,13 +66,17 @@ RETSIGTYPE zm_die_handler(int signal)
#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
ip = (void *)(uc->uc_mcontext.mc_rip);
#else
+ #if defined(__linux__)
ip = (void *)(uc->uc_mcontext.gregs[REG_RIP]);
+ #endif
#endif
#else
#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
ip = (void *)(uc->uc_mcontext.mc_eip);
#else
+ #if defined(__linux__)
ip = (void *)(uc->uc_mcontext.gregs[REG_EIP]);
+ #endif
#endif
#endif // defined(__x86_64__)

View File

@ -0,0 +1,58 @@
$NetBSD: patch-src_zm_thread_cpp,v 1.2 2013/03/24 16:47:47 joerg Exp $
pthread_mutex_timedlock() is not available on NetBSD 5.0, and not required
in ZoneMinder.
Work around varying notion of an undefined mpid on pthread/not.
--- src/zm_thread.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zm_thread.cpp
@@ -69,6 +69,7 @@ void Mutex::lock() {
throw ThreadException( stringtf( "Unable to lock pthread mutex: %s", strerror(errno) ) );
}
+#if 0
void Mutex::lock( int secs ) {
struct timespec timeout = getTimeout( secs );
if ( pthread_mutex_timedlock( &mMutex, &timeout ) < 0 )
@@ -80,6 +81,7 @@ void Mutex::lock( double secs ) {
if ( pthread_mutex_timedlock( &mMutex, &timeout ) < 0 )
throw ThreadException( stringtf( "Unable to timedlock pthread mutex: %s", strerror(errno) ) );
}
+#endif
void Mutex::unlock() {
if ( pthread_mutex_unlock( &mMutex ) < 0 )
@@ -218,9 +220,15 @@ template <class T> void ThreadData<T>::u
Debug(9, "Updated value, %p", this);
}
+#ifndef USE_PTHREAD
+#define MPID_UNDEFINED -1
+#else /* USE_PTHREAD */
+#define MPID_UNDEFINED NULL
+#endif /* USE_PTHREAD */
+
Thread::Thread() :
mThreadCondition( mThreadMutex ),
- mPid( -1 ),
+ mPid( MPID_UNDEFINED ),
mStarted( false ),
mRunning( false )
{
@@ -283,7 +291,7 @@ void Thread::join() {
if ( isThread() )
throw ThreadException( "Can't self join thread" );
mThreadMutex.lock();
- if ( mPid >= 0 ) {
+ if ( mPid != MPID_UNDEFINED ) {
if ( mStarted ) {
void *threadStatus = 0;
if ( pthread_join( mThread, &threadStatus ) < 0 )
@@ -305,4 +313,5 @@ void Thread::kill( int signal ) {
}
// Some explicit template instantiations
-#include "zm_threaddata.cpp"
+template class ThreadData<bool>;
+template class ThreadData<int>;

View File

@ -0,0 +1,25 @@
$NetBSD: patch-src_zmc_cpp,v 1.2 2013/03/24 16:47:47 joerg Exp $
Use a more appropriate initialisation for a long, and use the definition out
of <limits.h>, for portability.
--- src/zmc.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zmc.cpp
@@ -55,7 +55,7 @@ possible, this should run at more or les
#include <getopt.h>
#include <signal.h>
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
#include <limits.h>
#else
#include <values.h>
@@ -278,7 +278,7 @@ int main(int argc, char *argv[]) {
while ( !zm_terminate ) {
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++ ) {

View File

@ -0,0 +1,52 @@
$NetBSD: patch-src_zmu.cpp,v 1.2 2018/07/14 15:03:57 gdt Exp $
time types
--- src/zmu.cpp.orig 2018-12-08 14:22:36.000000000 +0000
+++ src/zmu.cpp
@@ -494,12 +494,12 @@ int main(int argc, char *argv[]) {
if ( timestamp.tv_sec )
strftime( timestamp_str, sizeof(timestamp_str), "%Y-%m-%d %H:%M:%S", localtime( &timestamp.tv_sec ) );
if ( image_idx == -1 )
- printf( "Time of last image capture: %s.%02ld\n", timestamp_str, timestamp.tv_usec/10000 );
+ printf( "Time of last image capture: %s.%02ld\n", timestamp_str, (long) timestamp.tv_usec/10000 );
else
- printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, timestamp.tv_usec/10000 );
+ printf( "Time of image %d capture: %s.%02ld\n", image_idx, timestamp_str, (long) timestamp.tv_usec/10000 );
} else {
if ( have_output ) printf( "%c", separator );
- printf( "%ld.%02ld", timestamp.tv_sec, timestamp.tv_usec/10000 );
+ printf( "%jd.%02ld", (intmax_t) timestamp.tv_sec, (long) timestamp.tv_usec/10000 );
have_output = true;
}
}
@@ -718,12 +718,12 @@ int main(int argc, char *argv[]) {
Monitor *monitor = Monitor::Load( mon_id, false, Monitor::QUERY );
if ( monitor && monitor->connect() ) {
struct timeval tv = monitor->GetTimestamp();
- printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8" PRIu64 "%8.2f\n",
+ printf( "%4d%5d%6d%9d%11jd.%02jd%6d%6d%8" PRIu64 "%8.2f\n",
monitor->Id(),
function,
monitor->GetState(),
monitor->GetTriggerState(),
- tv.tv_sec, tv.tv_usec/10000,
+ (intmax_t) tv.tv_sec, (intmax_t) tv.tv_usec/10000,
monitor->GetLastReadIndex(),
monitor->GetLastWriteIndex(),
monitor->GetLastEventId(),
@@ -733,12 +733,12 @@ int main(int argc, char *argv[]) {
}
} else {
struct timeval tv = { 0, 0 };
- printf( "%4d%5d%6d%9d%11ld.%02ld%6d%6d%8d%8.2f\n",
+ printf( "%4d%5d%6d%9d%11jd.%02jd%6d%6d%8d%8.2f\n",
mon_id,
function,
0,
0,
- tv.tv_sec, tv.tv_usec/10000,
+ (intmax_t) tv.tv_sec, (intmax_t) tv.tv_usec/10000,
0,
0,
0,