Skip to content

Commit 1ccf6ba

Browse files
author
gdt
committed
security/zoneminder: Convert to cmake/build.mk
This had slightly more changes than expected, but nothing mysterious: manual install rules need to reference built scripts in the cmake build directory. pkglint indent level cleanup. Note that pkglint is not perceiving ZM_PERL_PATH as a list and incorrectly warning (but that is hard to deal with). Update list of known-working database versions, and leave a hint that others have not been tested. Build tested only.
1 parent c6187db commit 1ccf6ba

1 file changed

Lines changed: 26 additions & 24 deletions

File tree

security/zoneminder/Makefile

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: Makefile,v 1.76 2024/12/01 13:49:47 gdt Exp $
1+
# $NetBSD: Makefile,v 1.77 2024/12/01 14:06:17 gdt Exp $
22

33
VERSION= 1.36.33
44
# Distfile is ZoneMinder but package and tarball contents are zoneminder.
@@ -48,7 +48,6 @@ PKG_SUGGESTED_OPTIONS= apache
4848

4949
## MAIN BUILD
5050

51-
USE_CMAKE= yes
5251
USE_LANGUAGES= c c++
5352
USE_TOOLS+= gmake perl pkg-config
5453

@@ -67,58 +66,58 @@ CMAKE_CONFIGURE_ARGS+= -DCMAKE_BUILD_TYPE=Debug
6766
# ZoneMinder prefers a subdirectory of etc. Further, it demands a
6867
# conf.d subdirectory within its config directory, which would be
6968
# irregular at top level.
70-
CMAKE_CONFIGURE_ARGS+= -DZM_CONFIG_DIR=${PKG_SYSCONFDIR}/zm
69+
CMAKE_CONFIGURE_ARGS+= -DZM_CONFIG_DIR=${PKG_SYSCONFDIR}/zm
7170
OWN_DIRS_PERMS+= ${PKG_SYSCONFDIR}/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
7271
OWN_DIRS_PERMS+= ${PKG_SYSCONFDIR}/zm/conf.d ${REAL_ROOT_USER} ${APACHE_GROUP} 775
7372

7473
# \todo We prepare a webroot, even without the apache option.
7574
ZM_HTTPD_ROOT= share/zoneminder/htdocs
76-
CMAKE_CONFIGURE_ARGS+= -DZM_WEBDIR=${PREFIX}/${ZM_HTTPD_ROOT:Q}
75+
CMAKE_CONFIGURE_ARGS+= -DZM_WEBDIR=${PREFIX}/${ZM_HTTPD_ROOT:Q}
7776
PLIST_SUBST+= ZM_HTTPD_ROOT=${ZM_HTTPD_ROOT:Q}
7877
PRINT_PLIST_AWK+= { gsub(/${ZM_HTTPD_ROOT:S|/|\\/|g}/, "$${ZM_HTTPD_ROOT}") }
7978
OWN_DIRS+= ${ZM_HTTPD_ROOT:Q}
8079
INSTALLATION_DIRS+= share/zoneminder ${ZM_HTTPD_ROOT}
8180

8281
ZM_HTTPD_CGIBIN= libexec/zoneminder/cgi-bin
83-
CMAKE_CONFIGURE_ARGS+= -DZM_CGIDIR=${PREFIX}/${ZM_HTTPD_CGIBIN:Q}
82+
CMAKE_CONFIGURE_ARGS+= -DZM_CGIDIR=${PREFIX}/${ZM_HTTPD_CGIBIN:Q}
8483
PLIST_SUBST+= ZM_HTTPD_CGIBIN=${ZM_HTTPD_CGIBIN:Q}
8584
PRINT_PLIST_AWK+= { gsub(/${ZM_HTTPD_CGIBIN:S|/|\\/|g}/, "$${ZM_HTTPD_CGIBIN}") }
8685
BUILD_DEFS+= ZM_HTTPD_CGIBIN
8786
OWN_DIRS+= ${ZM_HTTPD_CGIBIN:Q}
8887
INSTALLATION_DIRS+= libexec/zoneminder ${ZM_HTTPD_CGIBIN}
8988

9089
BUILD_DEFS+= VARBASE
91-
CMAKE_CONFIGURE_ARGS+= -DZM_RUNDIR=${VARBASE}/run/zm
90+
CMAKE_CONFIGURE_ARGS+= -DZM_RUNDIR=${VARBASE}/run/zm
9291
# \todo Consider a way to clean up on de-install as anything left
9392
# should just be removed.
9493
OWN_DIRS_PERMS+= ${VARBASE}/run/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
9594

9695
# NB: Startup script must create /var/run/zm.
97-
CMAKE_CONFIGURE_ARGS+= -DZM_SOCKDIR=${VARBASE}/run/zm
96+
CMAKE_CONFIGURE_ARGS+= -DZM_SOCKDIR=${VARBASE}/run/zm
9897
# Choose /var/tmp for now. \todo Revisit.
99-
CMAKE_CONFIGURE_ARGS+= -DZM_TMPDIR=${VARBASE}/tmp/zm
98+
CMAKE_CONFIGURE_ARGS+= -DZM_TMPDIR=${VARBASE}/tmp/zm
10099
OWN_DIRS_PERMS+= ${VARBASE}/tmp/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
101-
CMAKE_CONFIGURE_ARGS+= -DZM_LOGDIR=${VARBASE}/log/zm
100+
CMAKE_CONFIGURE_ARGS+= -DZM_LOGDIR=${VARBASE}/log/zm
102101
OWN_DIRS_PERMS+= ${VARBASE}/log/zm ${REAL_ROOT_USER} ${APACHE_GROUP} 775
103102

104103
# \todo Define this per-OS; /var/shm is for NetBSD
105104
ZM_SHM= /var/shm
106-
CMAKE_CONFIGURE_ARGS+= -DZM_PATH_MAP=${ZM_SHM}
105+
CMAKE_CONFIGURE_ARGS+= -DZM_PATH_MAP=${ZM_SHM}
107106

108107
# Cache directory is for js files to be served. For now, use
109108
# /var/cache/zoneminder. \todo Consider /tmp/zm instead.
110109
ZM_CACHE= ${VARBASE}/cache/zoneminder
111-
CMAKE_CONFIGURE_ARGS+= -DZM_CACHEDIR=${ZM_CACHE}
110+
CMAKE_CONFIGURE_ARGS+= -DZM_CACHEDIR=${ZM_CACHE}
112111
OWN_DIRS_PERMS+= ${ZM_CACHE} ${REAL_ROOT_USER} ${APACHE_GROUP} 775
113112

114113
# Storage of events; this should persist and is hence in /var/db.
115114
# \todo Understand how and why /images is used.
116115
ZM_CONTENT= ${VARBASE}/db/zoneminder
117-
CMAKE_CONFIGURE_ARGS+= -DZM_CONTENTDIR=${ZM_CONTENT}
116+
CMAKE_CONFIGURE_ARGS+= -DZM_CONTENTDIR=${ZM_CONTENT}
118117
OWN_DIRS_PERMS+= ${ZM_CONTENT} ${REAL_ROOT_USER} ${APACHE_GROUP} 775
119-
CMAKE_CONFIGURE_ARGS+= -DZM_DIR_EVENTS=${ZM_CONTENT}/events
118+
CMAKE_CONFIGURE_ARGS+= -DZM_DIR_EVENTS=${ZM_CONTENT}/events
120119
OWN_DIRS_PERMS+= ${ZM_CONTENT}/events ${APACHE_USER} ${APACHE_GROUP} 775
121-
CMAKE_CONFIGURE_ARGS+= -DZM_DIR_IMAGES=${ZM_CONTENT}/images
120+
CMAKE_CONFIGURE_ARGS+= -DZM_DIR_IMAGES=${ZM_CONTENT}/images
122121
OWN_DIRS_PERMS+= ${ZM_CONTENT}/images ${APACHE_USER} ${APACHE_GROUP} 775
123122

124123
## Dependencies other than perl and php.
@@ -140,8 +139,8 @@ CMAKE_CONFIGURE_ARGS+= -D${lib}_LIBRARIES=${BUILDLINK_PREFIX.ffmpeg6}/lib/ffmpeg
140139
# \todo Revisit this and see if there is a better way.
141140
# MySQL uses openssl. Force zoneminder not to choose otherwise by
142141
# finding libraries that are present but not buildlinked.
143-
CMAKE_CONFIGURE_ARGS+= -DGNUTLS_LIBRARIES=""
144-
CMAKE_CONFIGURE_ARGS+= -DGCRYPT_LIBRARIES=""
142+
CMAKE_CONFIGURE_ARGS+= -DGNUTLS_LIBRARIES=""
143+
CMAKE_CONFIGURE_ARGS+= -DGCRYPT_LIBRARIES=""
145144

146145
# Darwin does have sendfile(), but the API differs from ZoneMinder's
147146
# expectation.
@@ -188,6 +187,7 @@ DEPENDS+= p5-libwww-[0-9]*:../../www/p5-libwww
188187

