diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b295b883..10fd7acda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,6 @@ mark_as_advanced( ZM_MYSQL_ENGINE ZM_NO_MMAP CMAKE_INSTALL_FULL_BINDIR - ZM_PERL_MM_PARMS ZM_PERL_SEARCH_PATH ZM_TARGET_DISTRO ZM_PATH_MAP @@ -198,16 +197,9 @@ set(ZM_NO_PCRE "OFF" CACHE BOOL "Set to ON to skip libpcre2 checks and force building ZM without libpcre2. default: OFF") set(ZM_NO_RTSPSERVER "OFF" CACHE BOOL "Set to ON to skip building ZM with rtsp server 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.") + "Use to override the Perl module installation path. By default, ZoneMinder + installs Perl modules to Perl's vendorlib (or sitelib on FreeBSD).") 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 @@ -270,17 +262,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 @@ -623,13 +610,34 @@ if(NOT PERL_FOUND) message(FATAL_ERROR "ZoneMinder requires Perl 5.6.0 or newer but it was not found on your system") endif() +# Determine Perl module installation directory +# Use vendorlib by default, sitelib for FreeBSD +if(ZM_TARGET_DISTRO STREQUAL "FreeBSD") + execute_process( + COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{sitelib}" + OUTPUT_VARIABLE ZM_PERL_INSTALLDIR + OUTPUT_STRIP_TRAILING_WHITESPACE) +else() + execute_process( + COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{vendorlib}" + OUTPUT_VARIABLE ZM_PERL_INSTALLDIR + OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + +# Allow override via ZM_PERL_SEARCH_PATH +if(ZM_PERL_SEARCH_PATH) + set(ZM_PERL_INSTALLDIR "${ZM_PERL_SEARCH_PATH}") +endif() + +message(STATUS "Perl modules will be installed to: ${ZM_PERL_INSTALLDIR}") + # 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/onvif/modules/CMakeLists.txt b/onvif/modules/CMakeLists.txt index 502970af9..cb36f140e 100644 --- a/onvif/modules/CMakeLists.txt +++ b/onvif/modules/CMakeLists.txt @@ -1,18 +1,6 @@ # 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 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 the .pm files from source +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALLDIR}" + 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 779b4d47e..a7d9caa2b 100644 --- a/onvif/proxy/CMakeLists.txt +++ b/onvif/proxy/CMakeLists.txt @@ -1,18 +1,6 @@ # 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 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 the .pm files from source +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALLDIR}" + 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 2a8708d2f..5c2d5e904 100644 --- a/scripts/ZoneMinder/CMakeLists.txt +++ b/scripts/ZoneMinder/CMakeLists.txt @@ -1,16 +1,5 @@ # CMakeLists.txt for the ZoneMinder perl 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}/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 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) @@ -18,17 +7,13 @@ configure_file(lib/ZoneMinder/Memory.pm.in "${CMAKE_CURRENT_BINARY_DIR}/lib/Zone 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) -if(CMAKE_VERBOSE_MAKEFILE) - set(MAKEMAKER_NOECHO_COMMAND "") -else() - set(MAKEMAKER_NOECHO_COMMAND "NOECHO=\"1>/dev/null\"") -endif() +# Install the generated .pm files (from .in templates) +install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALLDIR}" + FILES_MATCHING PATTERN "*.pm") -# Add build target for the perl modules -add_custom_target(zmperlmodules ALL perl 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 the static .pm files from source +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/lib/" + DESTINATION "${ZM_PERL_INSTALLDIR}" + FILES_MATCHING PATTERN "*.pm" + PATTERN "*.in" EXCLUDE) 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/INSTALL.SKIP b/scripts/ZoneMinder/INSTALL.SKIP deleted file mode 100644 index 6ff6dd3c0..000000000 --- a/scripts/ZoneMinder/INSTALL.SKIP +++ /dev/null @@ -1 +0,0 @@ -\.pm\.in$ 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/MANIFEST.SKIP b/scripts/ZoneMinder/MANIFEST.SKIP deleted file mode 100644 index 6ff6dd3c0..000000000 --- a/scripts/ZoneMinder/MANIFEST.SKIP +++ /dev/null @@ -1 +0,0 @@ -\.pm\.in$ 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. -