mirror of
https://github.com/zeek/zeek.git
synced 2025-10-01 22:28:20 +00:00
Use the same rules as cmake submodule to reformat Zeek
This commit is contained in:
parent
fd72d81bad
commit
84e3f414a7
125 changed files with 1423 additions and 1670 deletions
80
.cmake-format.json
Normal file
80
.cmake-format.json
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
{
|
||||||
|
"parse": {
|
||||||
|
"additional_commands": {
|
||||||
|
"CheckIPProto": {
|
||||||
|
"kwargs": {
|
||||||
|
"_proto": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CheckType": {
|
||||||
|
"kwargs": {
|
||||||
|
"_type": "*",
|
||||||
|
"_alt_type": "*",
|
||||||
|
"_var": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SetPackageVersion": {
|
||||||
|
"kwargs": {
|
||||||
|
"_version": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SetPackageFileName": {
|
||||||
|
"kwargs": {
|
||||||
|
"_version": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SetPackageInstallScripts": {
|
||||||
|
"kwargs": {
|
||||||
|
"VERSION": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ConfigurePackaging": {
|
||||||
|
"kwargs": {
|
||||||
|
"_version": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SetPackageGenerators": {},
|
||||||
|
"SetPackageMetadata": {},
|
||||||
|
"FindRequiredPackage": {
|
||||||
|
"kwargs": {
|
||||||
|
"packageName": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"InstallClobberImmune": {
|
||||||
|
"kwargs": {
|
||||||
|
"_srcfile": "*",
|
||||||
|
"_dstfile": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"InstallPackageConfigFile": {
|
||||||
|
"kwargs": {
|
||||||
|
"_srcfile": "*",
|
||||||
|
"_dstdir": "*",
|
||||||
|
"_dstfilename": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"InstallShellScript": {
|
||||||
|
"kwargs": {
|
||||||
|
"_srcfile": "*",
|
||||||
|
"_dstfile": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"InstallSymLink": {
|
||||||
|
"kwargs": {
|
||||||
|
"_filepath": "*",
|
||||||
|
"_sympath": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"format": {
|
||||||
|
"line_width": 100,
|
||||||
|
"tab_size": 4,
|
||||||
|
"separate_ctrl_name_with_space": true,
|
||||||
|
"max_subgroups_hwrap": 3,
|
||||||
|
"line_ending": "unix"
|
||||||
|
},
|
||||||
|
"markup": {
|
||||||
|
"enable_markup": false
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,3 +17,9 @@ repos:
|
||||||
rev: v0.31.0
|
rev: v0.31.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: yapf
|
- id: yapf
|
||||||
|
|
||||||
|
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
||||||
|
rev: v0.6.13
|
||||||
|
hooks:
|
||||||
|
- id: cmake-format
|
||||||
|
exclude: '^auxil/.*$'
|
||||||
|
|
486
CMakeLists.txt
486
CMakeLists.txt
|
@ -9,7 +9,6 @@ endif()
|
||||||
|
|
||||||
project(Zeek C CXX)
|
project(Zeek C CXX)
|
||||||
|
|
||||||
|
|
||||||
# We want to set ENABLE_DEBUG to ON by default if the build type is Debug.
|
# We want to set ENABLE_DEBUG to ON by default if the build type is Debug.
|
||||||
set(ENABLE_DEBUG_DEFAULT OFF)
|
set(ENABLE_DEBUG_DEFAULT OFF)
|
||||||
if (NOT GENERATOR_IS_MULTI_CONFIG)
|
if (NOT GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
@ -59,8 +58,8 @@ set(ZEEK_SCRIPT_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/share/zeek"
|
||||||
set(ZEEK_ETC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc"
|
set(ZEEK_ETC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc"
|
||||||
CACHE PATH "Install directory for Zeek configuration files.")
|
CACHE PATH "Install directory for Zeek configuration files.")
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL
|
||||||
CACHE INTERNAL "Whether to write a JSON compile commands database")
|
"Whether to write a JSON compile commands database")
|
||||||
|
|
||||||
set(ZEEK_CXX_STD cxx_std_17 CACHE STRING "The C++ standard to use.")
|
set(ZEEK_CXX_STD cxx_std_17 CACHE STRING "The C++ standard to use.")
|
||||||
|
|
||||||
|
@ -85,8 +84,7 @@ if ( MSVC )
|
||||||
CMAKE_C_FLAGS
|
CMAKE_C_FLAGS
|
||||||
CMAKE_C_FLAGS_DEBUG
|
CMAKE_C_FLAGS_DEBUG
|
||||||
CMAKE_C_FLAGS_RELEASE
|
CMAKE_C_FLAGS_RELEASE
|
||||||
CMAKE_C_FLAGS_RELWITHDEBINFO
|
CMAKE_C_FLAGS_RELWITHDEBINFO)
|
||||||
)
|
|
||||||
foreach (CompilerFlag ${CompilerFlags})
|
foreach (CompilerFlag ${CompilerFlags})
|
||||||
string(REGEX REPLACE "[/|-]MDd" "" ${CompilerFlag} "${${CompilerFlag}}")
|
string(REGEX REPLACE "[/|-]MDd" "" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
string(REGEX REPLACE "[/|-]MD" "" ${CompilerFlag} "${${CompilerFlag}}")
|
string(REGEX REPLACE "[/|-]MD" "" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
@ -98,12 +96,10 @@ if ( MSVC )
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
# Set compilation flags for Windows
|
# Set compilation flags for Windows
|
||||||
add_compile_options(
|
add_compile_options(/guard:cf # required by CheckCFlags
|
||||||
/guard:cf # required by CheckCFlags
|
|
||||||
/Z7) # required by CheckCFlags
|
/Z7) # required by CheckCFlags
|
||||||
|
|
||||||
add_link_options(
|
add_link_options(/debug:full # required by CheckCFlags
|
||||||
/debug:full # required by CheckCFlags
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set always to static runtime
|
# Set always to static runtime
|
||||||
|
@ -125,8 +121,7 @@ if ( MSVC )
|
||||||
conan_cmake_autodetect(settings)
|
conan_cmake_autodetect(settings)
|
||||||
# Install packages from conanfile
|
# Install packages from conanfile
|
||||||
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR}/ci/windows/conanfile_windows.txt
|
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR}/ci/windows/conanfile_windows.txt
|
||||||
BUILD missing
|
BUILD missing SETTINGS ${settings})
|
||||||
SETTINGS ${settings})
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Set LibPCAP to point to libpcap binaries.
|
# Set LibPCAP to point to libpcap binaries.
|
||||||
|
@ -151,7 +146,8 @@ if ( MSVC )
|
||||||
add_definitions(-DCARES_STATICLIB)
|
add_definitions(-DCARES_STATICLIB)
|
||||||
|
|
||||||
add_subdirectory(auxil/libunistd)
|
add_subdirectory(auxil/libunistd)
|
||||||
set(UNISTD_INCLUDES ${CMAKE_SOURCE_DIR}/auxil/libunistd/unistd ${CMAKE_SOURCE_DIR}/auxil/libunistd/regex)
|
set(UNISTD_INCLUDES ${CMAKE_SOURCE_DIR}/auxil/libunistd/unistd
|
||||||
|
${CMAKE_SOURCE_DIR}/auxil/libunistd/regex)
|
||||||
include_directories(BEFORE ${UNISTD_INCLUDES})
|
include_directories(BEFORE ${UNISTD_INCLUDES})
|
||||||
# Required for `check_include_files` to operate correctly
|
# Required for `check_include_files` to operate correctly
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${UNISTD_INCLUDES})
|
list(APPEND CMAKE_REQUIRED_INCLUDES ${UNISTD_INCLUDES})
|
||||||
|
@ -173,8 +169,8 @@ include(cmake/CommonCMakeConfig.cmake)
|
||||||
include(cmake/FindClangTidy.cmake)
|
include(cmake/FindClangTidy.cmake)
|
||||||
include(cmake/CheckCompilerArch.cmake)
|
include(cmake/CheckCompilerArch.cmake)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Main targets and utilities.
|
# Main targets and utilities.
|
||||||
|
|
||||||
# Variable for referring back to Zeek's top-level source dir. Used for plugins
|
# Variable for referring back to Zeek's top-level source dir. Used for plugins
|
||||||
# to tell them where to find the Zeek headers.
|
# to tell them where to find the Zeek headers.
|
||||||
|
@ -184,8 +180,8 @@ set(ZEEK_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
# zeek-plugin-create-package.sh. Needed by ZeekPluginConfig.cmake.in.
|
# zeek-plugin-create-package.sh. Needed by ZeekPluginConfig.cmake.in.
|
||||||
set(ZEEK_PLUGIN_SCRIPTS_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
set(ZEEK_PLUGIN_SCRIPTS_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
# Our C++17 base target for propagating compiler and linker flags.
|
# Our C++17 base target for propagating compiler and linker flags. Note: for
|
||||||
# Note: for now, we only use it for passing library dependencies around.
|
# now, we only use it for passing library dependencies around.
|
||||||
add_library(zeek_internal INTERFACE)
|
add_library(zeek_internal INTERFACE)
|
||||||
add_library(Zeek::Internal ALIAS zeek_internal)
|
add_library(Zeek::Internal ALIAS zeek_internal)
|
||||||
set_target_properties(zeek_internal PROPERTIES EXPORT_NAME Internal)
|
set_target_properties(zeek_internal PROPERTIES EXPORT_NAME Internal)
|
||||||
|
@ -272,39 +268,26 @@ endfunction()
|
||||||
# loaded plugins. Also propagates include paths and C++17 mode on the install
|
# loaded plugins. Also propagates include paths and C++17 mode on the install
|
||||||
# interface.
|
# interface.
|
||||||
add_library(zeek_dynamic_plugin_base INTERFACE)
|
add_library(zeek_dynamic_plugin_base INTERFACE)
|
||||||
target_link_libraries(zeek_dynamic_plugin_base
|
target_link_libraries(zeek_dynamic_plugin_base INTERFACE $<BUILD_INTERFACE:zeek_internal>)
|
||||||
INTERFACE
|
target_include_directories(
|
||||||
$<BUILD_INTERFACE:zeek_internal>)
|
zeek_dynamic_plugin_base
|
||||||
target_include_directories(zeek_dynamic_plugin_base
|
INTERFACE $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||||
INTERFACE
|
|
||||||
$<INSTALL_INTERFACE:include>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
|
||||||
target_compile_features(zeek_dynamic_plugin_base INTERFACE ${ZEEK_CXX_STD})
|
target_compile_features(zeek_dynamic_plugin_base INTERFACE ${ZEEK_CXX_STD})
|
||||||
add_library(Zeek::DynamicPluginBase ALIAS zeek_dynamic_plugin_base)
|
add_library(Zeek::DynamicPluginBase ALIAS zeek_dynamic_plugin_base)
|
||||||
set_target_properties(
|
set_target_properties(zeek_dynamic_plugin_base PROPERTIES EXPORT_NAME DynamicPluginBase)
|
||||||
zeek_dynamic_plugin_base PROPERTIES
|
|
||||||
EXPORT_NAME DynamicPluginBase)
|
|
||||||
install(TARGETS zeek_dynamic_plugin_base EXPORT ZeekTargets)
|
install(TARGETS zeek_dynamic_plugin_base EXPORT ZeekTargets)
|
||||||
|
|
||||||
# On macOS, we need to tell the linker that the modules are allowed to have
|
# On macOS, we need to tell the linker that the modules are allowed to have
|
||||||
# undefined symbols.
|
# undefined symbols.
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
target_link_options(
|
target_link_options(zeek_dynamic_plugin_base INTERFACE -undefined dynamic_lookup
|
||||||
zeek_dynamic_plugin_base
|
|
||||||
INTERFACE
|
|
||||||
-undefined
|
|
||||||
dynamic_lookup
|
|
||||||
-Wl,-bind_at_load)
|
-Wl,-bind_at_load)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
function (add_zeek_dynamic_plugin_build_interface_include_directories)
|
function (add_zeek_dynamic_plugin_build_interface_include_directories)
|
||||||
foreach (path ${ARGV})
|
foreach (path ${ARGV})
|
||||||
target_include_directories(
|
target_include_directories(zeek_dynamic_plugin_base INTERFACE $<BUILD_INTERFACE:${path}>)
|
||||||
zeek_dynamic_plugin_base
|
|
||||||
INTERFACE
|
|
||||||
$<BUILD_INTERFACE:${path}>
|
|
||||||
)
|
|
||||||
endforeach ()
|
endforeach ()
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
|
@ -317,21 +300,13 @@ add_zeek_dynamic_plugin_build_interface_include_directories(
|
||||||
${CMAKE_BINARY_DIR}/src
|
${CMAKE_BINARY_DIR}/src
|
||||||
${CMAKE_BINARY_DIR}/src/include
|
${CMAKE_BINARY_DIR}/src/include
|
||||||
${CMAKE_BINARY_DIR}/auxil/binpac/lib
|
${CMAKE_BINARY_DIR}/auxil/binpac/lib
|
||||||
${CMAKE_BINARY_DIR}/auxil/broker/include
|
${CMAKE_BINARY_DIR}/auxil/broker/include)
|
||||||
)
|
|
||||||
|
|
||||||
# Convenience function for adding an OBJECT library that feeds directly into the
|
# Convenience function for adding an OBJECT library that feeds directly into the
|
||||||
# main target(s).
|
# main target(s).
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage: zeek_add_subdir_library( <name> SOURCES ... [INCLUDE_DIRS ...]
|
||||||
# zeek_add_subdir_library(
|
# [DEPENDENCIES ...] [INTERNAL_DEPENDENCIES ...] [BIFS ...] )
|
||||||
# <name>
|
|
||||||
# SOURCES ...
|
|
||||||
# [INCLUDE_DIRS ...]
|
|
||||||
# [DEPENDENCIES ...]
|
|
||||||
# [INTERNAL_DEPENDENCIES ...]
|
|
||||||
# [BIFS ...]
|
|
||||||
# )
|
|
||||||
function (zeek_add_subdir_library name)
|
function (zeek_add_subdir_library name)
|
||||||
# Parse arguments.
|
# Parse arguments.
|
||||||
set(fn_varargs INCLUDE_DIRS DEPENDENCIES INTERNAL_DEPENDENCIES SOURCES BIFS)
|
set(fn_varargs INCLUDE_DIRS DEPENDENCIES INTERNAL_DEPENDENCIES SOURCES BIFS)
|
||||||
|
@ -357,11 +332,7 @@ function(zeek_add_subdir_library name)
|
||||||
|
|
||||||
# Optionally add include directories and extra dependencies.
|
# Optionally add include directories and extra dependencies.
|
||||||
if (FN_ARGS_INCLUDE_DIRS)
|
if (FN_ARGS_INCLUDE_DIRS)
|
||||||
target_include_directories(
|
target_include_directories(${target_name} BEFORE PRIVATE ${FN_ARGS_INCLUDE_DIRS})
|
||||||
${target_name}
|
|
||||||
BEFORE
|
|
||||||
PRIVATE
|
|
||||||
${FN_ARGS_INCLUDE_DIRS})
|
|
||||||
endif ()
|
endif ()
|
||||||
if (FN_ARGS_DEPENDENCIES)
|
if (FN_ARGS_DEPENDENCIES)
|
||||||
target_link_libraries(${target_name} PRIVATE ${FN_ARGS_DEPENDENCIES})
|
target_link_libraries(${target_name} PRIVATE ${FN_ARGS_DEPENDENCIES})
|
||||||
|
@ -374,19 +345,15 @@ function(zeek_add_subdir_library name)
|
||||||
zeek_target_link_libraries(${target_name})
|
zeek_target_link_libraries(${target_name})
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Utility function for forcing CMake to re-run if files change on disk.
|
# Utility function for forcing CMake to re-run if files change on disk.
|
||||||
|
|
||||||
function (zeek_watch_files)
|
function (zeek_watch_files)
|
||||||
set_property(
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${ARGN})
|
||||||
DIRECTORY
|
|
||||||
APPEND
|
|
||||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${ARGN}
|
|
||||||
)
|
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Create empty __load__.zeek stubs (override pre-existing ones).
|
# Create empty __load__.zeek stubs (override pre-existing ones).
|
||||||
|
|
||||||
function (zeek_create_load_script_stubs)
|
function (zeek_create_load_script_stubs)
|
||||||
set(file_comment "# Warning, this is an autogenerated file!\n")
|
set(file_comment "# Warning, this is an autogenerated file!\n")
|
||||||
|
@ -397,14 +364,11 @@ function(zeek_create_load_script_stubs)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
# Note: these files are filled from BifCl.cmake via `file(APPEND ...)`
|
# Note: these files are filled from BifCl.cmake via `file(APPEND ...)`
|
||||||
zeek_create_load_script_stubs(
|
zeek_create_load_script_stubs(scripts/builtin-plugins/__load__.zeek
|
||||||
scripts/builtin-plugins/__load__.zeek
|
scripts/base/bif/plugins/__load__.zeek scripts/base/bif/__load__.zeek)
|
||||||
scripts/base/bif/plugins/__load__.zeek
|
|
||||||
scripts/base/bif/__load__.zeek
|
|
||||||
)
|
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Create empty __all__*.cc stubs (override pre-existing ones).
|
# Create empty __all__*.cc stubs (override pre-existing ones).
|
||||||
|
|
||||||
function (zeek_create_bif_autogen_stubs)
|
function (zeek_create_bif_autogen_stubs)
|
||||||
set(file_comment "// Warning, this is an autogenerated file!\n")
|
set(file_comment "// Warning, this is an autogenerated file!\n")
|
||||||
|
@ -415,14 +379,11 @@ function(zeek_create_bif_autogen_stubs)
|
||||||
endfunction ()
|
endfunction ()
|
||||||
|
|
||||||
# Note: these files are filled from BifCl.cmake via `file(APPEND ...)`.
|
# Note: these files are filled from BifCl.cmake via `file(APPEND ...)`.
|
||||||
zeek_create_bif_autogen_stubs(
|
zeek_create_bif_autogen_stubs(src/__all__.bif.cc src/__all__.bif.init.cc
|
||||||
src/__all__.bif.cc
|
src/__all__.bif.register.cc)
|
||||||
src/__all__.bif.init.cc
|
|
||||||
src/__all__.bif.register.cc
|
|
||||||
)
|
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Project/Build Configuration
|
# Project/Build Configuration
|
||||||
|
|
||||||
if (ZEEK_ENABLE_FUZZERS)
|
if (ZEEK_ENABLE_FUZZERS)
|
||||||
# Fuzzers use shared lib to save disk space, so need -fPIC on everything
|
# Fuzzers use shared lib to save disk space, so need -fPIC on everything
|
||||||
|
@ -459,18 +420,17 @@ if (NOT ZEEK_MAN_INSTALL_PATH)
|
||||||
set(ZEEK_MAN_INSTALL_PATH ${ZEEK_ROOT_DIR}/share/man)
|
set(ZEEK_MAN_INSTALL_PATH ${ZEEK_ROOT_DIR}/share/man)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# sanitize the Zeek script install directory into an absolute path
|
# sanitize the Zeek script install directory into an absolute path (CMake is
|
||||||
# (CMake is confused by ~ as a representation of home directory)
|
# confused by ~ as a representation of home directory)
|
||||||
get_filename_component(ZEEK_SCRIPT_INSTALL_PATH ${ZEEK_SCRIPT_INSTALL_PATH}
|
get_filename_component(ZEEK_SCRIPT_INSTALL_PATH ${ZEEK_SCRIPT_INSTALL_PATH} ABSOLUTE)
|
||||||
ABSOLUTE)
|
|
||||||
|
|
||||||
# A folder for library-like Zeek-specific things: Python modules, Zeek
|
# A folder for library-like Zeek-specific things: Python modules, Zeek plugins,
|
||||||
# plugins, etc.
|
# etc.
|
||||||
set(ZEEK_LIBDIR_PATH ${CMAKE_INSTALL_FULL_LIBDIR}/zeek)
|
set(ZEEK_LIBDIR_PATH ${CMAKE_INSTALL_FULL_LIBDIR}/zeek)
|
||||||
|
|
||||||
if (NOT ZEEK_PLUGIN_DIR)
|
if (NOT ZEEK_PLUGIN_DIR)
|
||||||
set(ZEEK_PLUGIN_DIR ${ZEEK_LIBDIR_PATH}/plugins
|
set(ZEEK_PLUGIN_DIR ${ZEEK_LIBDIR_PATH}/plugins CACHE STRING "Installation path for plugins"
|
||||||
CACHE STRING "Installation path for plugins" FORCE)
|
FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(cmake_binary_dir "${CMAKE_BINARY_DIR}")
|
set(cmake_binary_dir "${CMAKE_BINARY_DIR}")
|
||||||
|
@ -479,15 +439,18 @@ set(cmake_install_prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(cmake_source_dir "${CMAKE_SOURCE_DIR}")
|
set(cmake_source_dir "${CMAKE_SOURCE_DIR}")
|
||||||
set(zeek_script_install_path "${ZEEK_SCRIPT_INSTALL_PATH}")
|
set(zeek_script_install_path "${ZEEK_SCRIPT_INSTALL_PATH}")
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# This has to happen before we modify the paths below so that
|
# This has to happen before we modify the paths below so that the pure Windows
|
||||||
# the pure Windows paths are stored in the output file.
|
# paths are stored in the output file.
|
||||||
configure_file(zeek-path-dev.bat.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.bat)
|
configure_file(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_binary_dir "${cmake_binary_dir}")
|
||||||
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir "${cmake_current_binary_dir}")
|
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_current_binary_dir
|
||||||
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_install_prefix "${cmake_install_prefix}")
|
"${cmake_current_binary_dir}")
|
||||||
|
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_install_prefix
|
||||||
|
"${cmake_install_prefix}")
|
||||||
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_source_dir "${cmake_source_dir}")
|
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" cmake_source_dir "${cmake_source_dir}")
|
||||||
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" zeek_script_install_path "${zeek_script_install_path}")
|
string(REGEX REPLACE "^([A-Za-z]):/(.*)" "/\\1/\\2" zeek_script_install_path
|
||||||
|
"${zeek_script_install_path}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Set the path where we install the ZeekConfig.cmake file and related files.
|
# Set the path where we install the ZeekConfig.cmake file and related files.
|
||||||
|
@ -520,14 +483,16 @@ install(DIRECTORY DESTINATION ${ZEEK_LOG_DIR})
|
||||||
|
|
||||||
configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev)
|
configure_file(zeek-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev)
|
||||||
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh
|
file(
|
||||||
|
WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.sh
|
||||||
"export ZEEKPATH=`${cmake_binary_dir}/zeek-path-dev`\n"
|
"export ZEEKPATH=`${cmake_binary_dir}/zeek-path-dev`\n"
|
||||||
"export ZEEK_PLUGIN_PATH=\"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n"
|
"export ZEEK_PLUGIN_PATH=\"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n"
|
||||||
"export PATH=\"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n"
|
"export PATH=\"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n"
|
||||||
"export SPICY_PATH=`${cmake_binary_dir}/spicy-path`\n"
|
"export SPICY_PATH=`${cmake_binary_dir}/spicy-path`\n"
|
||||||
"export HILTI_CXX_INCLUDE_DIRS=`${cmake_binary_dir}/hilti-cxx-include-dirs`\n")
|
"export HILTI_CXX_INCLUDE_DIRS=`${cmake_binary_dir}/hilti-cxx-include-dirs`\n")
|
||||||
|
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.csh
|
file(
|
||||||
|
WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.csh
|
||||||
"setenv ZEEKPATH `${cmake_binary_dir}/zeek-path-dev`\n"
|
"setenv ZEEKPATH `${cmake_binary_dir}/zeek-path-dev`\n"
|
||||||
"setenv ZEEK_PLUGIN_PATH \"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n"
|
"setenv ZEEK_PLUGIN_PATH \"${cmake_binary_dir}/src\":$\{ZEEK_PLUGIN_PATH\}\n"
|
||||||
"setenv PATH \"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n"
|
"setenv PATH \"${cmake_binary_dir}\":\"${cmake_binary_dir}/src\":\"${cmake_binary_dir}/auxil/spicy/spicy/bin\":\"${cmake_binary_dir}/src/builtin-plugins/spicy-plugin/bin\":$\{PATH\}\n"
|
||||||
|
@ -535,7 +500,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zeek-path-dev.csh
|
||||||
"setenv HILTI_CXX_INCLUDE_DIRS \"`${cmake_binary_dir}/hilti-cxx-include-dirs`\"\n")
|
"setenv HILTI_CXX_INCLUDE_DIRS \"`${cmake_binary_dir}/hilti-cxx-include-dirs`\"\n")
|
||||||
|
|
||||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1)
|
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1)
|
||||||
execute_process(COMMAND grep "^constexpr int PLUGIN_API_VERSION"
|
execute_process(
|
||||||
|
COMMAND grep "^constexpr int PLUGIN_API_VERSION"
|
||||||
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/Plugin.h
|
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin/Plugin.h
|
||||||
OUTPUT_VARIABLE API_VERSION
|
OUTPUT_VARIABLE API_VERSION
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
@ -564,7 +530,8 @@ endif()
|
||||||
|
|
||||||
if (NOT BINARY_PACKAGING_MODE)
|
if (NOT BINARY_PACKAGING_MODE)
|
||||||
macro (_make_install_dir_symlink _target _link)
|
macro (_make_install_dir_symlink _target _link)
|
||||||
install(CODE "
|
install(
|
||||||
|
CODE "
|
||||||
if ( \"\$ENV{DESTDIR}\" STREQUAL \"\" )
|
if ( \"\$ENV{DESTDIR}\" STREQUAL \"\" )
|
||||||
if ( EXISTS \"${_target}\" AND NOT EXISTS \"${_link}\" )
|
if ( EXISTS \"${_target}\" AND NOT EXISTS \"${_link}\" )
|
||||||
message(STATUS \"WARNING: installed ${_link} as symlink to ${_target}\")
|
message(STATUS \"WARNING: installed ${_link} as symlink to ${_target}\")
|
||||||
|
@ -576,24 +543,26 @@ if ( NOT BINARY_PACKAGING_MODE )
|
||||||
endmacro ()
|
endmacro ()
|
||||||
|
|
||||||
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local/zeek")
|
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local/zeek")
|
||||||
# If we're installing into the default prefix, check if the
|
# If we're installing into the default prefix, check if the old default
|
||||||
# old default prefix already exists and symlink to it.
|
# prefix already exists and symlink to it. This is done to help keep custom
|
||||||
# This is done to help keep custom user configuration/installation
|
# user configuration/installation if they're upgrading from a version before
|
||||||
# if they're upgrading from a version before Zeek 3.0.
|
# Zeek 3.0.
|
||||||
_make_install_dir_symlink("/usr/local/bro" "/usr/local/zeek")
|
_make_install_dir_symlink("/usr/local/bro" "/usr/local/zeek")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Check whether we need to symlink directories used by versions
|
# Check whether we need to symlink directories used by versions before Zeek
|
||||||
# before Zeek 3.0.
|
# 3.0.
|
||||||
_make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/include/bro" "${CMAKE_INSTALL_PREFIX}/include/zeek")
|
_make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/include/bro"
|
||||||
_make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/share/bro" "${CMAKE_INSTALL_PREFIX}/share/zeek")
|
"${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_FULL_LIBDIR}/zeek")
|
_make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/lib/bro" "${CMAKE_INSTALL_FULL_LIBDIR}/zeek")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ZEEK_SANITIZERS)
|
if (ZEEK_SANITIZERS)
|
||||||
# Check the thread library info early as setting compiler flags seems to
|
# Check the thread library info early as setting compiler flags seems to
|
||||||
# interfere with the detection and cause CMAKE_THREAD_LIBS_INIT to not
|
# interfere with the detection and cause CMAKE_THREAD_LIBS_INIT to not include
|
||||||
# include -lpthread when it should.
|
# -lpthread when it should.
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
string(REPLACE "," " " _sanitizer_args "${ZEEK_SANITIZERS}")
|
string(REPLACE "," " " _sanitizer_args "${ZEEK_SANITIZERS}")
|
||||||
|
@ -619,37 +588,42 @@ if ( ZEEK_SANITIZERS )
|
||||||
# list(APPEND _check_list "alignment") # TODO: fix associated errors
|
# list(APPEND _check_list "alignment") # TODO: fix associated errors
|
||||||
list(APPEND _check_list "bool")
|
list(APPEND _check_list "bool")
|
||||||
# list(APPEND _check_list "builtin") # Not implemented in older GCCs
|
# list(APPEND _check_list "builtin") # Not implemented in older GCCs
|
||||||
list(APPEND _check_list "bounds") # Covers both array/local bounds options below
|
list(APPEND _check_list "bounds") # Covers both array/local bounds
|
||||||
|
# options below
|
||||||
# list(APPEND _check_list "array-bounds") # Not implemented by GCC
|
# list(APPEND _check_list "array-bounds") # Not implemented by GCC
|
||||||
# list(APPEND _check_list "local-bounds") # Not normally part of "undefined"
|
# list(APPEND _check_list "local-bounds") # Not normally part of
|
||||||
|
# "undefined"
|
||||||
list(APPEND _check_list "enum")
|
list(APPEND _check_list "enum")
|
||||||
list(APPEND _check_list "float-cast-overflow")
|
list(APPEND _check_list "float-cast-overflow")
|
||||||
list(APPEND _check_list "float-divide-by-zero")
|
list(APPEND _check_list "float-divide-by-zero")
|
||||||
# list(APPEND _check_list "function") # Not implemented by GCC
|
# list(APPEND _check_list "function") # Not implemented by GCC
|
||||||
# list(APPEND _check_list "implicit-unsigned-integer-truncation") # Not truly UB
|
# list(APPEND _check_list "implicit-unsigned-integer-truncation") # Not
|
||||||
# list(APPEND _check_list "implicit-signed-integer-truncation") # Not truly UB
|
# truly UB list(APPEND _check_list "implicit-signed-integer-truncation")
|
||||||
# list(APPEND _check_list "implicit-integer-sign-change") # Not truly UB
|
# # Not truly UB list(APPEND _check_list "implicit-integer-sign-change")
|
||||||
|
# # Not truly UB
|
||||||
list(APPEND _check_list "integer-divide-by-zero")
|
list(APPEND _check_list "integer-divide-by-zero")
|
||||||
list(APPEND _check_list "nonnull-attribute")
|
list(APPEND _check_list "nonnull-attribute")
|
||||||
list(APPEND _check_list "null")
|
list(APPEND _check_list "null")
|
||||||
# list(APPEND _check_list "nullability-arg") # Not normally part of "undefined"
|
# list(APPEND _check_list "nullability-arg") # Not normally part of
|
||||||
# list(APPEND _check_list "nullability-assign") # Not normally part of "undefined"
|
# "undefined" list(APPEND _check_list "nullability-assign") # Not
|
||||||
# list(APPEND _check_list "nullability-return") # Not normally part of "undefined"
|
# normally part of "undefined" list(APPEND _check_list
|
||||||
# list(APPEND _check_list "objc-cast") # Not truly UB
|
# "nullability-return") # Not normally part of "undefined" list(APPEND
|
||||||
# list(APPEND _check_list "pointer-overflow") # Not implemented in older GCCs
|
# _check_list "objc-cast") # Not truly UB list(APPEND _check_list
|
||||||
|
# "pointer-overflow") # Not implemented in older GCCs
|
||||||
list(APPEND _check_list "return")
|
list(APPEND _check_list "return")
|
||||||
list(APPEND _check_list "returns-nonnull-attribute")
|
list(APPEND _check_list "returns-nonnull-attribute")
|
||||||
list(APPEND _check_list "shift")
|
list(APPEND _check_list "shift")
|
||||||
# list(APPEND _check_list "unsigned-shift-base") # Not implemented by GCC
|
# list(APPEND _check_list "unsigned-shift-base") # Not implemented by
|
||||||
|
# GCC
|
||||||
list(APPEND _check_list "signed-integer-overflow")
|
list(APPEND _check_list "signed-integer-overflow")
|
||||||
list(APPEND _check_list "unreachable")
|
list(APPEND _check_list "unreachable")
|
||||||
# list(APPEND _check_list "unsigned-integer-overflow") # Not truly UB
|
# list(APPEND _check_list "unsigned-integer-overflow") # Not truly UB
|
||||||
list(APPEND _check_list "vla-bound")
|
list(APPEND _check_list "vla-bound")
|
||||||
list(APPEND _check_list "vptr")
|
list(APPEND _check_list "vptr")
|
||||||
|
|
||||||
# Clang complains if this one is defined and the optimizer is set to -O0. We
|
# Clang complains if this one is defined and the optimizer is set to
|
||||||
# only set that optimization level if NO_OPTIMIZATIONS is passed, so disable
|
# -O0. We only set that optimization level if NO_OPTIMIZATIONS is
|
||||||
# the option if that's set.
|
# passed, so disable the option if that's set.
|
||||||
if (NOT DEFINED ENV{NO_OPTIMIZATIONS})
|
if (NOT DEFINED ENV{NO_OPTIMIZATIONS})
|
||||||
list(APPEND _check_list "object-size")
|
list(APPEND _check_list "object-size")
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -666,9 +640,10 @@ if ( ZEEK_SANITIZERS )
|
||||||
|
|
||||||
set(_sanitizer_flags "-fsanitize=${ZEEK_SANITIZERS}")
|
set(_sanitizer_flags "-fsanitize=${ZEEK_SANITIZERS}")
|
||||||
|
|
||||||
# The linker command used by check_cxx_compiler_flag requires you to also pass the sanitizer to
|
# The linker command used by check_cxx_compiler_flag requires you to also pass
|
||||||
# it or it fails. The best way to do this is to set CMAKE_REQUIRED_LINK_OPTIONS, but save off a
|
# the sanitizer to it or it fails. The best way to do this is to set
|
||||||
# copy of it so it can be reset back to what it was previously afterwards.
|
# CMAKE_REQUIRED_LINK_OPTIONS, but save off a copy of it so it can be reset
|
||||||
|
# back to what it was previously afterwards.
|
||||||
set(_temp_link_options ${CMAKE_REQUIRED_LINK_OPTIONS})
|
set(_temp_link_options ${CMAKE_REQUIRED_LINK_OPTIONS})
|
||||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${_sanitizer_flags})
|
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${_sanitizer_flags})
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
@ -679,7 +654,8 @@ if ( ZEEK_SANITIZERS )
|
||||||
set(CMAKE_REQUIRED_LINK_OPTIONS ${_temp_link_options})
|
set(CMAKE_REQUIRED_LINK_OPTIONS ${_temp_link_options})
|
||||||
|
|
||||||
if (ZEEK_SANITIZER_UB_CHECKS)
|
if (ZEEK_SANITIZER_UB_CHECKS)
|
||||||
set(_sanitizer_flags "${_sanitizer_flags} -fno-sanitize-recover=${ZEEK_SANITIZER_UB_CHECKS}")
|
set(_sanitizer_flags
|
||||||
|
"${_sanitizer_flags} -fno-sanitize-recover=${ZEEK_SANITIZER_UB_CHECKS}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(_sanitizer_flags "${_sanitizer_flags} -fno-omit-frame-pointer")
|
set(_sanitizer_flags "${_sanitizer_flags} -fno-omit-frame-pointer")
|
||||||
|
@ -688,10 +664,10 @@ if ( ZEEK_SANITIZERS )
|
||||||
if (NOT DEFINED ZEEK_SANITIZER_OPTIMIZATIONS)
|
if (NOT DEFINED ZEEK_SANITIZER_OPTIMIZATIONS)
|
||||||
if (DEFINED ENV{NO_OPTIMIZATIONS})
|
if (DEFINED ENV{NO_OPTIMIZATIONS})
|
||||||
# Using -O1 is generally the suggestion to get more reasonable
|
# Using -O1 is generally the suggestion to get more reasonable
|
||||||
# performance. The one downside is it that the compiler may
|
# performance. The one downside is it that the compiler may optimize out
|
||||||
# optimize out code that otherwise generates an error/leak in a -O0
|
# code that otherwise generates an error/leak in a -O0 build, but that
|
||||||
# build, but that should be rare and users mostly will not be
|
# should be rare and users mostly will not be running unoptimized builds
|
||||||
# running unoptimized builds in production anyway.
|
# in production anyway.
|
||||||
set(ZEEK_SANITIZER_OPTIMIZATIONS false CACHE INTERNAL "" FORCE)
|
set(ZEEK_SANITIZER_OPTIMIZATIONS false CACHE INTERNAL "" FORCE)
|
||||||
else ()
|
else ()
|
||||||
set(ZEEK_SANITIZER_OPTIMIZATIONS true CACHE INTERNAL "" FORCE)
|
set(ZEEK_SANITIZER_OPTIMIZATIONS true CACHE INTERNAL "" FORCE)
|
||||||
|
@ -702,16 +678,16 @@ if ( ZEEK_SANITIZERS )
|
||||||
set(_sanitizer_flags "${_sanitizer_flags} -O1")
|
set(_sanitizer_flags "${_sanitizer_flags} -O1")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Technically, the we also need to use the compiler to drive linking and
|
# Technically, the we also need to use the compiler to drive linking and give
|
||||||
# give the sanitizer flags there, too. However, CMake, by default, uses
|
# the sanitizer flags there, too. However, CMake, by default, uses the
|
||||||
# the compiler for linking and so the automatically flags get used. See
|
# compiler for linking and so the automatically flags get used. See
|
||||||
# https://cmake.org/pipermail/cmake/2014-August/058268.html
|
# https://cmake.org/pipermail/cmake/2014-August/058268.html
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_sanitizer_flags}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_sanitizer_flags}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_sanitizer_flags}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_sanitizer_flags}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Dependency Configuration
|
# Dependency Configuration
|
||||||
|
|
||||||
include(FindRequiredPackage)
|
include(FindRequiredPackage)
|
||||||
|
|
||||||
|
@ -737,8 +713,8 @@ endif ()
|
||||||
FindRequiredPackage(ZLIB)
|
FindRequiredPackage(ZLIB)
|
||||||
|
|
||||||
# Forward user-defined hint for OpenSSL to the plugins. Use a cache variable to
|
# Forward user-defined hint for OpenSSL to the plugins. Use a cache variable to
|
||||||
# make sure this variable survives CMake re-runs.
|
# make sure this variable survives CMake re-runs. Note: This variable is picked
|
||||||
# Note: This variable is picked up in ZeekPluginConfig.cmake.in.
|
# up in ZeekPluginConfig.cmake.in.
|
||||||
if (OPENSSL_ROOT_DIR)
|
if (OPENSSL_ROOT_DIR)
|
||||||
set(ZeekOpenSSLHint "${OPENSSL_ROOT_DIR}" CACHE INTERNAL "" FORCE)
|
set(ZeekOpenSSLHint "${OPENSSL_ROOT_DIR}" CACHE INTERNAL "" FORCE)
|
||||||
elseif (DEFINED ENV{OPENSSL_ROOT_DIR})
|
elseif (DEFINED ENV{OPENSSL_ROOT_DIR})
|
||||||
|
@ -746,18 +722,17 @@ elseif (DEFINED ENV{OPENSSL_ROOT_DIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Forward PKG_CONFIG_PATH to the plugins. Use a cache variable to make sure this
|
# Forward PKG_CONFIG_PATH to the plugins. Use a cache variable to make sure this
|
||||||
# variable survives CMake re-runs.
|
# variable survives CMake re-runs. Note: This variable is picked up in
|
||||||
# Note: This variable is picked up in ZeekPluginConfig.cmake.in.
|
# ZeekPluginConfig.cmake.in.
|
||||||
if (DEFINED ENV{PKG_CONFIG_PATH})
|
if (DEFINED ENV{PKG_CONFIG_PATH})
|
||||||
set(ZeekPkgConfigPath "$ENV{PKG_CONFIG_PATH}" CACHE INTERNAL "" FORCE)
|
set(ZeekPkgConfigPath "$ENV{PKG_CONFIG_PATH}" CACHE INTERNAL "" FORCE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Installation directory for the distribution's Python modules. An
|
# Installation directory for the distribution's Python modules. An override via
|
||||||
# override via configure's --python-dir wins, specifying a directory
|
# configure's --python-dir wins, specifying a directory explicitly. Next is
|
||||||
# explicitly. Next is --python-prefix, which includes a versioned
|
# --python-prefix, which includes a versioned Python folder as the --prefix
|
||||||
# Python folder as the --prefix option in distutils does. Next
|
# option in distutils does. Next consider a distutils --home style override via
|
||||||
# consider a distutils --home style override via --python-home, and
|
# --python-home, and finally default to "zeek/python" in our libdir.
|
||||||
# finally default to "zeek/python" in our libdir.
|
|
||||||
if (ZEEK_PYTHON_DIR)
|
if (ZEEK_PYTHON_DIR)
|
||||||
set(py_mod_install_dir ${ZEEK_PYTHON_DIR})
|
set(py_mod_install_dir ${ZEEK_PYTHON_DIR})
|
||||||
elseif (ZEEK_PYTHON_PREFIX)
|
elseif (ZEEK_PYTHON_PREFIX)
|
||||||
|
@ -768,8 +743,8 @@ elseif (ZEEK_PYTHON_HOME)
|
||||||
else ()
|
else ()
|
||||||
set(py_mod_install_dir ${ZEEK_LIBDIR_PATH}/python)
|
set(py_mod_install_dir ${ZEEK_LIBDIR_PATH}/python)
|
||||||
endif ()
|
endif ()
|
||||||
set(PY_MOD_INSTALL_DIR ${py_mod_install_dir}
|
set(PY_MOD_INSTALL_DIR ${py_mod_install_dir} CACHE STRING "Installation path for Python modules"
|
||||||
CACHE STRING "Installation path for Python modules" FORCE)
|
FORCE)
|
||||||
|
|
||||||
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/auxil/binpac/CMakeLists.txt)
|
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/auxil/binpac/CMakeLists.txt)
|
||||||
|
|
||||||
|
@ -785,8 +760,8 @@ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/auxil/binpac/CMakeLists.txt)
|
||||||
add_subdirectory(auxil/binpac)
|
add_subdirectory(auxil/binpac)
|
||||||
set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED})
|
set(ENABLE_STATIC_ONLY ${ENABLE_STATIC_ONLY_SAVED})
|
||||||
|
|
||||||
# FIXME: avoid hard-coding a path for multi-config generator support.
|
# FIXME: avoid hard-coding a path for multi-config generator support. See the
|
||||||
# See the TODO in ZeekPluginConfig.cmake.in.
|
# TODO in ZeekPluginConfig.cmake.in.
|
||||||
set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}")
|
set(BINPAC_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/binpac/src/binpac${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
endif ()
|
endif ()
|
||||||
FindRequiredPackage(BinPAC)
|
FindRequiredPackage(BinPAC)
|
||||||
|
@ -797,14 +772,13 @@ add_executable(Zeek::BinPAC ALIAS binpac)
|
||||||
if (NOT BIFCL_EXE_PATH)
|
if (NOT BIFCL_EXE_PATH)
|
||||||
add_subdirectory(auxil/bifcl)
|
add_subdirectory(auxil/bifcl)
|
||||||
add_executable(Zeek::BifCl ALIAS bifcl)
|
add_executable(Zeek::BifCl ALIAS bifcl)
|
||||||
# FIXME: avoid hard-coding a path for multi-config generator support.
|
# FIXME: avoid hard-coding a path for multi-config generator support. See the
|
||||||
# See the TODO in ZeekPluginConfig.cmake.in.
|
# TODO in ZeekPluginConfig.cmake.in.
|
||||||
set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}")
|
set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}")
|
||||||
set(_bifcl_exe_path "included")
|
set(_bifcl_exe_path "included")
|
||||||
else ()
|
else ()
|
||||||
add_executable(Zeek::BifCl IMPORTED)
|
add_executable(Zeek::BifCl IMPORTED)
|
||||||
set_property(TARGET Zeek::BifCl PROPERTY
|
set_property(TARGET Zeek::BifCl PROPERTY IMPORTED_LOCATION "${BIFCL_EXE_PATH}")
|
||||||
IMPORTED_LOCATION "${BIFCL_EXE_PATH}")
|
|
||||||
set(_bifcl_exe_path "BIFCL_EXE_PATH")
|
set(_bifcl_exe_path "BIFCL_EXE_PATH")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -887,9 +861,7 @@ else ()
|
||||||
list(APPEND zeekdeps broker)
|
list(APPEND zeekdeps broker)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(
|
set(broker_includes ${CMAKE_CURRENT_SOURCE_DIR}/auxil/broker/include
|
||||||
broker_includes
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/auxil/broker/include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/auxil/broker/include)
|
${CMAKE_CURRENT_BINARY_DIR}/auxil/broker/include)
|
||||||
|
|
||||||
if (BUILD_STATIC_BROKER)
|
if (BUILD_STATIC_BROKER)
|
||||||
|
@ -899,8 +871,8 @@ else ()
|
||||||
endif ()
|
endif ()
|
||||||
set(ZEEK_HAS_EXTERNAL_BROKER OFF)
|
set(ZEEK_HAS_EXTERNAL_BROKER OFF)
|
||||||
|
|
||||||
# Tell plugins where to find the Broker CMake package in the source tree.
|
# Tell plugins where to find the Broker CMake package in the source tree. This
|
||||||
# This variable is picked up in ZeekPluginConfig.cmake.in.
|
# variable is picked up in ZeekPluginConfig.cmake.in.
|
||||||
set(ZEEK_PLUGIN_BROKER_PATH "${CMAKE_CURRENT_BINARY_DIR}/auxil/broker")
|
set(ZEEK_PLUGIN_BROKER_PATH "${CMAKE_CURRENT_BINARY_DIR}/auxil/broker")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -931,21 +903,14 @@ if ( NOT DISABLE_SPICY )
|
||||||
set(SPICY_LIBRARY_RT_DEBUG spicy-rt-debug)
|
set(SPICY_LIBRARY_RT_DEBUG spicy-rt-debug)
|
||||||
|
|
||||||
# Needed only for logging from CMake configure phase.
|
# Needed only for logging from CMake configure phase.
|
||||||
get_directory_property(
|
get_directory_property(SPICY_VERSION DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
||||||
SPICY_VERSION
|
|
||||||
DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
|
||||||
DEFINITION SPICY_VERSION)
|
DEFINITION SPICY_VERSION)
|
||||||
get_directory_property(
|
get_directory_property(
|
||||||
SPICY_VERSION_NUMBER
|
SPICY_VERSION_NUMBER DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy DEFINITION
|
||||||
DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
SPICY_VERSION_NUMBER)
|
||||||
DEFINITION SPICY_VERSION_NUMBER)
|
get_directory_property(SPICY_PREFIX DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
||||||
get_directory_property(
|
|
||||||
SPICY_PREFIX
|
|
||||||
DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
|
||||||
DEFINITION CMAKE_INSTALL_PREFIX)
|
DEFINITION CMAKE_INSTALL_PREFIX)
|
||||||
get_directory_property(
|
get_directory_property(SPICY_BUILD_MODE DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
||||||
SPICY_BUILD_MODE
|
|
||||||
DIRECTORY ${PROJECT_SOURCE_DIR}/auxil/spicy/spicy
|
|
||||||
DEFINITION CMAKE_BUILD_TYPE)
|
DEFINITION CMAKE_BUILD_TYPE)
|
||||||
set(SPICYC "<bundled>")
|
set(SPICYC "<bundled>")
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -965,13 +930,8 @@ endif ()
|
||||||
set(USE_SPICY_ANALYZERS "${USE_SPICY_ANALYZERS}" CACHE BOOL "Use built-in Spicy analyzers")
|
set(USE_SPICY_ANALYZERS "${USE_SPICY_ANALYZERS}" CACHE BOOL "Use built-in Spicy analyzers")
|
||||||
include(BuiltInSpicyAnalyzer)
|
include(BuiltInSpicyAnalyzer)
|
||||||
|
|
||||||
include_directories(BEFORE
|
include_directories(BEFORE ${PCAP_INCLUDE_DIR} ${BIND_INCLUDE_DIR} ${BinPAC_INCLUDE_DIR}
|
||||||
${PCAP_INCLUDE_DIR}
|
${ZLIB_INCLUDE_DIR} ${JEMALLOC_INCLUDE_DIR})
|
||||||
${BIND_INCLUDE_DIR}
|
|
||||||
${BinPAC_INCLUDE_DIR}
|
|
||||||
${ZLIB_INCLUDE_DIR}
|
|
||||||
${JEMALLOC_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include/rapidjson
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include/rapidjson
|
||||||
DESTINATION include/zeek/3rdparty/rapidjson/include)
|
DESTINATION include/zeek/3rdparty/rapidjson/include)
|
||||||
|
@ -983,7 +943,9 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc
|
||||||
# "zeek/3rdparty/ghc/filesystem.hpp" works within the build tree.
|
# "zeek/3rdparty/ghc/filesystem.hpp" works within the build tree.
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/3rdparty/")
|
"${CMAKE_CURRENT_BINARY_DIR}/3rdparty/")
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink
|
execute_process(
|
||||||
|
COMMAND
|
||||||
|
"${CMAKE_COMMAND}" -E create_symlink
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc"
|
"${CMAKE_CURRENT_SOURCE_DIR}/auxil/filesystem/include/ghc"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/3rdparty/ghc")
|
"${CMAKE_CURRENT_BINARY_DIR}/3rdparty/ghc")
|
||||||
|
|
||||||
|
@ -1032,10 +994,10 @@ if ( ENABLE_PERFTOOLS )
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Making sure any non-standard OpenSSL includes get searched earlier
|
# Making sure any non-standard OpenSSL includes get searched earlier than other
|
||||||
# than other dependencies which tend to be in standard system locations
|
# dependencies which tend to be in standard system locations and thus cause the
|
||||||
# and thus cause the system OpenSSL headers to still be picked up even
|
# system OpenSSL headers to still be picked up even if one specifies
|
||||||
# if one specifies --with-openssl (which may be common).
|
# --with-openssl (which may be common).
|
||||||
include_directories(BEFORE ${OPENSSL_INCLUDE_DIR})
|
include_directories(BEFORE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
|
||||||
# Determine if libfts is external to libc, i.e. musl
|
# Determine if libfts is external to libc, i.e. musl
|
||||||
|
@ -1045,26 +1007,26 @@ if ( FTS_FOUND )
|
||||||
include_directories(BEFORE ${FTS_INCLUDE_DIR})
|
include_directories(BEFORE ${FTS_INCLUDE_DIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Any headers that are possibly bundled in the Zeek source-tree and that are supposed
|
# Any headers that are possibly bundled in the Zeek source-tree and that are
|
||||||
# to have priority over any preexisting/system-wide headers need to appear early in
|
# supposed to have priority over any preexisting/system-wide headers need to
|
||||||
# compiler search path.
|
# appear early in compiler search path.
|
||||||
include_directories(BEFORE ${broker_includes})
|
include_directories(BEFORE ${broker_includes})
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/highwayhash)
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/highwayhash)
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/paraglob/include)
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/paraglob/include)
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include)
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/auxil/rapidjson/include)
|
||||||
|
|
||||||
set(zeekdeps ${zeekdeps}
|
set(zeekdeps
|
||||||
|
${zeekdeps}
|
||||||
${BinPAC_LIBRARY}
|
${BinPAC_LIBRARY}
|
||||||
${PCAP_LIBRARY}
|
${PCAP_LIBRARY}
|
||||||
${OPENSSL_LIBRARIES}
|
${OPENSSL_LIBRARIES}
|
||||||
${BIND_LIBRARY}
|
${BIND_LIBRARY}
|
||||||
${ZLIB_LIBRARY}
|
${ZLIB_LIBRARY}
|
||||||
${JEMALLOC_LIBRARIES}
|
${JEMALLOC_LIBRARIES}
|
||||||
${OPTLIBS}
|
${OPTLIBS})
|
||||||
)
|
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## System Introspection
|
# System Introspection
|
||||||
|
|
||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
test_big_endian(WORDS_BIGENDIAN)
|
test_big_endian(WORDS_BIGENDIAN)
|
||||||
|
@ -1111,7 +1073,10 @@ if ( NOT DISABLE_JAVASCRIPT )
|
||||||
|
|
||||||
if (NODEJS_FOUND)
|
if (NODEJS_FOUND)
|
||||||
if (${NODEJS_VERSION} VERSION_LESS "16.13.0")
|
if (${NODEJS_VERSION} VERSION_LESS "16.13.0")
|
||||||
message(STATUS "Node.js version ${NODEJS_VERSION} is too old, need 16.13 or later. Not enabling JavaScript support.")
|
message(
|
||||||
|
STATUS
|
||||||
|
"Node.js version ${NODEJS_VERSION} is too old, need 16.13 or later. Not enabling JavaScript support."
|
||||||
|
)
|
||||||
set(ZEEK_HAVE_JAVASCRIPT no)
|
set(ZEEK_HAVE_JAVASCRIPT no)
|
||||||
else ()
|
else ()
|
||||||
set(ZEEKJS_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/auxil/zeekjs)
|
set(ZEEKJS_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/auxil/zeekjs)
|
||||||
|
@ -1125,7 +1090,9 @@ endif ()
|
||||||
|
|
||||||
set(ZEEK_HAVE_JAVASCRIPT ${ZEEK_HAVE_JAVASCRIPT} CACHE INTERNAL "Zeek has JavaScript support")
|
set(ZEEK_HAVE_JAVASCRIPT ${ZEEK_HAVE_JAVASCRIPT} CACHE INTERNAL "Zeek has JavaScript support")
|
||||||
|
|
||||||
set(DEFAULT_ZEEKPATH_PATHS . ${ZEEK_SCRIPT_INSTALL_PATH} ${ZEEK_SCRIPT_INSTALL_PATH}/policy ${ZEEK_SCRIPT_INSTALL_PATH}/site ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins)
|
set(DEFAULT_ZEEKPATH_PATHS
|
||||||
|
. ${ZEEK_SCRIPT_INSTALL_PATH} ${ZEEK_SCRIPT_INSTALL_PATH}/policy
|
||||||
|
${ZEEK_SCRIPT_INSTALL_PATH}/site ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
list(JOIN DEFAULT_ZEEKPATH_PATHS ";" DEFAULT_ZEEKPATH)
|
list(JOIN DEFAULT_ZEEKPATH_PATHS ";" DEFAULT_ZEEKPATH)
|
||||||
else ()
|
else ()
|
||||||
|
@ -1144,9 +1111,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h)
|
${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h)
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zeek-config.h DESTINATION include/zeek)
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "." "${CMAKE_CURRENT_BINARY_DIR}/zeek")
|
||||||
"."
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/zeek")
|
|
||||||
|
|
||||||
if (BinPAC_ROOT_DIR)
|
if (BinPAC_ROOT_DIR)
|
||||||
set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${BinPAC_ROOT_DIR})
|
set(ZEEK_CONFIG_BINPAC_ROOT_DIR ${BinPAC_ROOT_DIR})
|
||||||
|
@ -1179,11 +1144,13 @@ endif ()
|
||||||
set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest)
|
set(ZEEK_CONFIG_BTEST_TOOLS_DIR ${ZEEK_ROOT_DIR}/share/btest)
|
||||||
install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR})
|
install(DIRECTORY DESTINATION ${ZEEK_CONFIG_BTEST_TOOLS_DIR})
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zeek-config.in ${CMAKE_CURRENT_BINARY_DIR}/zeek-config
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zeek-config @ONLY)
|
@ONLY)
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin)
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/zeek-config DESTINATION bin)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake DESTINATION share/zeek
|
install(
|
||||||
|
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake
|
||||||
|
DESTINATION share/zeek
|
||||||
USE_SOURCE_PERMISSIONS
|
USE_SOURCE_PERMISSIONS
|
||||||
PATTERN ".git" EXCLUDE)
|
PATTERN ".git" EXCLUDE)
|
||||||
|
|
||||||
|
@ -1193,32 +1160,32 @@ if ( NOT MSVC )
|
||||||
include(InstallSymlink)
|
include(InstallSymlink)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## zkg configuration
|
# zkg configuration
|
||||||
|
|
||||||
if (INSTALL_ZKG)
|
if (INSTALL_ZKG)
|
||||||
# An etc/zkg directory for zkg's config file simplifies zkg's
|
# An etc/zkg directory for zkg's config file simplifies zkg's config file
|
||||||
# config file code.
|
# code.
|
||||||
set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg")
|
set(ZEEK_ZKG_CONFIG_DIR "${ZEEK_ETC_INSTALL_DIR}/zkg")
|
||||||
set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg")
|
set(ZEEK_ZKG_STATE_DIR "${ZEEK_STATE_DIR}/zkg")
|
||||||
|
|
||||||
configure_file(
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in ${CMAKE_CURRENT_BINARY_DIR}/zkg-config
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/zkg-config.in
|
@ONLY)
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zkg-config @ONLY)
|
|
||||||
|
|
||||||
install(DIRECTORY DESTINATION var/lib/zkg)
|
install(DIRECTORY DESTINATION var/lib/zkg)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zkg-config DESTINATION ${ZEEK_ZKG_CONFIG_DIR}
|
||||||
DESTINATION ${ZEEK_ZKG_CONFIG_DIR} RENAME config)
|
RENAME config)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Look for external plugins to build in
|
# Look for external plugins to build in
|
||||||
|
|
||||||
string(REPLACE "," " " _build_in_plugins "${ZEEK_INCLUDE_PLUGINS}")
|
string(REPLACE "," " " _build_in_plugins "${ZEEK_INCLUDE_PLUGINS}")
|
||||||
separate_arguments(_build_in_plugins)
|
separate_arguments(_build_in_plugins)
|
||||||
foreach (plugin_dir ${_build_in_plugins})
|
foreach (plugin_dir ${_build_in_plugins})
|
||||||
if (NOT IS_ABSOLUTE "${plugin_dir}/CMakeLists.txt")
|
if (NOT IS_ABSOLUTE "${plugin_dir}/CMakeLists.txt")
|
||||||
message(FATAL_ERROR "Plugins to build in need to be defined with absolute path! ${plugin_dir}")
|
message(
|
||||||
|
FATAL_ERROR "Plugins to build in need to be defined with absolute path! ${plugin_dir}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT EXISTS "${plugin_dir}/CMakeLists.txt")
|
if (NOT EXISTS "${plugin_dir}/CMakeLists.txt")
|
||||||
|
@ -1227,7 +1194,8 @@ foreach(plugin_dir ${_build_in_plugins})
|
||||||
|
|
||||||
get_filename_component(plugin_name ${plugin_dir} NAME)
|
get_filename_component(plugin_name ${plugin_dir} NAME)
|
||||||
|
|
||||||
# Create a list of plugin directories that will then be added in the src/CMakeLists.txt
|
# Create a list of plugin directories that will then be added in the
|
||||||
|
# src/CMakeLists.txt
|
||||||
list(APPEND BUILTIN_PLUGIN_LIST ${plugin_dir})
|
list(APPEND BUILTIN_PLUGIN_LIST ${plugin_dir})
|
||||||
|
|
||||||
message(STATUS " Building in plugin: ${plugin_name} (${plugin_dir})")
|
message(STATUS " Building in plugin: ${plugin_name} (${plugin_dir})")
|
||||||
|
@ -1239,20 +1207,22 @@ foreach(plugin_dir ${_build_in_plugins})
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Populate the ZEEK_BUILD_INFO for use in src/version.c.in
|
# Populate the ZEEK_BUILD_INFO for use in src/version.c.in
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# Windows installs Python to C:\Python311\python, but doesn't create a version
|
# Windows installs Python to C:\Python311\python, but doesn't create a version
|
||||||
# or symlink to python3. Call python with the script directly since the shebang
|
# or symlink to python3. Call python with the script directly since the
|
||||||
# in the script won't work here.
|
# shebang in the script won't work here.
|
||||||
execute_process(COMMAND "python" "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}"
|
execute_process(
|
||||||
|
COMMAND "python" "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}"
|
||||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
OUTPUT_VARIABLE ZEEK_BUILD_INFO
|
OUTPUT_VARIABLE ZEEK_BUILD_INFO
|
||||||
RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT
|
RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
else ()
|
else ()
|
||||||
execute_process(COMMAND "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}"
|
execute_process(
|
||||||
|
COMMAND "${PROJECT_SOURCE_DIR}/ci/collect-repo-info.py" "${ZEEK_INCLUDE_PLUGINS}"
|
||||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
OUTPUT_VARIABLE ZEEK_BUILD_INFO
|
OUTPUT_VARIABLE ZEEK_BUILD_INFO
|
||||||
RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT
|
RESULT_VARIABLE ZEEK_BUILD_INFO_RESULT
|
||||||
|
@ -1264,11 +1234,11 @@ if ( NOT ZEEK_BUILD_INFO_RESULT EQUAL "0" )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# string(JSON ... ) requires CMake 3.19, but then we could do something like:
|
# string(JSON ... ) requires CMake 3.19, but then we could do something like:
|
||||||
# string(JSON ZEEK_BUILD_INFO SET "${ZEEK_BUILD_INFO}"
|
# string(JSON ZEEK_BUILD_INFO SET "${ZEEK_BUILD_INFO}" compile_options cxx_flags
|
||||||
# compile_options cxx_flags "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}")
|
# "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}")
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Recurse on sub-directories
|
# Recurse on sub-directories
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(scripts)
|
add_subdirectory(scripts)
|
||||||
|
@ -1277,16 +1247,16 @@ add_subdirectory(testing)
|
||||||
|
|
||||||
include(CheckOptionalBuildSources)
|
include(CheckOptionalBuildSources)
|
||||||
|
|
||||||
CheckOptionalBuildSources(auxil/btest BTest INSTALL_BTEST)
|
checkoptionalbuildsources(auxil/btest BTest INSTALL_BTEST)
|
||||||
CheckOptionalBuildSources(auxil/package-manager ZKG INSTALL_ZKG)
|
checkoptionalbuildsources(auxil/package-manager ZKG INSTALL_ZKG)
|
||||||
CheckOptionalBuildSources(auxil/zeekctl ZeekControl INSTALL_ZEEKCTL)
|
checkoptionalbuildsources(auxil/zeekctl ZeekControl INSTALL_ZEEKCTL)
|
||||||
CheckOptionalBuildSources(auxil/zeek-aux Zeek-Aux INSTALL_AUX_TOOLS)
|
checkoptionalbuildsources(auxil/zeek-aux Zeek-Aux INSTALL_AUX_TOOLS)
|
||||||
CheckOptionalBuildSources(auxil/zeek-archiver ZeekArchiver INSTALL_ZEEK_ARCHIVER)
|
checkoptionalbuildsources(auxil/zeek-archiver ZeekArchiver INSTALL_ZEEK_ARCHIVER)
|
||||||
CheckOptionalBuildSources(auxil/zeek-client ZeekClient INSTALL_ZEEK_CLIENT)
|
checkoptionalbuildsources(auxil/zeek-client ZeekClient INSTALL_ZEEK_CLIENT)
|
||||||
|
|
||||||
if (NOT DISABLE_SPICY)
|
if (NOT DISABLE_SPICY)
|
||||||
# The `zeek` binary implicitly depends on the driver object file built
|
# The `zeek` binary implicitly depends on the driver object file built as part
|
||||||
# as part of `spicy`; make that dependency explicit.
|
# of `spicy`; make that dependency explicit.
|
||||||
zeek_add_dependencies(spicyz)
|
zeek_add_dependencies(spicyz)
|
||||||
|
|
||||||
if (NOT SPICY_ROOT_DIR)
|
if (NOT SPICY_ROOT_DIR)
|
||||||
|
@ -1294,13 +1264,13 @@ if ( NOT DISABLE_SPICY )
|
||||||
add_dependencies(plugin-Zeek-Spicy spicy)
|
add_dependencies(plugin-Zeek-Spicy spicy)
|
||||||
add_dependencies(spicyz spicy)
|
add_dependencies(spicyz spicy)
|
||||||
|
|
||||||
# Also install spicy-plugin's CMake files into Zeek's global `cmake/` folder.
|
# Also install spicy-plugin's CMake files into Zeek's global `cmake/`
|
||||||
|
# folder.
|
||||||
#
|
#
|
||||||
# NOTE: We do not install spicy-plugin's `FindZeek.cmake` since another
|
# NOTE: We do not install spicy-plugin's `FindZeek.cmake` since another
|
||||||
# version of this file is already provided by Zeek.
|
# version of this file is already provided by Zeek.
|
||||||
install(FILES auxil/spicy-plugin/cmake/ZeekSpicyAnalyzerSupport.cmake
|
install(FILES auxil/spicy-plugin/cmake/ZeekSpicyAnalyzerSupport.cmake
|
||||||
auxil/spicy-plugin/cmake/FindSpicy.cmake
|
auxil/spicy-plugin/cmake/FindSpicy.cmake DESTINATION share/zeek/cmake)
|
||||||
DESTINATION share/zeek/cmake)
|
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
@ -1308,28 +1278,28 @@ endif ()
|
||||||
# scripts work in any build configuration. If we do not include Spicy these
|
# scripts work in any build configuration. If we do not include Spicy these
|
||||||
# files have no actual effect.
|
# files have no actual effect.
|
||||||
#
|
#
|
||||||
# Spicy JIT relies on the path of the current executable to figure out
|
# Spicy JIT relies on the path of the current executable to figure out whether
|
||||||
# whether it is run from a build or an install tree. This assumption
|
# it is run from a build or an install tree. This assumption gets broken for
|
||||||
# gets broken for e.g., `spicyz` when running from the build tree
|
# e.g., `spicyz` when running from the build tree (probably fixable), and also
|
||||||
# (probably fixable), and also when JIT'ing directly from a `zeek`
|
# when JIT'ing directly from a `zeek` invocation (much harder to fix). Instead
|
||||||
# invocation (much harder to fix). Instead we generate shell
|
# we generate shell definitions to support running and using Spicy or
|
||||||
# definitions to support running and using Spicy or spicy-plugin
|
# spicy-plugin functionality in the build tree, including JIT'ing directly from
|
||||||
# functionality in the build tree, including JIT'ing directly from
|
|
||||||
# Zeek.
|
# Zeek.
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/spicy-path.in ${CMAKE_BINARY_DIR}/spicy-path @ONLY)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/hilti-cxx-include-dirs.in ${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/auxil/spicy/hilti-cxx-include-dirs.in
|
||||||
|
${CMAKE_BINARY_DIR}/hilti-cxx-include-dirs @ONLY)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Packaging Setup
|
# Packaging Setup
|
||||||
|
|
||||||
if (INSTALL_ZEEKCTL OR INSTALL_ZKG OR INSTALL_ZEEK_CLIENT)
|
if (INSTALL_ZEEKCTL OR INSTALL_ZKG OR INSTALL_ZEEK_CLIENT)
|
||||||
# CPack RPM Generator may not automatically detect this
|
# CPack RPM Generator may not automatically detect this
|
||||||
set(CPACK_RPM_PACKAGE_REQUIRES "python >= ${ZEEK_PYTHON_MIN}")
|
set(CPACK_RPM_PACKAGE_REQUIRES "python >= ${ZEEK_PYTHON_MIN}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# If this CMake project is a sub-project of another, we will not
|
# If this CMake project is a sub-project of another, we will not configure the
|
||||||
# configure the generic packaging because CPack will fail in the case
|
# generic packaging because CPack will fail in the case that the parent project
|
||||||
# that the parent project has already configured packaging
|
# has already configured packaging
|
||||||
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
||||||
include(ConfigurePackaging)
|
include(ConfigurePackaging)
|
||||||
ConfigurePackaging(${VERSION})
|
ConfigurePackaging(${VERSION})
|
||||||
|
@ -1338,8 +1308,7 @@ endif ()
|
||||||
# Refers back to the "distribution prefix". This is the source tree when
|
# Refers back to the "distribution prefix". This is the source tree when
|
||||||
# referring to Zeek from the build directory and the "share" directory under the
|
# referring to Zeek from the build directory and the "share" directory under the
|
||||||
# install preifx otherwise.
|
# install preifx otherwise.
|
||||||
set(ZEEK_DIST_PREFIX
|
set(ZEEK_DIST_PREFIX $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/foo/bar>)
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/foo/bar>)
|
||||||
|
|
||||||
# Generate extra config file for the dynamic plugins.
|
# Generate extra config file for the dynamic plugins.
|
||||||
|
@ -1348,12 +1317,9 @@ configure_file(src/ZeekPluginConfig.cmake.in ZeekPluginConfig.cmake @ONLY)
|
||||||
# Write the CMake package and version files.
|
# Write the CMake package and version files.
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/ZeekConfig.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/ZeekConfig.cmake.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake" INSTALL_DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
||||||
INSTALL_DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
||||||
write_basic_package_version_file(
|
VERSION ${ZEEK_VERSION_NUMBER} COMPATIBILITY ExactVersion)
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
|
||||||
VERSION ${ZEEK_VERSION_NUMBER}
|
|
||||||
COMPATIBILITY ExactVersion)
|
|
||||||
|
|
||||||
# Write the CMake targets file.
|
# Write the CMake targets file.
|
||||||
export(EXPORT ZeekTargets FILE ZeekTargets.cmake NAMESPACE Zeek::)
|
export(EXPORT ZeekTargets FILE ZeekTargets.cmake NAMESPACE Zeek::)
|
||||||
|
@ -1363,20 +1329,14 @@ configure_file(src/ZeekPluginBootstrap.cmake.in ZeekPluginBootstrap.cmake @ONLY)
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZeekPluginBootstrap.cmake"
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZeekPluginBootstrap.cmake"
|
||||||
DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
||||||
|
|
||||||
install(
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
||||||
FILES
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfig.cmake"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/ZeekConfigVersion.cmake"
|
||||||
DESTINATION
|
DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}")
|
||||||
"${ZEEK_CMAKE_CONFIG_DIR}")
|
|
||||||
|
|
||||||
install(
|
install(EXPORT ZeekTargets DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}" NAMESPACE Zeek::)
|
||||||
EXPORT ZeekTargets
|
|
||||||
DESTINATION "${ZEEK_CMAKE_CONFIG_DIR}"
|
|
||||||
NAMESPACE Zeek::)
|
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Build Summary
|
# Build Summary
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE)
|
if (CMAKE_BUILD_TYPE)
|
||||||
string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType)
|
string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType)
|
||||||
|
@ -1413,7 +1373,8 @@ endif ()
|
||||||
|
|
||||||
if (ZEEK_LEGACY_ANALYZERS)
|
if (ZEEK_LEGACY_ANALYZERS)
|
||||||
list(JOIN ZEEK_LEGACY_ANALYZERS ", " _legacy_analyzers)
|
list(JOIN ZEEK_LEGACY_ANALYZERS ", " _legacy_analyzers)
|
||||||
set(_legacy_analyzers "\n - Using unmaintained legacy analyzers for: ${_legacy_analyzers}")
|
set(_legacy_analyzers
|
||||||
|
"\n - Using unmaintained legacy analyzers for: ${_legacy_analyzers}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ZEEK_SKIPPED_ANALYZERS)
|
if (ZEEK_SKIPPED_ANALYZERS)
|
||||||
|
@ -1422,7 +1383,9 @@ if ( ZEEK_SKIPPED_ANALYZERS )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ZEEK_LEGACY_ANALYZERS OR ZEEK_SKIPPED_ANALYZERS)
|
if (ZEEK_LEGACY_ANALYZERS OR ZEEK_SKIPPED_ANALYZERS)
|
||||||
set(_analyzer_warning "\n\n[Warning] Some analyzers are not available due to lack of built-in Spicy support:${_legacy_analyzers}${_skipped_analyzers}")
|
set(_analyzer_warning
|
||||||
|
"\n\n[Warning] Some analyzers are not available due to lack of built-in Spicy support:${_legacy_analyzers}${_skipped_analyzers}"
|
||||||
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
message(
|
message(
|
||||||
|
@ -1475,7 +1438,6 @@ message(
|
||||||
"\nFuzz Engine: ${ZEEK_FUZZING_ENGINE}"
|
"\nFuzz Engine: ${ZEEK_FUZZING_ENGINE}"
|
||||||
"${_analyzer_warning}"
|
"${_analyzer_warning}"
|
||||||
"\n"
|
"\n"
|
||||||
"\n================================================================\n"
|
"\n================================================================\n")
|
||||||
)
|
|
||||||
|
|
||||||
include(UserChangedWarning)
|
include(UserChangedWarning)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
install(
|
||||||
install(DIRECTORY . DESTINATION ${ZEEK_MAN_INSTALL_PATH}/man8 FILES_MATCHING
|
DIRECTORY .
|
||||||
PATTERN "*.8"
|
DESTINATION ${ZEEK_MAN_INSTALL_PATH}/man8
|
||||||
)
|
FILES_MATCHING
|
||||||
|
PATTERN "*.8")
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
include(InstallPackageConfigFile)
|
include(InstallPackageConfigFile)
|
||||||
|
|
||||||
install(DIRECTORY ./ DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH} FILES_MATCHING
|
install(
|
||||||
|
DIRECTORY ./
|
||||||
|
DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}
|
||||||
|
FILES_MATCHING
|
||||||
PATTERN "site/local*" EXCLUDE
|
PATTERN "site/local*" EXCLUDE
|
||||||
PATTERN "*.zeek"
|
PATTERN "*.zeek"
|
||||||
PATTERN "*.sig"
|
PATTERN "*.sig"
|
||||||
PATTERN "*.fp"
|
PATTERN "*.fp")
|
||||||
)
|
|
||||||
|
|
||||||
# Install local script as a config file since it's meant to be modified directly.
|
# Install local script as a config file since it's meant to be modified
|
||||||
InstallPackageConfigFile(
|
# directly.
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek
|
InstallPackageConfigFile(${CMAKE_CURRENT_SOURCE_DIR}/site/local.zeek
|
||||||
${ZEEK_SCRIPT_INSTALL_PATH}/site
|
${ZEEK_SCRIPT_INSTALL_PATH}/site local.zeek)
|
||||||
local.zeek)
|
|
||||||
|
|
||||||
# Substitute values in templated script files, and install them.
|
# Substitute values in templated script files, and install them.
|
||||||
configure_file(
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/base/misc/installation.zeek.in
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/base/misc/installation.zeek.in
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek @ONLY)
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/base/misc/installation.zeek
|
||||||
|
|
|
@ -1,23 +1,15 @@
|
||||||
include_directories(BEFORE
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
|
||||||
)
|
|
||||||
|
|
||||||
# Force creation of includes symlink. This can't just be in the src directory
|
# Force creation of includes symlink. This can't just be in the src directory
|
||||||
# because MSVC will end up with an include loop.
|
# because MSVC will end up with an include loop.
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ".."
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink
|
|
||||||
".."
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/zeek")
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/zeek")
|
||||||
|
|
||||||
# Allows header file inclusion via zeek/ within the build tree
|
# Allows header file inclusion via zeek/ within the build tree
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include")
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/include")
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink ".."
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink
|
|
||||||
".."
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/include/zeek")
|
"${CMAKE_CURRENT_BINARY_DIR}/include/zeek")
|
||||||
|
|
||||||
# Poor man's JSON escaping as this is rendered into a C string.
|
# Poor man's JSON escaping as this is rendered into a C string.
|
||||||
|
@ -26,27 +18,25 @@ string(REPLACE "\n" "\\n" ZEEK_BUILD_INFO_ESCAPED "${ZEEK_BUILD_INFO_ESCAPED}")
|
||||||
configure_file(version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
|
configure_file(version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
|
||||||
configure_file(util-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/util-config.h)
|
configure_file(util-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/util-config.h)
|
||||||
|
|
||||||
# This creates a custom command to transform a bison output file (inFile)
|
# This creates a custom command to transform a bison output file (inFile) into
|
||||||
# into outFile in order to avoid symbol conflicts:
|
# outFile in order to avoid symbol conflicts: - replaces instances of 'yylex' in
|
||||||
# - replaces instances of 'yylex' in inFile with yylexPrefix
|
# inFile with yylexPrefix - replaces instances of 'yy' in inFile with yyPrefix -
|
||||||
# - replaces instances of 'yy' in inFile with yyPrefix
|
# deletes instances of 'extern char.*getenv' in inFile - writes results to
|
||||||
# - deletes instances of 'extern char.*getenv' in inFile
|
# outFile and adds it to list TRANSFORMED_BISON_OUTPUTS
|
||||||
# - writes results to outFile and adds it to list TRANSFORMED_BISON_OUTPUTS
|
|
||||||
macro (REPLACE_YY_PREFIX_TARGET inFile outFile yylexPrefix yyPrefix)
|
macro (REPLACE_YY_PREFIX_TARGET inFile outFile yylexPrefix yyPrefix)
|
||||||
set(args "\"/extern char.*getenv/d")
|
set(args "\"/extern char.*getenv/d")
|
||||||
set(args "${args}\;s/yylex/${yylexPrefix}lex/")
|
set(args "${args}\;s/yylex/${yylexPrefix}lex/")
|
||||||
set(args "${args}\;s/yy/${yyPrefix}/g\"" < ${inFile} > ${outFile})
|
set(args "${args}\;s/yy/${yyPrefix}/g\"" < ${inFile} > ${outFile})
|
||||||
add_custom_command(OUTPUT ${outFile}
|
add_custom_command(
|
||||||
COMMAND ${SED_EXE}
|
OUTPUT ${outFile}
|
||||||
ARGS ${args}
|
COMMAND ${SED_EXE} ARGS ${args}
|
||||||
DEPENDS ${inFile}
|
DEPENDS ${inFile}
|
||||||
COMMENT "[sed] replacing stuff in ${inFile}"
|
COMMENT "[sed] replacing stuff in ${inFile}")
|
||||||
)
|
|
||||||
list(APPEND TRANSFORMED_BISON_OUTPUTS ${outFile})
|
list(APPEND TRANSFORMED_BISON_OUTPUTS ${outFile})
|
||||||
endmacro (REPLACE_YY_PREFIX_TARGET)
|
endmacro (REPLACE_YY_PREFIX_TARGET)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Create targets to generate parser and scanner code
|
# Create targets to generate parser and scanner code
|
||||||
|
|
||||||
set(BISON_FLAGS "--debug")
|
set(BISON_FLAGS "--debug")
|
||||||
|
|
||||||
|
@ -57,65 +47,56 @@ else()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Rule parser/scanner
|
# Rule parser/scanner
|
||||||
bison_target(RuleParser rule-parse.y
|
bison_target(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rup.cc
|
RuleParser rule-parse.y ${CMAKE_CURRENT_BINARY_DIR}/rup.cc HEADER
|
||||||
HEADER ${CMAKE_CURRENT_BINARY_DIR}/rup.h
|
${CMAKE_CURRENT_BINARY_DIR}/rup.h
|
||||||
# VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/rule_parse.output
|
# VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/rule_parse.output
|
||||||
COMPILE_FLAGS "${BISON_FLAGS}")
|
COMPILE_FLAGS "${BISON_FLAGS}")
|
||||||
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.cc
|
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc
|
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc rules_ rules_)
|
||||||
rules_ rules_)
|
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.h ${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h
|
||||||
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rup.h
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h
|
|
||||||
rules_ rules_)
|
rules_ rules_)
|
||||||
flex_target(RuleScanner rule-scan.l ${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc
|
flex_target(RuleScanner rule-scan.l ${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc
|
||||||
COMPILE_FLAGS "-Prules_")
|
COMPILE_FLAGS "-Prules_")
|
||||||
set_property(SOURCE rule-scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}")
|
set_property(SOURCE rule-scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}")
|
||||||
|
|
||||||
# RE parser/scanner
|
# RE parser/scanner
|
||||||
bison_target(REParser re-parse.y
|
bison_target(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rep.cc
|
REParser re-parse.y ${CMAKE_CURRENT_BINARY_DIR}/rep.cc HEADER
|
||||||
HEADER ${CMAKE_CURRENT_BINARY_DIR}/re-parse.h
|
${CMAKE_CURRENT_BINARY_DIR}/re-parse.h
|
||||||
# VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/re_parse.output
|
# VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/re_parse.output
|
||||||
COMPILE_FLAGS "${BISON_FLAGS}")
|
COMPILE_FLAGS "${BISON_FLAGS}")
|
||||||
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rep.cc
|
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/rep.cc ${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc
|
|
||||||
re_ RE_)
|
re_ RE_)
|
||||||
flex_target(REScanner re-scan.l ${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc
|
flex_target(REScanner re-scan.l ${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc COMPILE_FLAGS "-Pre_")
|
||||||
COMPILE_FLAGS "-Pre_")
|
|
||||||
add_flex_bison_dependency(REScanner REParser)
|
add_flex_bison_dependency(REScanner REParser)
|
||||||
set_property(SOURCE re-scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}")
|
set_property(SOURCE re-scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}")
|
||||||
|
|
||||||
# Parser/Scanner
|
# Parser/Scanner
|
||||||
bison_target(Parser parse.y
|
bison_target(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/p.cc
|
Parser parse.y ${CMAKE_CURRENT_BINARY_DIR}/p.cc HEADER ${CMAKE_CURRENT_BINARY_DIR}/zeekparse.h
|
||||||
HEADER ${CMAKE_CURRENT_BINARY_DIR}/zeekparse.h
|
|
||||||
# VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/parse.output
|
# VERBOSE ${CMAKE_CURRENT_BINARY_DIR}/parse.output
|
||||||
COMPILE_FLAGS "${BISON_FLAGS}")
|
COMPILE_FLAGS "${BISON_FLAGS}")
|
||||||
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/p.cc
|
replace_yy_prefix_target(${CMAKE_CURRENT_BINARY_DIR}/p.cc ${CMAKE_CURRENT_BINARY_DIR}/parse.cc zeek
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/parse.cc
|
yy)
|
||||||
zeek yy)
|
flex_target(Scanner scan.l ${CMAKE_CURRENT_BINARY_DIR}/scan.cc COMPILE_FLAGS "-Pzeek")
|
||||||
flex_target(Scanner scan.l ${CMAKE_CURRENT_BINARY_DIR}/scan.cc
|
|
||||||
COMPILE_FLAGS "-Pzeek")
|
|
||||||
set_property(SOURCE scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}")
|
set_property(SOURCE scan.cc APPEND_STRING PROPERTY COMPILE_FLAGS "${SIGN_COMPARE_FLAG}")
|
||||||
|
|
||||||
# Add a dependency for the generated files to zeek_autogen_files.
|
# Add a dependency for the generated files to zeek_autogen_files.
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
zeek_bison_outputs
|
zeek_bison_outputs
|
||||||
DEPENDS
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/parse.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/parse.cc
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc
|
${CMAKE_CURRENT_BINARY_DIR}/re-parse.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/re-parse.h
|
${CMAKE_CURRENT_BINARY_DIR}/re-parse.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc
|
${CMAKE_CURRENT_BINARY_DIR}/re-scan.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc
|
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h
|
${CMAKE_CURRENT_BINARY_DIR}/rule-parse.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc
|
${CMAKE_CURRENT_BINARY_DIR}/rule-scan.cc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/scan.cc
|
${CMAKE_CURRENT_BINARY_DIR}/scan.cc)
|
||||||
)
|
|
||||||
add_dependencies(zeek_autogen_files zeek_bison_outputs)
|
add_dependencies(zeek_autogen_files zeek_bison_outputs)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## bifcl-dependent targets
|
# bifcl-dependent targets
|
||||||
|
|
||||||
include(BifCl)
|
include(BifCl)
|
||||||
|
|
||||||
|
@ -131,34 +112,30 @@ set(BIF_SRCS
|
||||||
strings.bif
|
strings.bif
|
||||||
reporter.bif
|
reporter.bif
|
||||||
option.bif
|
option.bif
|
||||||
# Note: the supervisor BIF file is treated like other top-level BIFs
|
# Note: the supervisor BIF file is treated like other top-level BIFs instead
|
||||||
# instead of contained in its own subdirectory CMake logic because
|
# of contained in its own subdirectory CMake logic because subdirectory BIFs
|
||||||
# subdirectory BIFs are treated differently and don't support being called
|
# are treated differently and don't support being called *during* parsing
|
||||||
# *during* parsing (e.g. within an @if directive).
|
# (e.g. within an @if directive).
|
||||||
supervisor/supervisor.bif
|
supervisor/supervisor.bif
|
||||||
# The packet analysis BIF is treated like other top-level BIFs because
|
# The packet analysis BIF is treated like other top-level BIFs because it's
|
||||||
# it's needed before parsing the packet protocol scripts, which happen
|
# needed before parsing the packet protocol scripts, which happen very near
|
||||||
# very near to the start of parsing.
|
# to the start of parsing.
|
||||||
packet_analysis/packet_analysis.bif
|
packet_analysis/packet_analysis.bif
|
||||||
# The C++ loading BIF is treated like other top-level BIFs to give
|
# The C++ loading BIF is treated like other top-level BIFs to give us
|
||||||
# us flexibility regarding when it's called.
|
# flexibility regarding when it's called.
|
||||||
script_opt/CPP/CPP-load.bif
|
script_opt/CPP/CPP-load.bif)
|
||||||
)
|
|
||||||
|
|
||||||
foreach (bift ${BIF_SRCS})
|
foreach (bift ${BIF_SRCS})
|
||||||
bif_target(${bift} "standard")
|
bif_target(${bift} "standard")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## BinPAC-dependent targets
|
# BinPAC-dependent targets
|
||||||
|
|
||||||
include(BinPAC)
|
include(BinPAC)
|
||||||
|
|
||||||
set(BINPAC_AUXSRC
|
set(BINPAC_AUXSRC ${CMAKE_CURRENT_SOURCE_DIR}/binpac.pac ${CMAKE_CURRENT_SOURCE_DIR}/zeek.pac
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/binpac.pac
|
${CMAKE_CURRENT_SOURCE_DIR}/binpac_zeek.h)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/zeek.pac
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/binpac_zeek.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(BINPAC_OUTPUTS "")
|
set(BINPAC_OUTPUTS "")
|
||||||
|
|
||||||
|
@ -168,8 +145,8 @@ list(APPEND BINPAC_OUTPUTS "${BINPAC_OUTPUT_CC}")
|
||||||
binpac_target(binpac_zeek-lib.pac)
|
binpac_target(binpac_zeek-lib.pac)
|
||||||
list(APPEND BINPAC_OUTPUTS "${BINPAC_OUTPUT_CC}")
|
list(APPEND BINPAC_OUTPUTS "${BINPAC_OUTPUT_CC}")
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Gen-ZAM setup
|
# Gen-ZAM setup
|
||||||
|
|
||||||
include(Gen-ZAM)
|
include(Gen-ZAM)
|
||||||
|
|
||||||
|
@ -177,9 +154,9 @@ set(GEN_ZAM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/script_opt/ZAM/Ops.in)
|
||||||
|
|
||||||
gen_zam_target(${GEN_ZAM_SRC})
|
gen_zam_target(${GEN_ZAM_SRC})
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Including subdirectories.
|
# Including subdirectories.
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
|
|
||||||
option(USE_SQLITE "Should Zeek use SQLite?" ON)
|
option(USE_SQLITE "Should Zeek use SQLite?" ON)
|
||||||
|
|
||||||
|
@ -195,8 +172,8 @@ add_subdirectory(logging)
|
||||||
add_subdirectory(probabilistic)
|
add_subdirectory(probabilistic)
|
||||||
add_subdirectory(session)
|
add_subdirectory(session)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Build in the discovered external plugins and create the autogenerated scripts.
|
# Build in the discovered external plugins and create the autogenerated scripts.
|
||||||
|
|
||||||
set(PRELOAD_SCRIPT ${PROJECT_BINARY_DIR}/scripts/builtin-plugins/__preload__.zeek)
|
set(PRELOAD_SCRIPT ${PROJECT_BINARY_DIR}/scripts/builtin-plugins/__preload__.zeek)
|
||||||
file(WRITE ${PRELOAD_SCRIPT} "# Warning, this is an autogenerated file!\n")
|
file(WRITE ${PRELOAD_SCRIPT} "# Warning, this is an autogenerated file!\n")
|
||||||
|
@ -204,8 +181,8 @@ set(LOAD_SCRIPT ${PROJECT_BINARY_DIR}/scripts/builtin-plugins/__load__.zeek)
|
||||||
file(WRITE ${LOAD_SCRIPT} "# Warning, this is an autogenerated file!\n")
|
file(WRITE ${LOAD_SCRIPT} "# Warning, this is an autogenerated file!\n")
|
||||||
|
|
||||||
# TODO: this really should be a function to make sure we have an isolated scope.
|
# TODO: this really should be a function to make sure we have an isolated scope.
|
||||||
# However, for historic reasons, we're not doing that yet. Some plugin
|
# However, for historic reasons, we're not doing that yet. Some plugin modify
|
||||||
# modify global state such as `zeekdeps`.
|
# global state such as `zeekdeps`.
|
||||||
macro (add_extra_builtin_plugin plugin_dir)
|
macro (add_extra_builtin_plugin plugin_dir)
|
||||||
get_filename_component(plugin_name "${plugin_dir}" NAME)
|
get_filename_component(plugin_name "${plugin_dir}" NAME)
|
||||||
|
|
||||||
|
@ -231,13 +208,13 @@ endforeach()
|
||||||
install(FILES ${PRELOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/)
|
install(FILES ${PRELOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/)
|
||||||
install(FILES ${LOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/)
|
install(FILES ${LOAD_SCRIPT} DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/builtin-plugins/)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## This has to happen after the parts for builtin plugins, or else
|
# This has to happen after the parts for builtin plugins, or else symbols are
|
||||||
## symbols are missing when it goes to link the fuzzer binaries.
|
# missing when it goes to link the fuzzer binaries.
|
||||||
add_subdirectory(fuzzers)
|
add_subdirectory(fuzzers)
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## zeek target
|
# zeek target
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
|
@ -249,8 +226,8 @@ if (POLICY CMP0012)
|
||||||
cmake_policy(SET CMP0012 NEW)
|
cmake_policy(SET CMP0012 NEW)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# This macro stores associated headers for any C/C++ source files given
|
# This macro stores associated headers for any C/C++ source files given as
|
||||||
# as arguments (past _var) as a list in the CMake variable named "_var".
|
# arguments (past _var) as a list in the CMake variable named "_var".
|
||||||
macro (COLLECT_HEADERS _var)
|
macro (COLLECT_HEADERS _var)
|
||||||
foreach (src ${ARGN})
|
foreach (src ${ARGN})
|
||||||
get_filename_component(ext ${src} EXT)
|
get_filename_component(ext ${src} EXT)
|
||||||
|
@ -270,30 +247,25 @@ endmacro(COLLECT_HEADERS _var)
|
||||||
|
|
||||||
cmake_policy(POP)
|
cmake_policy(POP)
|
||||||
|
|
||||||
# define a command that's used to run the make_dbg_constants.py script
|
# define a command that's used to run the make_dbg_constants.py script building
|
||||||
# building the zeek binary depends on the outputs of this script
|
# the zeek binary depends on the outputs of this script
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc
|
${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py
|
||||||
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in
|
${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/make_dbg_constants.py
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in
|
${CMAKE_CURRENT_SOURCE_DIR}/DebugCmdInfoConstants.in
|
||||||
COMMENT "[Python] Processing debug commands"
|
COMMENT "[Python] Processing debug commands"
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(zeek_debugcmd_gen DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h
|
||||||
zeek_debugcmd_gen
|
${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc)
|
||||||
DEPENDS
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/DebugCmdConstants.h
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/DebugCmdInfoConstants.cc
|
|
||||||
)
|
|
||||||
add_dependencies(zeek_autogen_files zeek_debugcmd_gen)
|
add_dependencies(zeek_autogen_files zeek_debugcmd_gen)
|
||||||
|
|
||||||
set(_gen_zeek_script_cpp ${CMAKE_CURRENT_BINARY_DIR}/../CPP-gen.cc)
|
set(_gen_zeek_script_cpp ${CMAKE_CURRENT_BINARY_DIR}/../CPP-gen.cc)
|
||||||
add_custom_command(OUTPUT ${_gen_zeek_script_cpp}
|
add_custom_command(OUTPUT ${_gen_zeek_script_cpp} COMMAND ${CMAKE_COMMAND} -E touch
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch ${_gen_zeek_script_cpp})
|
${_gen_zeek_script_cpp})
|
||||||
|
|
||||||
if (!MSVC)
|
if (!MSVC)
|
||||||
set_source_files_properties(legacy-netvar-init.cc PROPERTIES COMPILE_FLAGS
|
set_source_files_properties(legacy-netvar-init.cc PROPERTIES COMPILE_FLAGS
|
||||||
|
@ -386,9 +358,7 @@ set(MAIN_SRCS
|
||||||
ZeekArgs.cc
|
ZeekArgs.cc
|
||||||
ZeekString.cc
|
ZeekString.cc
|
||||||
ZVal.cc
|
ZVal.cc
|
||||||
|
|
||||||
${SUPERVISOR_SRCS}
|
${SUPERVISOR_SRCS}
|
||||||
|
|
||||||
threading/BasicThread.cc
|
threading/BasicThread.cc
|
||||||
threading/Formatter.cc
|
threading/Formatter.cc
|
||||||
threading/Manager.cc
|
threading/Manager.cc
|
||||||
|
@ -396,12 +366,10 @@ set(MAIN_SRCS
|
||||||
threading/SerialTypes.cc
|
threading/SerialTypes.cc
|
||||||
threading/formatters/Ascii.cc
|
threading/formatters/Ascii.cc
|
||||||
threading/formatters/JSON.cc
|
threading/formatters/JSON.cc
|
||||||
|
|
||||||
plugin/Component.cc
|
plugin/Component.cc
|
||||||
plugin/ComponentManager.h
|
plugin/ComponentManager.h
|
||||||
plugin/Manager.cc
|
plugin/Manager.cc
|
||||||
plugin/Plugin.cc
|
plugin/Plugin.cc
|
||||||
|
|
||||||
script_opt/CPP/Attrs.cc
|
script_opt/CPP/Attrs.cc
|
||||||
script_opt/CPP/Consts.cc
|
script_opt/CPP/Consts.cc
|
||||||
script_opt/CPP/DeclFunc.cc
|
script_opt/CPP/DeclFunc.cc
|
||||||
|
@ -421,9 +389,7 @@ set(MAIN_SRCS
|
||||||
script_opt/CPP/Types.cc
|
script_opt/CPP/Types.cc
|
||||||
script_opt/CPP/Util.cc
|
script_opt/CPP/Util.cc
|
||||||
script_opt/CPP/Vars.cc
|
script_opt/CPP/Vars.cc
|
||||||
|
|
||||||
${_gen_zeek_script_cpp}
|
${_gen_zeek_script_cpp}
|
||||||
|
|
||||||
script_opt/Expr.cc
|
script_opt/Expr.cc
|
||||||
script_opt/GenIDDefs.cc
|
script_opt/GenIDDefs.cc
|
||||||
script_opt/IDOptInfo.cc
|
script_opt/IDOptInfo.cc
|
||||||
|
@ -435,7 +401,6 @@ set(MAIN_SRCS
|
||||||
script_opt/TempVar.cc
|
script_opt/TempVar.cc
|
||||||
script_opt/UsageAnalyzer.cc
|
script_opt/UsageAnalyzer.cc
|
||||||
script_opt/UseDefs.cc
|
script_opt/UseDefs.cc
|
||||||
|
|
||||||
script_opt/ZAM/AM-Opt.cc
|
script_opt/ZAM/AM-Opt.cc
|
||||||
script_opt/ZAM/Branches.cc
|
script_opt/ZAM/Branches.cc
|
||||||
script_opt/ZAM/BuiltIn.cc
|
script_opt/ZAM/BuiltIn.cc
|
||||||
|
@ -450,9 +415,7 @@ set(MAIN_SRCS
|
||||||
script_opt/ZAM/ZBody.cc
|
script_opt/ZAM/ZBody.cc
|
||||||
script_opt/ZAM/ZInst.cc
|
script_opt/ZAM/ZInst.cc
|
||||||
script_opt/ZAM/ZOp.cc
|
script_opt/ZAM/ZOp.cc
|
||||||
|
digest.h)
|
||||||
digest.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set(THIRD_PARTY_SRCS
|
set(THIRD_PARTY_SRCS
|
||||||
3rdparty/bro_inet_ntop.c # Remove in v6.1.
|
3rdparty/bro_inet_ntop.c # Remove in v6.1.
|
||||||
|
@ -464,10 +427,10 @@ set(THIRD_PARTY_SRCS
|
||||||
3rdparty/patricia.c
|
3rdparty/patricia.c
|
||||||
3rdparty/setsignal.c
|
3rdparty/setsignal.c
|
||||||
$<$<BOOL:USE_SQLITE>:3rdparty/sqlite3.c>
|
$<$<BOOL:USE_SQLITE>:3rdparty/sqlite3.c>
|
||||||
3rdparty/strsep.c
|
3rdparty/strsep.c)
|
||||||
)
|
|
||||||
|
|
||||||
# Highwayhash. Highwayhash is a bit special since it has architecture dependent code...
|
# Highwayhash. Highwayhash is a bit special since it has architecture dependent
|
||||||
|
# code...
|
||||||
set(hhash_dir ${PROJECT_SOURCE_DIR}/auxil/highwayhash/highwayhash)
|
set(hhash_dir ${PROJECT_SOURCE_DIR}/auxil/highwayhash/highwayhash)
|
||||||
zeek_add_subdir_library(
|
zeek_add_subdir_library(
|
||||||
hhash
|
hhash
|
||||||
|
@ -479,54 +442,43 @@ zeek_add_subdir_library(
|
||||||
${hhash_dir}/instruction_sets.cc
|
${hhash_dir}/instruction_sets.cc
|
||||||
${hhash_dir}/nanobenchmark.cc
|
${hhash_dir}/nanobenchmark.cc
|
||||||
${hhash_dir}/os_specific.cc
|
${hhash_dir}/os_specific.cc
|
||||||
${hhash_dir}/hh_portable.cc
|
${hhash_dir}/hh_portable.cc)
|
||||||
)
|
|
||||||
|
|
||||||
if (${COMPILER_ARCHITECTURE} STREQUAL "arm")
|
if (${COMPILER_ARCHITECTURE} STREQUAL "arm")
|
||||||
check_c_source_compiles("
|
check_c_source_compiles(
|
||||||
|
"
|
||||||
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||||
int main() { return 0; }
|
int main() { return 0; }
|
||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
" test_arm_neon)
|
"
|
||||||
|
test_arm_neon)
|
||||||
|
|
||||||
if (test_arm_neon)
|
if (test_arm_neon)
|
||||||
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc)
|
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
target_compile_options(
|
target_compile_options(zeek_hhash_obj PRIVATE -mfloat-abi=hard -march=armv7-a -mfpu=neon)
|
||||||
zeek_hhash_obj
|
|
||||||
PRIVATE
|
|
||||||
-mfloat-abi=hard
|
|
||||||
-march=armv7-a
|
|
||||||
-mfpu=neon
|
|
||||||
)
|
|
||||||
elseif (${COMPILER_ARCHITECTURE} STREQUAL "aarch64")
|
elseif (${COMPILER_ARCHITECTURE} STREQUAL "aarch64")
|
||||||
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc)
|
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_neon.cc)
|
||||||
elseif (${COMPILER_ARCHITECTURE} STREQUAL "power")
|
elseif (${COMPILER_ARCHITECTURE} STREQUAL "power")
|
||||||
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_vsx.cc)
|
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_vsx.cc)
|
||||||
set_source_files_properties(${hhash_dir}/hh_vsx.cc PROPERTIES COMPILE_FLAGS
|
set_source_files_properties(${hhash_dir}/hh_vsx.cc PROPERTIES COMPILE_FLAGS -mvsx)
|
||||||
-mvsx)
|
|
||||||
elseif (${COMPILER_ARCHITECTURE} STREQUAL "x86_64")
|
elseif (${COMPILER_ARCHITECTURE} STREQUAL "x86_64")
|
||||||
target_sources(
|
target_sources(zeek_hhash_obj PRIVATE ${hhash_dir}/hh_avx2.cc ${hhash_dir}/hh_sse41.cc)
|
||||||
zeek_hhash_obj
|
|
||||||
PRIVATE
|
|
||||||
${hhash_dir}/hh_avx2.cc
|
|
||||||
${hhash_dir}/hh_sse41.cc)
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(_avx_flag /arch:AVX2)
|
set(_avx_flag /arch:AVX2)
|
||||||
# Using an undocumentd compiler flag: https://stackoverflow.com/questions/64053597/how-do-i-enable-sse4-1-and-sse3-but-not-avx-in-msvc/69328426#69328426
|
# Using an undocumentd compiler flag:
|
||||||
|
# https://stackoverflow.com/questions/64053597/how-do-i-enable-sse4-1-and-sse3-but-not-avx-in-msvc/69328426#69328426
|
||||||
set(_sse_flag /d2archSSE42)
|
set(_sse_flag /d2archSSE42)
|
||||||
else ()
|
else ()
|
||||||
set(_avx_flag -mavx2)
|
set(_avx_flag -mavx2)
|
||||||
set(_sse_flag -msse4.1)
|
set(_sse_flag -msse4.1)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set_source_files_properties(${hhash_dir}/hh_avx2.cc PROPERTIES COMPILE_FLAGS
|
set_source_files_properties(${hhash_dir}/hh_avx2.cc PROPERTIES COMPILE_FLAGS ${_avx_flag})
|
||||||
${_avx_flag})
|
set_source_files_properties(${hhash_dir}/hh_sse41.cc PROPERTIES COMPILE_FLAGS ${_sse_flag})
|
||||||
set_source_files_properties(${hhash_dir}/hh_sse41.cc PROPERTIES COMPILE_FLAGS
|
|
||||||
${_sse_flag})
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(zeek_SRCS
|
set(zeek_SRCS
|
||||||
|
@ -550,8 +502,7 @@ set(zeek_SRCS
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDecls.h
|
${CMAKE_CURRENT_BINARY_DIR}/ZAM-MethodDecls.h
|
||||||
${THIRD_PARTY_SRCS}
|
${THIRD_PARTY_SRCS}
|
||||||
${HH_SRCS}
|
${HH_SRCS}
|
||||||
${MAIN_SRCS}
|
${MAIN_SRCS})
|
||||||
)
|
|
||||||
|
|
||||||
collect_headers(zeek_HEADERS ${zeek_SRCS})
|
collect_headers(zeek_HEADERS ${zeek_SRCS})
|
||||||
|
|
||||||
|
@ -564,9 +515,10 @@ zeek_target_link_libraries(zeek_objs)
|
||||||
if (TARGET zeek_exe)
|
if (TARGET zeek_exe)
|
||||||
target_sources(zeek_exe PRIVATE main.cc ${zeek_HEADERS})
|
target_sources(zeek_exe PRIVATE main.cc ${zeek_HEADERS})
|
||||||
|
|
||||||
# npcap/winpcap need to be loaded in delayed mode so that we can set the load path
|
# npcap/winpcap need to be loaded in delayed mode so that we can set the load
|
||||||
# correctly at runtime. See https://npcap.com/guide/npcap-devguide.html#npcap-feature-native
|
# path correctly at runtime. See
|
||||||
# for why this is necessary.
|
# https://npcap.com/guide/npcap-devguide.html#npcap-feature-native for why
|
||||||
|
# this is necessary.
|
||||||
if (MSVC AND HAVE_WPCAP)
|
if (MSVC AND HAVE_WPCAP)
|
||||||
set(zeekdeps ${zeekdeps} delayimp.lib)
|
set(zeekdeps ${zeekdeps} delayimp.lib)
|
||||||
set_target_properties(zeek_exe PROPERTIES LINK_FLAGS "/DELAYLOAD:wpcap.dll")
|
set_target_properties(zeek_exe PROPERTIES LINK_FLAGS "/DELAYLOAD:wpcap.dll")
|
||||||
|
@ -586,12 +538,7 @@ endif()
|
||||||
if (TARGET zeek_lib)
|
if (TARGET zeek_lib)
|
||||||
target_sources(zeek_lib PRIVATE ${zeek_HEADERS})
|
target_sources(zeek_lib PRIVATE ${zeek_HEADERS})
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(zeek_lib PUBLIC ${zeekdeps} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
|
||||||
zeek_lib
|
|
||||||
PUBLIC
|
|
||||||
${zeekdeps}
|
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
|
||||||
${CMAKE_DL_LIBS})
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
zeek_include_directories(
|
zeek_include_directories(
|
||||||
|
@ -601,21 +548,23 @@ zeek_include_directories(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
${CMAKE_SOURCE_DIR}/zeek/src
|
${CMAKE_SOURCE_DIR}/zeek/src
|
||||||
${CMAKE_SOURCE_DIR}/zeek/src/include
|
${CMAKE_SOURCE_DIR}/zeek/src/include)
|
||||||
)
|
|
||||||
|
|
||||||
# Install *.bif.zeek.
|
# Install *.bif.zeek.
|
||||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/scripts/base/bif DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/base)
|
install(DIRECTORY ${PROJECT_BINARY_DIR}/scripts/base/bif
|
||||||
|
DESTINATION ${ZEEK_SCRIPT_INSTALL_PATH}/base)
|
||||||
|
|
||||||
# Create plugin directory at install time.
|
# Create plugin directory at install time.
|
||||||
install(DIRECTORY DESTINATION ${ZEEK_PLUGIN_DIR})
|
install(DIRECTORY DESTINATION ${ZEEK_PLUGIN_DIR})
|
||||||
|
|
||||||
# Make clean removes the bif directory.
|
# Make clean removes the bif directory.
|
||||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PROJECT_BINARY_DIR}/scripts/base/bif)
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
|
||||||
|
${PROJECT_BINARY_DIR}/scripts/base/bif)
|
||||||
|
|
||||||
# Remove some stale files and scripts that previous Zeek versions put in
|
# Remove some stale files and scripts that previous Zeek versions put in place,
|
||||||
# place, yet make confuse us now. This makes upgrading easier.
|
# yet make confuse us now. This makes upgrading easier.
|
||||||
install(CODE "
|
install(
|
||||||
|
CODE "
|
||||||
file(REMOVE_RECURSE
|
file(REMOVE_RECURSE
|
||||||
${ZEEK_SCRIPT_INSTALL_PATH}/base/frameworks/logging/writers/dataseries.bro
|
${ZEEK_SCRIPT_INSTALL_PATH}/base/frameworks/logging/writers/dataseries.bro
|
||||||
${ZEEK_SCRIPT_INSTALL_PATH}/base/frameworks/logging/writers/elasticsearch.bro
|
${ZEEK_SCRIPT_INSTALL_PATH}/base/frameworks/logging/writers/elasticsearch.bro
|
||||||
|
@ -623,19 +572,21 @@ install(CODE "
|
||||||
)
|
)
|
||||||
")
|
")
|
||||||
|
|
||||||
# Make sure to escape a bunch of special characters in the path before trying to use it as a
|
# Make sure to escape a bunch of special characters in the path before trying to
|
||||||
# regular expression below.
|
# use it as a regular expression below.
|
||||||
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" escaped_include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
|
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" escaped_include_path
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/*")
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/windows/usr.include/
|
install(
|
||||||
|
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/windows/usr.include/
|
||||||
DESTINATION include/
|
DESTINATION include/
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
PATTERN "*.h"
|
PATTERN "*.h")
|
||||||
)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
install(
|
||||||
|
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||||
DESTINATION include/zeek
|
DESTINATION include/zeek
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
PATTERN "*.h"
|
PATTERN "*.h"
|
||||||
|
@ -643,15 +594,14 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||||
PATTERN "3rdparty/*" EXCLUDE
|
PATTERN "3rdparty/*" EXCLUDE
|
||||||
# The "zeek -> ." symlink isn't needed in the install-tree
|
# The "zeek -> ." symlink isn't needed in the install-tree
|
||||||
REGEX "${escaped_include_path}$" EXCLUDE
|
REGEX "${escaped_include_path}$" EXCLUDE
|
||||||
|
|
||||||
# FILES_MATCHING creates empty directories:
|
# FILES_MATCHING creates empty directories:
|
||||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/17122
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/17122 Exclude the ones that
|
||||||
# Exclude the ones that this affects explicitly.
|
# this affects explicitly.
|
||||||
PATTERN "script_opt/CPP/maint" EXCLUDE
|
PATTERN "script_opt/CPP/maint" EXCLUDE
|
||||||
PATTERN "fuzzers/corpora" EXCLUDE
|
PATTERN "fuzzers/corpora" EXCLUDE)
|
||||||
)
|
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
|
install(
|
||||||
|
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
|
||||||
DESTINATION include/zeek
|
DESTINATION include/zeek
|
||||||
FILES_MATCHING
|
FILES_MATCHING
|
||||||
PATTERN "*.bif.func_h"
|
PATTERN "*.bif.func_h"
|
||||||
|
@ -659,11 +609,10 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
|
||||||
PATTERN "*.bif.h"
|
PATTERN "*.bif.h"
|
||||||
PATTERN "CMakeFiles" EXCLUDE
|
PATTERN "CMakeFiles" EXCLUDE
|
||||||
# The "include/zeek -> .." symlink isn't needed in the install-tree
|
# The "include/zeek -> .." symlink isn't needed in the install-tree
|
||||||
REGEX "${escaped_include_path}$" EXCLUDE
|
REGEX "${escaped_include_path}$" EXCLUDE)
|
||||||
)
|
|
||||||
|
|
||||||
install(FILES
|
install(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ConvertUTF.h
|
FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/ConvertUTF.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bro_inet_ntop.h # Remove in v6.1
|
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bro_inet_ntop.h # Remove in v6.1
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zeek_inet_ntop.h
|
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zeek_inet_ntop.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bsd-getopt-long.h
|
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/bsd-getopt-long.h
|
||||||
|
@ -672,11 +621,10 @@ install(FILES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/setsignal.h
|
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/setsignal.h
|
||||||
$<$<BOOL:USE_SQLITE>:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h>
|
$<$<BOOL:USE_SQLITE>:${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h>
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/doctest.h
|
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/doctest.h
|
||||||
DESTINATION include/zeek/3rdparty
|
DESTINATION include/zeek/3rdparty)
|
||||||
)
|
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Clang-tidy target now that we have all of the sources
|
# Clang-tidy target now that we have all of the sources
|
||||||
|
|
||||||
add_clang_tidy_files(${MAIN_SRCS})
|
add_clang_tidy_files(${MAIN_SRCS})
|
||||||
|
|
||||||
|
@ -685,8 +633,8 @@ add_clang_tidy_files(${MAIN_SRCS})
|
||||||
# *.bif.register.cc)
|
# *.bif.register.cc)
|
||||||
create_clang_tidy_target()
|
create_clang_tidy_target()
|
||||||
|
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## CTest setup.
|
# CTest setup.
|
||||||
|
|
||||||
# Scan all .cc files for TEST_CASE macros and generate CTest targets.
|
# Scan all .cc files for TEST_CASE macros and generate CTest targets.
|
||||||
if (ENABLE_ZEEK_UNIT_TESTS)
|
if (ENABLE_ZEEK_UNIT_TESTS)
|
||||||
|
@ -699,9 +647,8 @@ if (ENABLE_ZEEK_UNIT_TESTS)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
list(LENGTH test_cases num_test_cases)
|
list(LENGTH test_cases num_test_cases)
|
||||||
MESSAGE(STATUS "-- Found ${num_test_cases} test cases for CTest")
|
message(STATUS "-- Found ${num_test_cases} test cases for CTest")
|
||||||
foreach (test_case ${test_cases})
|
foreach (test_case ${test_cases})
|
||||||
add_test(NAME "\"${test_case}\""
|
add_test(NAME "\"${test_case}\"" COMMAND zeek --test "--test-case=${test_case}")
|
||||||
COMMAND zeek --test "--test-case=${test_case}")
|
|
||||||
endforeach ()
|
endforeach ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
zeek_add_subdir_library(
|
zeek_add_subdir_library(
|
||||||
analyzer
|
analyzer
|
||||||
INTERNAL_DEPENDENCIES ${BIF_BUILD_TARGET}
|
INTERNAL_DEPENDENCIES
|
||||||
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
${BIF_BUILD_TARGET}
|
||||||
|
INCLUDE_DIRS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
SOURCES
|
SOURCES
|
||||||
Analyzer.cc
|
Analyzer.cc
|
||||||
Component.cc
|
Component.cc
|
||||||
Manager.cc
|
Manager.cc)
|
||||||
)
|
|
||||||
|
|
||||||
# Treat BIFs as builtin (alternative mode).
|
# Treat BIFs as builtin (alternative mode).
|
||||||
bif_target(analyzer.bif)
|
bif_target(analyzer.bif)
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
bittorrent.pac
|
bittorrent.pac
|
||||||
bittorrent-analyzer.pac
|
bittorrent-analyzer.pac
|
||||||
bittorrent-protocol.pac
|
bittorrent-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -14,5 +14,4 @@ zeek_add_plugin(
|
||||||
dce_rpc-analyzer.pac
|
dce_rpc-analyzer.pac
|
||||||
dce_rpc-auth.pac
|
dce_rpc-auth.pac
|
||||||
endpoint-atsvc.pac
|
endpoint-atsvc.pac
|
||||||
endpoint-epmapper.pac
|
endpoint-epmapper.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -11,5 +11,4 @@ zeek_add_plugin(
|
||||||
dhcp.pac
|
dhcp.pac
|
||||||
dhcp-protocol.pac
|
dhcp-protocol.pac
|
||||||
dhcp-analyzer.pac
|
dhcp-analyzer.pac
|
||||||
dhcp-options.pac
|
dhcp-options.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
dnp3.pac
|
dnp3.pac
|
||||||
dnp3-analyzer.pac
|
dnp3-analyzer.pac
|
||||||
dnp3-protocol.pac
|
dnp3-protocol.pac
|
||||||
dnp3-objects.pac
|
dnp3-objects.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
DNS.cc
|
DNS.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
File.cc
|
File.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ spicy_add_analyzer(
|
||||||
finger.spicy
|
finger.spicy
|
||||||
finger.evt
|
finger.evt
|
||||||
LEGACY
|
LEGACY
|
||||||
legacy
|
legacy)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Finger.cc
|
Finger.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Gnutella.cc
|
Gnutella.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
gssapi.pac
|
gssapi.pac
|
||||||
gssapi-protocol.pac
|
gssapi-protocol.pac
|
||||||
gssapi-analyzer.pac
|
gssapi-analyzer.pac
|
||||||
${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac
|
${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Ident.cc
|
Ident.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
imap.pac
|
imap.pac
|
||||||
imap-analyzer.pac
|
imap-analyzer.pac
|
||||||
imap-protocol.pac
|
imap-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
IRC.cc
|
IRC.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -25,5 +25,4 @@ zeek_add_plugin(
|
||||||
krb-defs.pac
|
krb-defs.pac
|
||||||
krb-types.pac
|
krb-types.pac
|
||||||
krb-padata.pac
|
krb-padata.pac
|
||||||
${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac
|
${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
MIME.cc
|
MIME.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
modbus.pac
|
modbus.pac
|
||||||
modbus-analyzer.pac
|
modbus-analyzer.pac
|
||||||
modbus-protocol.pac
|
modbus-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -23,5 +23,4 @@ zeek_add_plugin(
|
||||||
commands/unsubscribe.pac
|
commands/unsubscribe.pac
|
||||||
commands/disconnect.pac
|
commands/disconnect.pac
|
||||||
commands/pingreq.pac
|
commands/pingreq.pac
|
||||||
commands/pingresp.pac
|
commands/pingresp.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
mysql.pac
|
mysql.pac
|
||||||
mysql-analyzer.pac
|
mysql-analyzer.pac
|
||||||
mysql-protocol.pac
|
mysql-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -8,5 +8,4 @@ zeek_add_plugin(
|
||||||
events.bif
|
events.bif
|
||||||
consts.bif
|
consts.bif
|
||||||
PAC
|
PAC
|
||||||
ncp.pac
|
ncp.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
ntlm.pac
|
ntlm.pac
|
||||||
ntlm-protocol.pac
|
ntlm-protocol.pac
|
||||||
ntlm-analyzer.pac
|
ntlm-analyzer.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -11,5 +11,4 @@ zeek_add_plugin(
|
||||||
ntp.pac
|
ntp.pac
|
||||||
ntp-analyzer.pac
|
ntp-analyzer.pac
|
||||||
ntp-mode7.pac
|
ntp-mode7.pac
|
||||||
ntp-protocol.pac
|
ntp-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(Zeek PIA SOURCES PIA.cc Plugin.cc)
|
||||||
Zeek
|
|
||||||
PIA
|
|
||||||
SOURCES
|
|
||||||
PIA.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
POP3.cc
|
POP3.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
radius.pac
|
radius.pac
|
||||||
radius-analyzer.pac
|
radius-analyzer.pac
|
||||||
radius-protocol.pac
|
radius-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -16,5 +16,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
rdpeudp.pac
|
rdpeudp.pac
|
||||||
rdpeudp-analyzer.pac
|
rdpeudp-analyzer.pac
|
||||||
rdpeudp-protocol.pac
|
rdpeudp-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
rfb.pac
|
rfb.pac
|
||||||
rfb-analyzer.pac
|
rfb-analyzer.pac
|
||||||
rfb-protocol.pac
|
rfb-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
XDR.cc
|
XDR.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -14,5 +14,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
sip_TCP.pac
|
sip_TCP.pac
|
||||||
sip-protocol.pac
|
sip-protocol.pac
|
||||||
sip-analyzer.pac
|
sip-analyzer.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -85,5 +85,4 @@ zeek_add_plugin(
|
||||||
smb2-com-tree-connect.pac
|
smb2-com-tree-connect.pac
|
||||||
smb2-com-tree-disconnect.pac
|
smb2-com-tree-disconnect.pac
|
||||||
smb2-com-write.pac
|
smb2-com-write.pac
|
||||||
smb2-com-transform-header.pac
|
smb2-com-transform-header.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -11,5 +11,4 @@ zeek_add_plugin(
|
||||||
snmp.pac
|
snmp.pac
|
||||||
snmp-protocol.pac
|
snmp-protocol.pac
|
||||||
snmp-analyzer.pac
|
snmp-analyzer.pac
|
||||||
${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac
|
${PROJECT_SOURCE_DIR}/src/analyzer/protocol/asn1/asn1.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
socks.pac
|
socks.pac
|
||||||
socks-protocol.pac
|
socks-protocol.pac
|
||||||
socks-analyzer.pac
|
socks-analyzer.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -11,5 +11,4 @@ zeek_add_plugin(
|
||||||
ssh.pac
|
ssh.pac
|
||||||
ssh-analyzer.pac
|
ssh-analyzer.pac
|
||||||
ssh-protocol.pac
|
ssh-protocol.pac
|
||||||
consts.pac
|
consts.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -31,5 +31,4 @@ zeek_add_plugin(
|
||||||
dtls-analyzer.pac
|
dtls-analyzer.pac
|
||||||
ssl-dtls-protocol.pac
|
ssl-dtls-protocol.pac
|
||||||
dtls-protocol.pac
|
dtls-protocol.pac
|
||||||
ssl-defs.pac
|
ssl-defs.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ spicy_add_analyzer(
|
||||||
syslog.spicy
|
syslog.spicy
|
||||||
syslog.evt
|
syslog.evt
|
||||||
LEGACY
|
LEGACY
|
||||||
legacy
|
legacy)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
syslog.pac
|
syslog.pac
|
||||||
syslog-analyzer.pac
|
syslog-analyzer.pac
|
||||||
syslog-protocol.pac
|
syslog-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
types.bif
|
types.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -9,5 +9,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
xmpp.pac
|
xmpp.pac
|
||||||
xmpp-analyzer.pac
|
xmpp-analyzer.pac
|
||||||
xmpp-protocol.pac
|
xmpp-protocol.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(Zeek ZIP SOURCES ZIP.cc Plugin.cc)
|
||||||
Zeek
|
|
||||||
ZIP
|
|
||||||
SOURCES
|
|
||||||
ZIP.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
zeek_add_subdir_library(
|
zeek_add_subdir_library(
|
||||||
comm
|
comm
|
||||||
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDE_DIRS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
SOURCES
|
SOURCES
|
||||||
Data.cc
|
Data.cc
|
||||||
Manager.cc
|
Manager.cc
|
||||||
|
@ -9,5 +11,4 @@ zeek_add_subdir_library(
|
||||||
comm.bif
|
comm.bif
|
||||||
data.bif
|
data.bif
|
||||||
messaging.bif
|
messaging.bif
|
||||||
store.bif
|
store.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
zeek_add_subdir_library(
|
zeek_add_subdir_library(
|
||||||
file_analysis
|
file_analysis
|
||||||
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDE_DIRS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
SOURCES
|
SOURCES
|
||||||
Manager.cc
|
Manager.cc
|
||||||
File.cc
|
File.cc
|
||||||
|
@ -10,7 +12,6 @@ zeek_add_subdir_library(
|
||||||
AnalyzerSet.cc
|
AnalyzerSet.cc
|
||||||
Component.cc
|
Component.cc
|
||||||
BIFS
|
BIFS
|
||||||
file_analysis.bif
|
file_analysis.bif)
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(analyzer)
|
add_subdirectory(analyzer)
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
DataEvent.cc
|
DataEvent.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
INCLUDE_DIRS
|
INCLUDE_DIRS
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
"${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Entropy.cc
|
Entropy.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif
|
||||||
functions.bif
|
functions.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Hash.cc
|
Hash.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -12,5 +12,4 @@ zeek_add_plugin(
|
||||||
pe-file-headers.pac
|
pe-file-headers.pac
|
||||||
pe-file-idata.pac
|
pe-file-idata.pac
|
||||||
pe-file.pac
|
pe-file.pac
|
||||||
pe-file-types.pac
|
pe-file-types.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -13,5 +13,4 @@ zeek_add_plugin(
|
||||||
ocsp_events.bif
|
ocsp_events.bif
|
||||||
PAC
|
PAC
|
||||||
x509-extension.pac
|
x509-extension.pac
|
||||||
x509-signed_certificate_timestamp.pac
|
x509-signed_certificate_timestamp.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
########################################################################
|
# ##############################################################################
|
||||||
## Fuzzing targets
|
# Fuzzing targets
|
||||||
|
|
||||||
if (NOT ZEEK_ENABLE_FUZZERS)
|
if (NOT ZEEK_ENABLE_FUZZERS)
|
||||||
return()
|
return()
|
||||||
|
@ -10,7 +10,7 @@ if ( NOT DEFINED ZEEK_FUZZING_ENGINE AND DEFINED ENV{LIB_FUZZING_ENGINE} )
|
||||||
# Empty LIB_FUZZING_ENGINE, assume libFuzzer
|
# Empty LIB_FUZZING_ENGINE, assume libFuzzer
|
||||||
set(ZEEK_FUZZING_ENGINE "-fsanitize=fuzzer" CACHE INTERNAL "" FORCE)
|
set(ZEEK_FUZZING_ENGINE "-fsanitize=fuzzer" CACHE INTERNAL "" FORCE)
|
||||||
else ()
|
else ()
|
||||||
STRING(SUBSTRING "$ENV{LIB_FUZZING_ENGINE}" 0 1 _first_char)
|
string(SUBSTRING "$ENV{LIB_FUZZING_ENGINE}" 0 1 _first_char)
|
||||||
|
|
||||||
if ("${_first_char}" STREQUAL "-" OR EXISTS "$ENV{LIB_FUZZING_ENGINE}")
|
if ("${_first_char}" STREQUAL "-" OR EXISTS "$ENV{LIB_FUZZING_ENGINE}")
|
||||||
# Looks like a linker flag or valid file, use it
|
# Looks like a linker flag or valid file, use it
|
||||||
|
@ -23,10 +23,10 @@ if ( NOT DEFINED ZEEK_FUZZING_ENGINE AND DEFINED ENV{LIB_FUZZING_ENGINE} )
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# The bind library is handled a bit hack-ishly since it defaults to linking it
|
# The bind library is handled a bit hack-ishly since it defaults to linking it
|
||||||
# as static library by default on Linux, but at least on one common distro,
|
# as static library by default on Linux, but at least on one common distro, that
|
||||||
# that static library wasn't compiled with -fPIC and so not usable in the
|
# static library wasn't compiled with -fPIC and so not usable in the shared
|
||||||
# shared library we're trying to build. So instead, the fuzzer executable, not
|
# library we're trying to build. So instead, the fuzzer executable, not the
|
||||||
# the shared lib, links it.
|
# shared lib, links it.
|
||||||
string(REGEX MATCH ".*\\.a$" _have_static_bind_lib "${BIND_LIBRARY}")
|
string(REGEX MATCH ".*\\.a$" _have_static_bind_lib "${BIND_LIBRARY}")
|
||||||
|
|
||||||
macro (SETUP_FUZZ_TARGET _fuzz_target _fuzz_source)
|
macro (SETUP_FUZZ_TARGET _fuzz_target _fuzz_source)
|
||||||
|
@ -42,8 +42,7 @@ macro(SETUP_FUZZ_TARGET _fuzz_target _fuzz_source)
|
||||||
if (DEFINED ZEEK_FUZZING_ENGINE)
|
if (DEFINED ZEEK_FUZZING_ENGINE)
|
||||||
target_link_libraries(${_fuzz_target} ${ZEEK_FUZZING_ENGINE})
|
target_link_libraries(${_fuzz_target} ${ZEEK_FUZZING_ENGINE})
|
||||||
else ()
|
else ()
|
||||||
target_link_libraries(${_fuzz_target}
|
target_link_libraries(${_fuzz_target} $<TARGET_OBJECTS:zeek_fuzzer_standalone>)
|
||||||
$<TARGET_OBJECTS:zeek_fuzzer_standalone>)
|
|
||||||
endif ()
|
endif ()
|
||||||
endmacro ()
|
endmacro ()
|
||||||
|
|
||||||
|
@ -78,8 +77,7 @@ foreach(_dep ${zeekdeps} )
|
||||||
endif ()
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
target_link_libraries(zeek_fuzzer_shared PUBLIC
|
target_link_libraries(zeek_fuzzer_shared PUBLIC ${zeek_fuzzer_shared_deps}
|
||||||
${zeek_fuzzer_shared_deps}
|
|
||||||
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
|
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
|
||||||
|
|
||||||
add_fuzz_target(packet)
|
add_fuzz_target(packet)
|
||||||
|
@ -116,14 +114,15 @@ add_generic_analyzer_fuzz_target(syslog)
|
||||||
# add_generic_analyzer_fuzz_target(finger) # no pcap files
|
# add_generic_analyzer_fuzz_target(finger) # no pcap files
|
||||||
# add_generic_analyzer_fuzz_target(gssapi) # only samples are embedded in smb
|
# add_generic_analyzer_fuzz_target(gssapi) # only samples are embedded in smb
|
||||||
# add_generic_analyzer_fuzz_target(ident) # no pcap files
|
# add_generic_analyzer_fuzz_target(ident) # no pcap files
|
||||||
#add_generic_analyzer_fuzz_target(krb) # should these just be handled by smb?
|
# add_generic_analyzer_fuzz_target(krb) # should these just be handled by
|
||||||
#add_generic_analyzer_fuzz_target(krb_tcp) # should these just be handled by smb?
|
# smb? add_generic_analyzer_fuzz_target(krb_tcp) # should these just be handled
|
||||||
#add_generic_analyzer_fuzz_target(rsh) # login - no pcap files
|
# by smb? add_generic_analyzer_fuzz_target(rsh) # login - no pcap files
|
||||||
# add_generic_analyzer_fuzz_target(rlogin) # login - no pcap files
|
# add_generic_analyzer_fuzz_target(rlogin) # login - no pcap files
|
||||||
# add_generic_analyzer_fuzz_target(telnet) # login - no pcap files
|
# add_generic_analyzer_fuzz_target(telnet) # login - no pcap files
|
||||||
# add_generic_analyzer_fuzz_target(netbios) # no pcap files
|
# add_generic_analyzer_fuzz_target(netbios) # no pcap files
|
||||||
#add_generic_analyzer_fuzz_target(ntlm) # only samples are embedded in dce-rpc or smb
|
# add_generic_analyzer_fuzz_target(ntlm) # only samples are embedded in
|
||||||
#add_generic_analyzer_fuzz_target(xdr) # rpc - no pcap files
|
# dce-rpc or smb add_generic_analyzer_fuzz_target(xdr) # rpc - no pcap files
|
||||||
# add_generic_analyzer_fuzz_target(sip_tcp) # unnecessary?
|
# add_generic_analyzer_fuzz_target(sip_tcp) # unnecessary?
|
||||||
#add_generic_analyzer_fuzz_target(socks) # can this one be tested by adding SOCKS pkts to the HTTP corpus?
|
# add_generic_analyzer_fuzz_target(socks) # can this one be tested by adding
|
||||||
#add_generic_analyzer_fuzz_target(xmpp) # no pcap files
|
# SOCKS pkts to the HTTP corpus? add_generic_analyzer_fuzz_target(xmpp) # no
|
||||||
|
# pcap files
|
||||||
|
|
|
@ -6,7 +6,6 @@ zeek_add_subdir_library(
|
||||||
ReaderBackend.cc
|
ReaderBackend.cc
|
||||||
ReaderFrontend.cc
|
ReaderFrontend.cc
|
||||||
BIFS
|
BIFS
|
||||||
input.bif
|
input.bif)
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(readers)
|
add_subdirectory(readers)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
add_subdirectory(ascii)
|
add_subdirectory(ascii)
|
||||||
add_subdirectory(benchmark)
|
add_subdirectory(benchmark)
|
||||||
add_subdirectory(binary)
|
add_subdirectory(binary)
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Ascii.cc
|
Ascii.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
ascii.bif
|
ascii.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Benchmark.cc
|
Benchmark.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
benchmark.bif
|
benchmark.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Binary.cc
|
Binary.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
binary.bif
|
binary.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Config.cc
|
Config.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
config.bif
|
config.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Raw.cc
|
Raw.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
raw.bif
|
raw.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
SQLite.cc
|
SQLite.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
sqlite.bif
|
sqlite.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ zeek_add_subdir_library(
|
||||||
Manager.cc
|
Manager.cc
|
||||||
Packet.cc
|
Packet.cc
|
||||||
PktDumper.cc
|
PktDumper.cc
|
||||||
PktSrc.cc
|
PktSrc.cc)
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(pcap)
|
add_subdirectory(pcap)
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(Zeek Pcap SOURCES Source.cc Dumper.cc Plugin.cc)
|
||||||
Zeek
|
|
||||||
Pcap
|
|
||||||
SOURCES
|
|
||||||
Source.cc
|
|
||||||
Dumper.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
||||||
# Treat BIFs as builtin (alternative mode).
|
# Treat BIFs as builtin (alternative mode).
|
||||||
bif_target(pcap.bif)
|
bif_target(pcap.bif)
|
||||||
|
|
|
@ -6,7 +6,6 @@ zeek_add_subdir_library(
|
||||||
WriterBackend.cc
|
WriterBackend.cc
|
||||||
WriterFrontend.cc
|
WriterFrontend.cc
|
||||||
BIFS
|
BIFS
|
||||||
logging.bif
|
logging.bif)
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(writers)
|
add_subdirectory(writers)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
add_subdirectory(ascii)
|
add_subdirectory(ascii)
|
||||||
add_subdirectory(none)
|
add_subdirectory(none)
|
||||||
if (USE_SQLITE)
|
if (USE_SQLITE)
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Ascii.cc
|
Ascii.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
ascii.bif
|
ascii.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
None.cc
|
None.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
none.bif
|
none.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
SQLite.cc
|
SQLite.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
sqlite.bif
|
sqlite.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
zeek_add_subdir_library(
|
zeek_add_subdir_library(
|
||||||
packet_analysis
|
packet_analysis
|
||||||
INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDE_DIRS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
SOURCES
|
SOURCES
|
||||||
Analyzer.cc
|
Analyzer.cc
|
||||||
Dispatcher.cc
|
Dispatcher.cc
|
||||||
Manager.cc
|
Manager.cc
|
||||||
Component.cc
|
Component.cc)
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(protocol)
|
add_subdirectory(protocol)
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
ARP.cc
|
ARP.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(Zeek AYIYA SOURCES AYIYA.cc Plugin.cc)
|
||||||
Zeek
|
|
||||||
AYIYA
|
|
||||||
SOURCES
|
|
||||||
AYIYA.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer Ethernet SOURCES Ethernet.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
Ethernet
|
|
||||||
SOURCES
|
|
||||||
Ethernet.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer FDDI SOURCES FDDI.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
FDDI
|
|
||||||
SOURCES
|
|
||||||
FDDI.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
Geneve.cc
|
Geneve.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer GRE SOURCES GRE.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
GRE
|
|
||||||
SOURCES
|
|
||||||
GRE.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -10,5 +10,4 @@ zeek_add_plugin(
|
||||||
PAC
|
PAC
|
||||||
gtpv1.pac
|
gtpv1.pac
|
||||||
gtpv1-protocol.pac
|
gtpv1-protocol.pac
|
||||||
gtpv1-analyzer.pac
|
gtpv1-analyzer.pac)
|
||||||
)
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ zeek_add_plugin(
|
||||||
ICMPSessionAdapter.cc
|
ICMPSessionAdapter.cc
|
||||||
Plugin.cc
|
Plugin.cc
|
||||||
BIFS
|
BIFS
|
||||||
events.bif
|
events.bif)
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer IEEE802_11 SOURCES IEEE802_11.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
IEEE802_11
|
|
||||||
SOURCES
|
|
||||||
IEEE802_11.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer IEEE802_11_Radio SOURCES IEEE802_11_Radio.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
IEEE802_11_Radio
|
|
||||||
SOURCES
|
|
||||||
IEEE802_11_Radio.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -5,5 +5,4 @@ zeek_add_plugin(
|
||||||
IP.cc
|
IP.cc
|
||||||
IPBasedAnalyzer.cc
|
IPBasedAnalyzer.cc
|
||||||
SessionAdapter.cc
|
SessionAdapter.cc
|
||||||
Plugin.cc
|
Plugin.cc)
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer IPTunnel SOURCES IPTunnel.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
IPTunnel
|
|
||||||
SOURCES
|
|
||||||
IPTunnel.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer LinuxSLL SOURCES LinuxSLL.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
LinuxSLL
|
|
||||||
SOURCES
|
|
||||||
LinuxSLL.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer LinuxSLL2 SOURCES LinuxSLL2.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
LinuxSLL2
|
|
||||||
SOURCES
|
|
||||||
LinuxSLL2.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer LLC SOURCES LLC.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
LLC
|
|
||||||
SOURCES
|
|
||||||
LLC.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer MPLS SOURCES MPLS.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
MPLS
|
|
||||||
SOURCES
|
|
||||||
MPLS.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer NFLog SOURCES NFLog.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
NFLog
|
|
||||||
SOURCES
|
|
||||||
NFLog.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer Novell_802_3 SOURCES Novell_802_3.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
Novell_802_3
|
|
||||||
SOURCES
|
|
||||||
Novell_802_3.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer Null SOURCES Null.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
Null
|
|
||||||
SOURCES
|
|
||||||
Null.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
include(ZeekPlugin)
|
include(ZeekPlugin)
|
||||||
|
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer PPPSerial SOURCES PPPSerial.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
PPPSerial
|
|
||||||
SOURCES
|
|
||||||
PPPSerial.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer PPPoE SOURCES PPPoE.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
PPPoE
|
|
||||||
SOURCES
|
|
||||||
PPPoE.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer Root SOURCES Root.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
Root
|
|
||||||
SOURCES
|
|
||||||
Root.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,7 +1 @@
|
||||||
zeek_add_plugin(
|
zeek_add_plugin(PacketAnalyzer Skip SOURCES Skip.cc Plugin.cc)
|
||||||
PacketAnalyzer
|
|
||||||
Skip
|
|
||||||
SOURCES
|
|
||||||
Skip.cc
|
|
||||||
Plugin.cc
|
|
||||||
)
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue