diff --git a/CMakeLists.txt b/CMakeLists.txt index f307c632ce..1a62c9a5b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,14 +4,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(Zeek C CXX) -if ( NOT CMAKE_INSTALL_LIBDIR ) - # Currently, some sub-projects may use GNUInstallDirs.cmake to choose the - # library install dir, while others just default to "lib". For sake of - # consistency, this just overrides the former to always use "lib" in case - # it would have chosen something else, like "lib64", but a thing for the - # future may be to standardize all sub-projects to use GNUInstallDirs. - set(CMAKE_INSTALL_LIBDIR lib) -endif () +include(GNUInstallDirs) include(cmake/CommonCMakeConfig.cmake) include(cmake/FindClangTidy.cmake) @@ -60,7 +53,8 @@ endif () get_filename_component(ZEEK_SCRIPT_INSTALL_PATH ${ZEEK_SCRIPT_INSTALL_PATH} ABSOLUTE) -set(BRO_PLUGIN_INSTALL_PATH ${ZEEK_ROOT_DIR}/lib/zeek/plugins CACHE STRING "Installation path for plugins" FORCE) +set(BRO_PLUGIN_INSTALL_PATH ${CMAKE_INSTALL_FULL_LIBDIR}/zeek/plugins CACHE STRING "Installation path for plugins" FORCE) +set(PY_MOD_INSTALL_DIR ${CMAKE_INSTALL_FULL_LIBDIR}/zeekctl CACHE STRING "Installation path for Python modules" FORCE) configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev) execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink @@ -126,7 +120,7 @@ if ( NOT BINARY_PACKAGING_MODE ) # before Zeek 3.0. _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/include/bro" "${CMAKE_INSTALL_PREFIX}/include/zeek") _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/share/bro" "${CMAKE_INSTALL_PREFIX}/share/zeek") - _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/lib/bro" "${CMAKE_INSTALL_PREFIX}/lib/zeek") + _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/lib/bro" "${CMAKE_INSTALL_LIBDIR}/zeek") endif () if ( ZEEK_SANITIZERS ) @@ -514,6 +508,23 @@ CheckOptionalBuildSources(auxil/zeekctl ZeekControl INSTALL_ZEEKCTL) CheckOptionalBuildSources(auxil/zeek-aux Zeek-Aux INSTALL_AUX_TOOLS) CheckOptionalBuildSources(auxil/zeek-archiver ZeekArchiver INSTALL_ZEEK_ARCHIVER) +######################################################################## +## Transitions and cleanups + +if ( NOT BINARY_PACKAGING_MODE ) + # Remove pre-existing libdir of the old hardwired name if it is not + # the name we're now installing under. + set(_old_libdir ${CMAKE_INSTALL_PREFIX}/lib) + + install(CODE " + if ( EXISTS \"${_old_libdir}\" AND IS_DIRECTORY \"${_old_libdir}\" + AND NOT \"${_old_libdir}\" STREQUAL \"${CMAKE_INSTALL_FULL_LIBDIR}\" ) + message(STATUS \"WARNING: removing old library directory ${_old_libdir}\") + execute_process(COMMAND \"${CMAKE_COMMAND}\" -E remove_directory \"${_old_libdir}\") + endif () + ") +endif () + ######################################################################## ## Packaging Setup diff --git a/auxil/broker b/auxil/broker index 28fbb63d06..830c757d3b 160000 --- a/auxil/broker +++ b/auxil/broker @@ -1 +1 @@ -Subproject commit 28fbb63d06c9192923effc930a4b60226c35fb0e +Subproject commit 830c757d3b0ddfd2902db9bd0cd28110ba30d4b6 diff --git a/auxil/paraglob b/auxil/paraglob index 512c911c27..8dd1b45071 160000 --- a/auxil/paraglob +++ b/auxil/paraglob @@ -1 +1 @@ -Subproject commit 512c911c27aeb319430093187f85c70610d80035 +Subproject commit 8dd1b45071ad41d5f1c4e5e6d0b9e189ccb5cb1f diff --git a/auxil/zeek-aux b/auxil/zeek-aux index fbb5a21719..6a5d774c99 160000 --- a/auxil/zeek-aux +++ b/auxil/zeek-aux @@ -1 +1 @@ -Subproject commit fbb5a21719d4d00244bdd9f0d0a2f8543580a016 +Subproject commit 6a5d774c998d873071c551ad11d0e330fb2231e3 diff --git a/auxil/zeekctl b/auxil/zeekctl index f99e3265c5..80d0bec037 160000 --- a/auxil/zeekctl +++ b/auxil/zeekctl @@ -1 +1 @@ -Subproject commit f99e3265c5e7d6c45361b7d8dc03e772f66b0d4b +Subproject commit 80d0bec0379a5208d7fb36933b1483e1603f5ec8 diff --git a/cmake b/cmake index cf652b8459..0acdf4093e 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit cf652b845908a15c02e11dca3162f3eecca0a9c5 +Subproject commit 0acdf4093ebae0026327b43b850e68225d046cb7 diff --git a/configure b/configure index 0014f30834..7b74d3edf7 100755 --- a/configure +++ b/configure @@ -148,7 +148,6 @@ prefix=/usr/local/zeek CMakeCacheEntries="" append_cache_entry CMAKE_INSTALL_PREFIX PATH $prefix append_cache_entry ZEEK_ROOT_DIR PATH $prefix -append_cache_entry PY_MOD_INSTALL_DIR PATH $prefix/lib/zeekctl append_cache_entry ZEEK_SCRIPT_INSTALL_PATH STRING $prefix/share/zeek append_cache_entry ZEEK_ETC_INSTALL_DIR PATH $prefix/etc append_cache_entry ENABLE_DEBUG BOOL false @@ -203,7 +202,6 @@ while [ $# -ne 0 ]; do prefix=$optarg append_cache_entry CMAKE_INSTALL_PREFIX PATH $optarg append_cache_entry ZEEK_ROOT_DIR PATH $optarg - append_cache_entry PY_MOD_INSTALL_DIR PATH $optarg/lib/zeekctl ;; --libdir=*) append_cache_entry CMAKE_INSTALL_LIBDIR PATH $optarg diff --git a/zeek-config.in b/zeek-config.in index dea1c37411..7c8e58d723 100755 --- a/zeek-config.in +++ b/zeek-config.in @@ -5,6 +5,7 @@ build_type=@CMAKE_BUILD_TYPE_LOWER@ prefix=@CMAKE_INSTALL_PREFIX@ script_dir=@ZEEK_SCRIPT_INSTALL_PATH@ site_dir=@ZEEK_SCRIPT_INSTALL_PATH@/site +lib_dir=@CMAKE_INSTALL_FULL_LIBDIR@ plugin_dir=@BRO_PLUGIN_INSTALL_PATH@ config_dir=@ZEEK_ETC_INSTALL_DIR@ python_dir=@PY_MOD_INSTALL_DIR@ @@ -24,7 +25,7 @@ include_dir=${include_dir}:@ZEEK_CONFIG_LibKrb5_INCLUDE_DIR@ include_dir=${include_dir}:@ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR@ usage="\ -Usage: zeek-config [--version] [--build_type] [--prefix] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--include_dir] [--cmake_dir] [--zeekpath] [--zeek_dist] [--binpac_root] [--caf_root] [--broker_root]" +Usage: zeek-config [--version] [--build_type] [--prefix] [--lib_dir] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--include_dir] [--cmake_dir] [--zeekpath] [--zeek_dist] [--binpac_root] [--caf_root] [--broker_root]" if [ $# -eq 0 ] ; then echo "${usage}" 1>&2 @@ -38,14 +39,44 @@ while [ $# -ne 0 ]; do esac case $1 in - --version) - echo $version + --binpac_root) + echo $binpac_root + ;; + --bro_dist) # For compatibility with legacy Bro plugins. + echo $zeek_dist + ;; + --broker_root) + echo $broker_root + ;; + --bropath) # For compatibility with legacy Bro plugins. + echo $zeekpath + ;; + --build_type) + echo $build_type + ;; + --caf_root) + echo $caf_root + ;; + --cmake_dir) + echo $cmake_dir + ;; + --config_dir) + echo $config_dir + ;; + --include_dir) + echo $include_dir + ;; + --lib_dir) + echo $lib_dir + ;; + --plugin_dir) + echo $plugin_dir ;; --prefix) echo $prefix ;; - --build_type) - echo $build_type + --python_dir) + echo $python_dir ;; --script_dir) echo $script_dir @@ -53,41 +84,14 @@ while [ $# -ne 0 ]; do --site_dir) echo $site_dir ;; - --plugin_dir) - echo $plugin_dir - ;; - --config_dir) - echo $config_dir - ;; - --python_dir) - echo $python_dir - ;; - --cmake_dir) - echo $cmake_dir - ;; - --include_dir) - echo $include_dir - ;; - --bropath) # For compatibility with legacy Bro plugins. - echo $zeekpath - ;; - --zeekpath) - echo $zeekpath - ;; - --bro_dist) # For compatibility with legacy Bro plugins. - echo $zeek_dist + --version) + echo $version ;; --zeek_dist) echo $zeek_dist ;; - --binpac_root) - echo $binpac_root - ;; - --caf_root) - echo $caf_root - ;; - --broker_root) - echo $broker_root + --zeekpath) + echo $zeekpath ;; *) echo "${usage}" 1>&2