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