189188
# A large subset of perl scripts set PATH explicitly and need to patched.
190189
# See "PATH FIXUPS" below.
190+
# \todo Teach pkglint that this variable is a list.
191191
ZM_PERL_PATH= scripts/zmaudit.pl.in
192192
ZM_PERL_PATH+= scripts/zmcamtool.pl.in
193193
ZM_PERL_PATH+= scripts/zmcontrol.pl.in
@@ -209,7 +209,7 @@ ZM_PERL_PATH+= scripts/zmx10.pl.in
209209
# 83: PHP Fatal error: Uncaught TypeError: flock(): Argument #1 ($stream) must be of type resource, false given in /usr/pkg/share/zoneminder/htdocs/includes/functions.php:2244
210210
# In 2022, upstream warned against 82.
211211
# php-apcu fails with 56, but upstream might support it.
212-
PHP_VERSIONS_INCOMPATIBLE= 56 83
212+
PHP_VERSIONS_INCOMPATIBLE= 56 83
213213

214214
.include "../../lang/php/phpversion.mk"
215215
DEPENDS+= ${PHP_PKG_PREFIX}-pdo_mysql-[0-9]*:../../databases/php-pdo_mysql
@@ -230,9 +230,9 @@ PKG_USERS_VARS+= APACHE_USER
230230
PKG_GROUPS_VARS+= APACHE_GROUP
231231
BUILD_DEFS+= APACHE_USER APACHE_GROUP
232232

233-
CMAKE_CONFIGURE_ARGS+= -DZM_WEB_USER=${APACHE_USER}
234-
CMAKE_CONFIGURE_ARGS+= -DZM_WEB_GROUP=${APACHE_GROUP}
235-
CMAKE_CONFIGURE_ARGS+= -DZM_PATH_ZMS=zm/cgi-bin/nph-zms
233+
CMAKE_CONFIGURE_ARGS+= -DZM_WEB_USER=${APACHE_USER}
234+
CMAKE_CONFIGURE_ARGS+= -DZM_WEB_GROUP=${APACHE_GROUP}
235+
CMAKE_CONFIGURE_ARGS+= -DZM_PATH_ZMS=zm/cgi-bin/nph-zms
236236

237237
.if !empty(PKG_OPTIONS:Mapache)
238238
.include "../../mk/apache.mk"
@@ -246,9 +246,9 @@ DEPENDS+= ${PHP_PKG_PREFIX}-fpm-[0-9]*:../../www/php-fpm
246246

247247
## MYSQL
248248

249-
# 1.36 works with mysql56 on NetBSD
249+
# 1.36 works with mariadb 10.6 on NetBSD
250250
# 1.36 works with mariadb 11.2 on GNU/Linux
251-
# Likely, all versions in pkgsrc are ok.
251+
# \todo Evaluate and exclude troublesome versions.
252252
.include "../../mk/mysql.buildlink3.mk"
253253

254254
## PATH FIXUPS
@@ -316,13 +316,15 @@ INSTALLATION_DIRS+= bin share/examples/rc.d share/zoneminder/db
316316
INSTALLATION_DIRS+= ${DOCDIR}
317317
post-install:
318318
${INSTALL_DATA} ${WRKSRC}/httpd-zoneminder.conf ${DESTDIR}${PREFIX}/${EGDIR}/apache/httpd-zoneminder.conf
319-
${INSTALL_DATA} ${WRKSRC}/zm.conf ${DESTDIR}${PREFIX}/${EGDIR}/config/zm.conf
319+
${INSTALL_DATA} ${WRKSRC}/${CMAKE_BUILD_DIR}/zm.conf ${DESTDIR}${PREFIX}/${EGDIR}/config/zm.conf
320320
.if ${INIT_SYSTEM} == "rc.d"
321-
${INSTALL_SCRIPT} ${WRKSRC}/scripts/zm ${DESTDIR}${PREFIX}/share/examples/rc.d/zoneminder
321+
${INSTALL_SCRIPT} ${WRKSRC}/${CMAKE_BUILD_DIR}/scripts/zm ${DESTDIR}${PREFIX}/share/examples/rc.d/zoneminder
322322
.endif
323323
${INSTALL_DATA} ${WRKSRC}/db/*.sql ${DESTDIR}${PREFIX}/share/zoneminder/db/
324324
${INSTALL_DATA} files/README-pkgsrc.md ${DESTDIR}${PREFIX}/${DOCDIR}
325325

326+
.include "../../devel/cmake/build.mk"
327+
326328
.include "../../mk/dlopen.buildlink3.mk"
327329
.include "../../mk/jpeg.buildlink3.mk"
328330
.include "../../mk/pthread.buildlink3.mk"

0 commit comments

Comments
 (0)