2013-10-20 02:50:59 +08:00
|
|
|
# CMakeLists.txt for the Redhat/CentOS Target Distro.
|
|
|
|
|
2015-02-15 21:34:17 +08:00
|
|
|
# Display a message to show the RHEL build options are being processed.
|
2016-12-24 03:06:44 +08:00
|
|
|
if(ZM_TARGET_DISTRO MATCHES "^el")
|
|
|
|
message([STATUS] "Starting RHEL Build Options" ...)
|
|
|
|
elseif(ZM_TARGET_DISTRO MATCHES "^fc")
|
|
|
|
message([STATUS] "Starting Fedora Build Options" ...)
|
|
|
|
else(ZM_TARGET_DISTRO MATCHES "^el")
|
|
|
|
message([WARNING] "Unknown Build Option Detected" ...)
|
|
|
|
endif(ZM_TARGET_DISTRO MATCHES "^el")
|
2015-02-15 21:34:17 +08:00
|
|
|
|
2017-07-14 23:15:12 +08:00
|
|
|
if((NOT ZM_TARGET_DISTRO MATCHES "^fc") AND (ZM_WEB_USER STREQUAL "nginx"))
|
|
|
|
message([FATAL_ERROR] "Experimental Nginx support is currently only supported on Fedora" ...)
|
|
|
|
endif((NOT ZM_TARGET_DISTRO MATCHES "^fc") AND (ZM_WEB_USER STREQUAL "nginx"))
|
2016-12-24 03:06:44 +08:00
|
|
|
|
|
|
|
# Configure the zoneminder service files
|
|
|
|
if(ZM_TARGET_DISTRO STREQUAL "el6")
|
|
|
|
configure_file(sysvinit/zoneminder.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.sysvinit @ONLY)
|
|
|
|
configure_file(sysvinit/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY)
|
2017-07-14 23:15:12 +08:00
|
|
|
configure_file(apache/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY)
|
2016-12-24 03:06:44 +08:00
|
|
|
else(ZM_TARGET_DISTRO STREQUAL "el6")
|
2016-12-24 03:11:06 +08:00
|
|
|
configure_file(systemd/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY)
|
2016-12-24 03:06:44 +08:00
|
|
|
if(ZM_WEB_USER STREQUAL "nginx")
|
|
|
|
configure_file(nginx/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
|
|
|
|
configure_file(nginx/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY)
|
|
|
|
configure_file(nginx/zoneminder.tmpfiles.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.tmpfiles @ONLY)
|
|
|
|
configure_file(nginx/zoneminder.php-fpm.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.php-fpm.conf @ONLY)
|
|
|
|
configure_file(nginx/README.Fedora ${CMAKE_CURRENT_SOURCE_DIR}/readme/README.Fedora COPYONLY)
|
|
|
|
else(ZM_WEB_USER STREQUAL "nginx")
|
|
|
|
configure_file(systemd/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
|
2017-07-14 23:15:12 +08:00
|
|
|
configure_file(apache/zoneminder.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.conf @ONLY)
|
2016-12-24 03:06:44 +08:00
|
|
|
configure_file(systemd/zoneminder.tmpfiles.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.tmpfiles @ONLY)
|
|
|
|
endif(ZM_WEB_USER STREQUAL "nginx")
|
|
|
|
endif(ZM_TARGET_DISTRO STREQUAL "el6")
|
2013-10-20 02:50:59 +08:00
|
|
|
|
2016-07-04 00:34:35 +08:00
|
|
|
# Unpack jscalendar & move files into position
|
|
|
|
message(STATUS "Unpacking and Installing jscalendar...")
|
2016-12-24 03:06:44 +08:00
|
|
|
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/misc/jscalendar.sh
|
2016-07-04 00:34:35 +08:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
ERROR_VARIABLE unzip_jsc
|
|
|
|
)
|
|
|
|
if("${unzip_jsc}" STREQUAL "")
|
|
|
|
message(STATUS "jscalendar successfully installed.")
|
|
|
|
else("${unzip_jsc}" STREQUAL "")
|
2016-12-29 17:31:05 +08:00
|
|
|
message(FATAL_ERROR "\nAn error occurred while jscalendar was being processed:\n${unzip_jsc}")
|
2016-07-04 00:34:35 +08:00
|
|
|
endif("${unzip_jsc}" STREQUAL "")
|
2013-10-20 02:50:59 +08:00
|
|
|
|
|
|
|
# Create several empty folders
|
2017-04-15 21:51:59 +08:00
|
|
|
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp)
|
2013-10-20 02:50:59 +08:00
|
|
|
|
|
|
|
# Install the empty folders
|
|
|
|
install(DIRECTORY sock swap DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
|
|
|
install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2017-04-01 09:17:05 +08:00
|
|
|
install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2013-10-20 02:50:59 +08:00
|
|
|
install(DIRECTORY zoneminder-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
|
|
|
install(DIRECTORY events images temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
|
|
|
|
|
|
|
# Create symlinks
|
|
|
|
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/events \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/events\")")
|
|
|
|
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/images \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/images\")")
|
|
|
|
install(CODE "execute_process(COMMAND ln -sf ../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/temp\")")
|
2015-08-30 07:04:26 +08:00
|
|
|
install(CODE "execute_process(COMMAND ln -sf ../../../../../../var/lib/zoneminder/temp \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/api/app/tmp\")")
|
2013-10-20 02:50:59 +08:00
|
|
|
|
2016-12-24 03:06:44 +08:00
|
|
|
# Link to Cambozola
|
2015-09-15 02:51:48 +08:00
|
|
|
install(CODE "execute_process(COMMAND ln -sf ../../java/cambozola.jar \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/cambozola.jar\")")
|
|
|
|
|
2016-02-08 17:41:36 +08:00
|
|
|
# Install auxiliary files required to run zoneminder on CentOS
|
2016-12-24 03:06:44 +08:00
|
|
|
install(FILES misc/redalert.wav DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/sounds PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2016-07-04 00:34:35 +08:00
|
|
|
install(DIRECTORY jscalendar-1.0/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/zoneminder/www/tools/jscalendar)
|
|
|
|
|
2016-12-24 03:06:44 +08:00
|
|
|
install(FILES zoneminder.logrotate DESTINATION /etc/logrotate.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
|
|
|
|
|
|
|
if(ZM_WEB_USER STREQUAL "nginx")
|
|
|
|
install(FILES zoneminder.conf DESTINATION /etc/nginx/default.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
|
|
|
install(FILES zoneminder.php-fpm.conf DESTINATION /etc/php-fpm.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ RENAME zoneminder.conf)
|
|
|
|
else(ZM_WEB_USER STREQUAL "nginx")
|
|
|
|
install(FILES zoneminder.conf DESTINATION /etc/httpd/conf.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
|
|
|
endif(ZM_WEB_USER STREQUAL "nginx")
|
|
|
|
|
|
|
|
if(ZM_TARGET_DISTRO STREQUAL "el6")
|
2015-02-16 05:59:58 +08:00
|
|
|
install(FILES zoneminder.sysvinit DESTINATION /etc/rc.d/init.d RENAME zoneminder PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
2016-12-24 03:06:44 +08:00
|
|
|
else(ZM_TARGET_DISTRO STREQUAL "el6")
|
|
|
|
install(FILES zoneminder.service DESTINATION /usr/lib/systemd/system PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
2016-12-26 22:31:21 +08:00
|
|
|
install(FILES zoneminder.tmpfiles DESTINATION /usr/lib/tmpfiles.d RENAME zoneminder.conf PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
|
2016-12-24 03:06:44 +08:00
|
|
|
endif(ZM_TARGET_DISTRO STREQUAL "el6")
|
2013-10-20 02:50:59 +08:00
|
|
|
|