diff --git a/.gitignore b/.gitignore index a4986e661..465aeb837 100644 --- a/.gitignore +++ b/.gitignore @@ -40,37 +40,20 @@ node_modules/ onvif/CMakeFiles/ onvif/cmake_install.cmake onvif/modules/CMakeFiles/ -onvif/modules/MYMETA.json -onvif/modules/MYMETA.yml -onvif/modules/MakefilePerl onvif/modules/cmake_install.cmake -onvif/modules/output/ -onvif/modules/pm_to_blib onvif/proxy/CMakeFiles/ -onvif/proxy/MYMETA.json -onvif/proxy/MYMETA.yml -onvif/proxy/MakefilePerl onvif/proxy/cmake_install.cmake -onvif/proxy/output/ -onvif/proxy/pm_to_blib onvif/scripts/CMakeFiles/ onvif/scripts/cmake_install.cmake package.json package-lock.json scripts/CMakeFiles/ scripts/ZoneMinder/CMakeFiles/ -scripts/ZoneMinder/MYMETA.json -scripts/ZoneMinder/MYMETA.yml -scripts/ZoneMinder/Makefile.old -scripts/ZoneMinder/MakefilePerl -scripts/ZoneMinder/blib scripts/ZoneMinder/cmake_install.cmake scripts/ZoneMinder/lib/ZoneMinder/Base.pm scripts/ZoneMinder/lib/ZoneMinder/Config.pm scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm scripts/ZoneMinder/lib/ZoneMinder/Memory.pm -scripts/ZoneMinder/output/ -scripts/ZoneMinder/pm_to_blib scripts/cmake_install.cmake scripts/zm scripts/zmaudit.pl diff --git a/CMakeLists.txt b/CMakeLists.txt index 085d429cb..cbc91d1bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,7 @@ mark_as_advanced( ZM_MYSQL_ENGINE ZM_NO_MMAP CMAKE_INSTALL_FULL_BINDIR - ZM_PERL_MM_PARMS + ZM_PERL_INSTALL_PATH ZM_PERL_SEARCH_PATH ZM_TARGET_DISTRO ZM_PATH_MAP @@ -206,16 +206,10 @@ set(ZM_NO_RTSPSERVER "OFF" CACHE BOOL "Set to ON to skip building ZM with rtsp server support. default: OFF") set(ZM_NO_MQTT "OFF" CACHE BOOL "Set to ON to skip MQTT (Mosquitto) checks and force building ZM without MQTT support. default: OFF") -set(ZM_PERL_MM_PARMS INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 CACHE STRING - "By default, ZoneMinder's Perl modules are installed into the Vendor folders, - as defined by your installation of Perl. You can change that here. Consult Perl's - MakeMaker documentation for a definition of acceptable parameters. If you set this - to something that causes the modules to be installed outside Perl's normal search - path, then you will also need to set ZM_PERL_SEARCH_PATH accordingly.") set(ZM_PERL_SEARCH_PATH "" CACHE PATH "Use to add a folder to your Perl's search path. This will need to be set in cases - where ZM_PERL_MM_PARMS has been modified such that ZoneMinder's Perl modules are - installed outside Perl's default search path.") + where ZM_PERL_INSTALL_PATH has been overridden such that ZoneMinder's Perl modules + are installed outside Perl's default search path.") set(ZM_TARGET_DISTRO "" CACHE STRING "Build ZoneMinder for a specific distribution. Currently, valid names are: fc, el, OS13, FreeBSD") set(ZM_DETECT_SYSTEMD "ON" CACHE BOOL @@ -278,17 +272,12 @@ elseif(ZM_TARGET_DISTRO STREQUAL "FreeBSD") set(ZM_CONFIG_SUBDIR "/usr/local/etc/zm/conf.d") set(ZM_WEBDIR "/usr/local/share/zoneminder/www") set(ZM_CGIDIR "/usr/local/libexec/zoneminder/cgi-bin") - set(ZM_PERL_MM_PARMS "INSTALLDIRS=site") endif() if(BUILD_MAN) message(STATUS "Building man pages: Yes (default)") - set(ZM_PERL_MM_PARMS_FULL ${ZM_PERL_MM_PARMS}) else() message(STATUS "Building man pages: No") - list(APPEND ZM_PERL_MM_PARMS_FULL ${ZM_PERL_MM_PARMS} - "INSTALLMAN1DIR=none" - "INSTALLMAN3DIR=none") endif() # Required for certain checks to work @@ -642,13 +631,38 @@ if(NOT PERL_FOUND) message(FATAL_ERROR "ZoneMinder requires Perl 5.6.0 or newer but it was not found on your system") endif() +# Detect Perl module installation path +# Prefer vendorlib (standard for distro packages), fall back to sitelib +# (used on FreeBSD and systems without vendorlib configured) +execute_process( + COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{vendorlib}" + OUTPUT_VARIABLE _perl_lib_default + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _perl_result) +if(NOT _perl_result EQUAL 0 OR _perl_lib_default STREQUAL "") + execute_process( + COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{sitelib}" + OUTPUT_VARIABLE _perl_lib_default + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _perl_result) + if(NOT _perl_result EQUAL 0 OR _perl_lib_default STREQUAL "") + message(FATAL_ERROR + "Could not detect Perl vendorlib or sitelib path. " + "Set ZM_PERL_INSTALL_PATH manually.") + endif() + message(STATUS "Perl vendorlib not configured, using sitelib") +endif() +set(ZM_PERL_INSTALL_PATH "${_perl_lib_default}" CACHE PATH + "Install path for ZoneMinder Perl modules. Override for non-standard locations (also set ZM_PERL_SEARCH_PATH).") +message(STATUS "Perl module install path: ${ZM_PERL_INSTALL_PATH}") + # Checking for perl modules requires FindPerlModules.cmake # Check all required modules at once # TODO: Add checking for the optional modules find_package( PerlModules COMPONENTS Sys::Syslog DBI DBD::mysql Getopt::Long Time::HiRes Date::Manip LWP::UserAgent - ExtUtils::MakeMaker ${ZM_MMAP_PERLPACKAGE}) + ${ZM_MMAP_PERLPACKAGE}) if(NOT PERLMODULES_FOUND) message(WARNING "Not all required perl modules were found on your system") endif() diff --git a/distros/beowulf/libzoneminder-perl.install b/distros/beowulf/libzoneminder-perl.install index 67191d9cf..e27abaf5a 100644 --- a/distros/beowulf/libzoneminder-perl.install +++ b/distros/beowulf/libzoneminder-perl.install @@ -1,2 +1 @@ -usr/share/man/man3 usr/share/perl5 diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 690b5ecbd..28efa3f37 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -64,7 +64,6 @@ BuildRequires: perl(Archive::Tar) BuildRequires: perl(Archive::Zip) BuildRequires: perl(Date::Manip) BuildRequires: perl(DBD::mysql) -BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(LWP::UserAgent) BuildRequires: perl(MIME::Entity) BuildRequires: perl(MIME::Lite) diff --git a/distros/ubuntu2004/libzoneminder-perl.install b/distros/ubuntu2004/libzoneminder-perl.install index 67191d9cf..e27abaf5a 100644 --- a/distros/ubuntu2004/libzoneminder-perl.install +++ b/distros/ubuntu2004/libzoneminder-perl.install @@ -1,2 +1 @@ -usr/share/man/man3 usr/share/perl5 diff --git a/onvif/modules/CMakeLists.txt b/onvif/modules/CMakeLists.txt index 7d2101ae9..87bc74c26 100644 --- a/onvif/modules/CMakeLists.txt +++ b/onvif/modules/CMakeLists.txt @@ -1,18 +1,5 @@ # CMakeLists.txt for the ZoneMinder ONVIF modules. -# If this is an out-of-source build, copy the files we need to the binary directory -if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.PL" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" PATTERN "*.in" EXCLUDE) -endif() - -# MAKEMAKER_NOECHO_COMMAND previously defined in /scripts/zoneminder/CMakeLists.txt - -# Add build target for the perl modules -add_custom_target(zmonvifmodules ALL "${PERL_EXECUTABLE}" Makefile.PL ${ZM_PERL_MM_PARMS_FULL} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl ONVIF proxy module") - -# Add install target for the perl modules -install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "/") - -# Add additional files and directories to make clean -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "output;blib;pm_to_blib;MakefilePerl") +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALL_PATH}" + FILES_MATCHING PATTERN "*.pm") diff --git a/onvif/modules/Makefile.PL b/onvif/modules/Makefile.PL deleted file mode 100644 index b6565f149..000000000 --- a/onvif/modules/Makefile.PL +++ /dev/null @@ -1,13 +0,0 @@ -use 5.006; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'ONVIF', -# VERSION_FROM => 'lib/ZoneMinder/Base.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 -# No need to specify perl modules. MakeMaker will find them automatically - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (#ABSTRACT_FROM => 'lib/ZoneMinder.pm', # retrieve abstract from module - AUTHOR => 'Jan Hochstein') : ()), -); diff --git a/onvif/proxy/CMakeLists.txt b/onvif/proxy/CMakeLists.txt index 7b3779a9f..a93520abe 100644 --- a/onvif/proxy/CMakeLists.txt +++ b/onvif/proxy/CMakeLists.txt @@ -1,18 +1,5 @@ # CMakeLists.txt for the ZoneMinder ONVIF proxy module. -# If this is an out-of-source build, copy the files we need to the binary directory -if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.PL" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" PATTERN "*.in" EXCLUDE) -endif() - -# MAKEMAKER_NOECHO_COMMAND previously defined in /scripts/zoneminder/CMakeLists.txt - -# Add build target for the perl modules -add_custom_target(zmonvifproxy ALL "${PERL_EXECUTABLE}" Makefile.PL ${ZM_PERL_MM_PARMS_FULL} FIRST_MAKEFILE=MakefilePerl DESTDIR=${CMAKE_CURRENT_BINARY_DIR}/output ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl ONVIF proxy module") - -# Add install target for the perl modules -install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "/") - -# Add additional files and directories to make clean -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "output;blib;pm_to_blib;MakefilePerl") +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALL_PATH}" + FILES_MATCHING PATTERN "*.pm") diff --git a/onvif/proxy/Makefile.PL b/onvif/proxy/Makefile.PL deleted file mode 100644 index b6565f149..000000000 --- a/onvif/proxy/Makefile.PL +++ /dev/null @@ -1,13 +0,0 @@ -use 5.006; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'ONVIF', -# VERSION_FROM => 'lib/ZoneMinder/Base.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 -# No need to specify perl modules. MakeMaker will find them automatically - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (#ABSTRACT_FROM => 'lib/ZoneMinder.pm', # retrieve abstract from module - AUTHOR => 'Jan Hochstein') : ()), -); diff --git a/scripts/ZoneMinder/CMakeLists.txt b/scripts/ZoneMinder/CMakeLists.txt index a97756fa2..6322da9be 100644 --- a/scripts/ZoneMinder/CMakeLists.txt +++ b/scripts/ZoneMinder/CMakeLists.txt @@ -1,34 +1,23 @@ -# CMakeLists.txt for the ZoneMinder perl module. +# CMakeLists.txt for the ZoneMinder Perl modules. -# If this is an out-of-source build, copy the files we need to the binary directory -if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/Changes" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.PL" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/META.yml" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/README" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/t" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" PATTERN "*.in" EXCLUDE) -endif() +# Create configured .pm files from .pm.in templates +configure_file(lib/ZoneMinder/Base.pm.in + "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Base.pm" @ONLY) +configure_file(lib/ZoneMinder/Config.pm.in + "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Config.pm" @ONLY) +configure_file(lib/ZoneMinder/Memory.pm.in + "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Memory.pm" @ONLY) +configure_file(lib/ZoneMinder/ConfigData.pm.in + "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ConfigData.pm" @ONLY) +configure_file(lib/ZoneMinder/ONVIF.pm.in + "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ONVIF.pm" @ONLY) -# Create files from the .in files -configure_file(lib/ZoneMinder/Base.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Base.pm" @ONLY) -configure_file(lib/ZoneMinder/Config.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Config.pm" @ONLY) -configure_file(lib/ZoneMinder/Memory.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/Memory.pm" @ONLY) -configure_file(lib/ZoneMinder/ConfigData.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ConfigData.pm" @ONLY) -configure_file(lib/ZoneMinder/ONVIF.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/ZoneMinder/ONVIF.pm" @ONLY) +# Install static .pm files from source tree +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALL_PATH}" + FILES_MATCHING PATTERN "*.pm") -if(CMAKE_VERBOSE_MAKEFILE) - set(MAKEMAKER_NOECHO_COMMAND "") -else() - set(MAKEMAKER_NOECHO_COMMAND "NOECHO=\"1>/dev/null\"") -endif() - -# Add build target for the perl modules -add_custom_target(zmperlmodules ALL "${PERL_EXECUTABLE}" Makefile.PL ${ZM_PERL_MM_PARMS_FULL} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules") - -# Add install target for the perl modules -install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "/") - -# Add additional files and directories to make clean -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "output;blib;pm_to_blib;MakefilePerl") +# Install configured .pm files from build tree +install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALL_PATH}" + FILES_MATCHING PATTERN "*.pm") diff --git a/scripts/ZoneMinder/Changes b/scripts/ZoneMinder/Changes deleted file mode 100644 index cc20050e5..000000000 --- a/scripts/ZoneMinder/Changes +++ /dev/null @@ -1,6 +0,0 @@ -Revision history for Perl extension ZoneMinder. - -0.01 Thu Dec 15 17:22:29 2005 - - original version; created by h2xs 1.23 with options - -XA -b 5.6.0 -n ZoneMinder - diff --git a/scripts/ZoneMinder/MANIFEST b/scripts/ZoneMinder/MANIFEST deleted file mode 100644 index f1bd05da8..000000000 --- a/scripts/ZoneMinder/MANIFEST +++ /dev/null @@ -1,7 +0,0 @@ -Changes -Makefile.PL -MANIFEST -README -t/ZoneMinder.t -lib/ZoneMinder.pm -META.yml Module meta-data (added by MakeMaker) diff --git a/scripts/ZoneMinder/META.yml b/scripts/ZoneMinder/META.yml deleted file mode 100644 index 7d062554d..000000000 --- a/scripts/ZoneMinder/META.yml +++ /dev/null @@ -1,10 +0,0 @@ -# http://module-build.sourceforge.net/META-spec.html -#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# -name: ZoneMinder -version: 1.23.2 -version_from: lib/ZoneMinder/Base.pm -installdirs: site -requires: - -distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 diff --git a/scripts/ZoneMinder/Makefile.PL b/scripts/ZoneMinder/Makefile.PL deleted file mode 100644 index 51ba1a5a7..000000000 --- a/scripts/ZoneMinder/Makefile.PL +++ /dev/null @@ -1,13 +0,0 @@ -use 5.006; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - NAME => 'ZoneMinder', - VERSION_FROM => 'lib/ZoneMinder/Base.pm', # finds $VERSION - PREREQ_PM => {}, # e.g., Module::Name => 1.1 -# No need to specify perl modules. MakeMaker will find them automatically - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => 'lib/ZoneMinder.pm', # retrieve abstract from module - AUTHOR => 'Philip Coombes ') : ()), -); diff --git a/scripts/ZoneMinder/README b/scripts/ZoneMinder/README deleted file mode 100644 index fd005204c..000000000 --- a/scripts/ZoneMinder/README +++ /dev/null @@ -1,40 +0,0 @@ -ZoneMinder version 0.01 -======================= - -The README is used to introduce the module and provide instructions on -how to install the module, any machine dependencies it may have (for -example C compilers and installed libraries) and any other information -that should be provided before the module is installed. - -A README file is required for CPAN modules since CPAN extracts the -README file from a module distribution so that people browsing the -archive can use it get an idea of the modules uses. It is usually a -good idea to provide version information here so that people can -decide whether fixes for the module are worth downloading. - -INSTALLATION - -To install this module type the following: - - perl Makefile.PL - make - make test - make install - -DEPENDENCIES - -This module requires these other modules and libraries: - - blah blah blah - -COPYRIGHT AND LICENCE - -Put the correct copyright and licence information here. - -Copyright (C) 2005 by Philip Coombes - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.3 or, -at your option, any later version of Perl 5 you may have available. - - diff --git a/scripts/ZoneMinder/t/ZoneMinder.t b/scripts/ZoneMinder/t/ZoneMinder.t deleted file mode 100644 index 6ff60ee25..000000000 --- a/scripts/ZoneMinder/t/ZoneMinder.t +++ /dev/null @@ -1,17 +0,0 @@ -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl ZoneMinder.t' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test; -BEGIN { plan tests => 1 }; -use ZoneMinder; -ok(1); # If we made it this far, we're ok. - -######################### - -# Insert your test code below, the Test::More module is use()ed here so read -# its man page ( perldoc Test::More ) for help writing this test script. -