From 25da02fe50401a9795878d47a1856266e6585d8f Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Mon, 26 Jun 2023 10:20:56 -0700 Subject: [PATCH] Move CMake template files to separate directory --- CMakeLists.txt | 24 ++++++++++--------- ci/collect-repo-info.py | 2 +- .../hilti-cxx-include-dirs.in | 0 .../spicy-path.in | 0 .../zeek-config-paths.h.in | 0 .../zeek-config.h.in | 0 .../zeek-config.in | 0 .../zeek-path-dev.bat.in | 0 cmake_templates/zeek-path-dev.in | 14 +++++++++++ .../zeek-version.h.in | 0 .../zkg-config.in | 0 zeek-path-dev.in | 15 +----------- 12 files changed, 29 insertions(+), 26 deletions(-) rename hilti-cxx-include-dirs.in => cmake_templates/hilti-cxx-include-dirs.in (100%) rename spicy-path.in => cmake_templates/spicy-path.in (100%) rename zeek-config-paths.h.in => cmake_templates/zeek-config-paths.h.in (100%) rename zeek-config.h.in => cmake_templates/zeek-config.h.in (100%) rename zeek-config.in => cmake_templates/zeek-config.in (100%) rename zeek-path-dev.bat.in => cmake_templates/zeek-path-dev.bat.in (100%) create mode 100755 cmake_templates/zeek-path-dev.in rename zeek-version.h.in => cmake_templates/zeek-version.h.in (100%) rename zkg-config.in => cmake_templates/zkg-config.in (100%) mode change 100755 => 120000 zeek-path-dev.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 76d720c0b4..5fb9255573 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -464,7 +464,8 @@ set(zeek_script_install_path "${ZEEK_SCRIPT_INSTALL_PATH}") if (MSVC) # This has to happen before we modify the paths below so that the pure Windows # paths are stored in the output file. - configure_file(zeek-path-dev.bat.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.bat) + configure_file(cmake_templates/zeek-path-dev.bat.in + ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.bat) string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_binary_dir "${cmake_binary_dir}") string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir @@ -504,7 +505,7 @@ install(DIRECTORY DESTINATION ${ZEEK_STATE_DIR}) install(DIRECTORY DESTINATION ${ZEEK_SPOOL_DIR}) install(DIRECTORY DESTINATION ${ZEEK_LOG_DIR}) -configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev) +configure_file(cmake_templates/zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev) file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh @@ -1154,8 +1155,8 @@ endif () set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest) install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config - @ONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-config.in + ${CMAKE_CURRENT_BINARY_DIR}/zeek-config @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin) install( @@ -1179,8 +1180,8 @@ if (INSTALL_ZKG) set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg") set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in ${CMAKE_CURRENT_BINARY_DIR}/zkg-config - @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zkg-config.in + ${CMAKE_CURRENT_BINARY_DIR}/zkg-config @ONLY) install(DIRECTORY DESTINATION var/lib/zkg) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config DESTINATION ${ZEEK_ZKG_CONFIG_DIR} @@ -1270,19 +1271,20 @@ checkoptionalbuildsources(auxil/zeek-client ZeekClient INSTALL_ZEEK_CLIENT) # Generate Spicy helper scripts referenced in e.g., `zeek-path-dev.*`. These # set Spicy-side environment variables to run it out of the build directory. -configure_file(${CMAKE_SOURCE_DIR}/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path @ONLY) -configure_file(${CMAKE_SOURCE_DIR}/hilti-cxx-include-dirs.in +configure_file(${CMAKE_SOURCE_DIR}/cmake_templates/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path + @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/cmake_templates/hilti-cxx-include-dirs.in ${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-version.h.in +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-version.h.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-version.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-version.h DESTINATION include/zeek) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.h.in +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config-paths.h.in +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_templates/zeek-config-paths.h.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config-paths.h) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config-paths.h DESTINATION include/zeek) diff --git a/ci/collect-repo-info.py b/ci/collect-repo-info.py index d8bfc8201e..b8f0421a61 100755 --- a/ci/collect-repo-info.py +++ b/ci/collect-repo-info.py @@ -170,7 +170,7 @@ def main(): zeek_dir = pathlib.Path(args.dir).absolute() - if not (zeek_dir / "zeek-config.h.in").exists(): + if not (zeek_dir / "cmake_templates" / "zeek-config.h.in").exists(): logger.error("%s missing zeek-config.h.in", zeek_dir) return 1 diff --git a/hilti-cxx-include-dirs.in b/cmake_templates/hilti-cxx-include-dirs.in similarity index 100% rename from hilti-cxx-include-dirs.in rename to cmake_templates/hilti-cxx-include-dirs.in diff --git a/spicy-path.in b/cmake_templates/spicy-path.in similarity index 100% rename from spicy-path.in rename to cmake_templates/spicy-path.in diff --git a/zeek-config-paths.h.in b/cmake_templates/zeek-config-paths.h.in similarity index 100% rename from zeek-config-paths.h.in rename to cmake_templates/zeek-config-paths.h.in diff --git a/zeek-config.h.in b/cmake_templates/zeek-config.h.in similarity index 100% rename from zeek-config.h.in rename to cmake_templates/zeek-config.h.in diff --git a/zeek-config.in b/cmake_templates/zeek-config.in similarity index 100% rename from zeek-config.in rename to cmake_templates/zeek-config.in diff --git a/zeek-path-dev.bat.in b/cmake_templates/zeek-path-dev.bat.in similarity index 100% rename from zeek-path-dev.bat.in rename to cmake_templates/zeek-path-dev.bat.in diff --git a/cmake_templates/zeek-path-dev.in b/cmake_templates/zeek-path-dev.in new file mode 100755 index 0000000000..e80b2222d2 --- /dev/null +++ b/cmake_templates/zeek-path-dev.in @@ -0,0 +1,14 @@ +#!/bin/sh +# After configured by CMake, this file prints the absolute path to Zeek scripts +# that come with the source distributions of Zeek as well as scripts that are +# generated by the BIF compiler at compile time. +# +# The intended use of this script is to make it easier to run Zeek from +# the build directory, avoiding the need to install it. This could be +# done like: +# +# ZEEKPATH=`./zeek-path-dev` ./src/zeek +# +# This file should be kept in sync with the ZEEKPATH line in zeek-path-dev.bat.in. + +echo .:${cmake_source_dir}/scripts:${cmake_source_dir}/scripts/policy:${cmake_source_dir}/scripts/site:${cmake_binary_dir}/scripts:${cmake_binary_dir}/scripts/builtin-plugins diff --git a/zeek-version.h.in b/cmake_templates/zeek-version.h.in similarity index 100% rename from zeek-version.h.in rename to cmake_templates/zeek-version.h.in diff --git a/zkg-config.in b/cmake_templates/zkg-config.in similarity index 100% rename from zkg-config.in rename to cmake_templates/zkg-config.in diff --git a/zeek-path-dev.in b/zeek-path-dev.in deleted file mode 100755 index e80b2222d2..0000000000 --- a/zeek-path-dev.in +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# After configured by CMake, this file prints the absolute path to Zeek scripts -# that come with the source distributions of Zeek as well as scripts that are -# generated by the BIF compiler at compile time. -# -# The intended use of this script is to make it easier to run Zeek from -# the build directory, avoiding the need to install it. This could be -# done like: -# -# ZEEKPATH=`./zeek-path-dev` ./src/zeek -# -# This file should be kept in sync with the ZEEKPATH line in zeek-path-dev.bat.in. - -echo .:${cmake_source_dir}/scripts:${cmake_source_dir}/scripts/policy:${cmake_source_dir}/scripts/site:${cmake_binary_dir}/scripts:${cmake_binary_dir}/scripts/builtin-plugins diff --git a/zeek-path-dev.in b/zeek-path-dev.in new file mode 120000 index 0000000000..1cf9428296 --- /dev/null +++ b/zeek-path-dev.in @@ -0,0 +1 @@ +cmake_templates/zeek-path-dev.in \ No newline at end of file