mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

This reflects the `spicy-plugin` code as of `d8c296b81cc2a11`. In addition to moving the code into Zeek's source tree, this comes with a couple small functional changes: - `spicyz` no longer tries to infer if it's running from the build directory. Instead `ZEEK_SPICY_LIBRARY` can be set to a custom location. `zeek-set-path.sh` does that now. - ZEEK_CONFIG can be set to change what `spicyz -z` print out. This is primarily for backwards compatibility. Some further notes on specifics: - We raise the minimum Spicy version to 1.8 (i.e., current `main` branch). - Renamed the `compiler/` subdirectory to `spicyz` to avoid include-path conflicts with the Spicy headers. - In `cmake/`, the corresponding PR brings a new/extended version of `FindZeek`, which Spicy analyzer packages need. We also now install some of the files that the Spicy plugin used to bring for testing, so that existing packages keep working. - For now, this all remains backwards compatible with the current `zkg` analyzer templates so that they work with both external and integrated Spicy support. Later, once we don't need to support any external Spicy plugin versions anymore, we can clean up the templates as well. - All the plugin's tests have moved into the standard test suite. They are skipped if configure with `--disable-spicy`. This holds off on adapting the new code further to Zeek's coding conventions, so that it remains easier to maintain it in parallel to the (now legacy) external plugin. We'll make a pass over the formatting for (presumable) Zeek 6.1.
159 lines
4.4 KiB
Bash
Executable file
159 lines
4.4 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
binpac_root="@ZEEK_CONFIG_BINPAC_ROOT_DIR@"
|
|
broker_root="@ZEEK_CONFIG_BROKER_ROOT_DIR@"
|
|
btest_tools_dir="@ZEEK_CONFIG_BTEST_TOOLS_DIR@"
|
|
build_type="@CMAKE_BUILD_TYPE_LOWER@"
|
|
cmake_dir="@ZEEK_CMAKE_CONFIG_DIR@"
|
|
config_dir="@ZEEK_ETC_INSTALL_DIR@"
|
|
have_spicy="@USE_SPICY_ANALYZERS@"
|
|
include_dir="@CMAKE_INSTALL_PREFIX@/include"
|
|
lib_dir="@CMAKE_INSTALL_FULL_LIBDIR@"
|
|
plugin_dir="@ZEEK_PLUGIN_DIR@"
|
|
prefix="@CMAKE_INSTALL_PREFIX@"
|
|
python_dir="@PY_MOD_INSTALL_DIR@"
|
|
script_dir="@ZEEK_SCRIPT_INSTALL_PATH@"
|
|
site_dir="@ZEEK_SCRIPT_INSTALL_PATH@/site"
|
|
version="@VERSION@"
|
|
zeek_dist="@ZEEK_DIST@"
|
|
zeekpath="@DEFAULT_ZEEKPATH@"
|
|
|
|
add_path() {
|
|
# $1: existing path
|
|
# $2: path to add
|
|
if test -z "$2" || test "$1" = "$2" ||
|
|
echo "$1" | grep -q "^$2:" 2>/dev/null ||
|
|
echo "$1" | grep -q ":$2:" 2>/dev/null ||
|
|
echo "$1" | grep -q ":$2$" 2>/dev/null; then
|
|
echo "$1"
|
|
return
|
|
fi
|
|
|
|
echo "$1:$2"
|
|
}
|
|
|
|
# When changing any of these, also update "src/spicy/spicyz/config.h.in".
|
|
include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_PCAP_INCLUDE_DIR@")
|
|
include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_ZLIB_INCLUDE_DIR@")
|
|
include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_OPENSSL_INCLUDE_DIR@")
|
|
include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_LibKrb5_INCLUDE_DIR@")
|
|
include_dir=$(add_path "$include_dir" "@ZEEK_CONFIG_GooglePerftools_INCLUDE_DIR@")
|
|
|
|
usage() {
|
|
echo "Usage: zeek-config [OPTIONS]
|
|
|
|
Basic options:
|
|
|
|
--build_type Zeek build type as per cmake, lower case (e.g. 'relwithdebinfo')
|
|
--prefix Toplevel Zeek distribution installation directory
|
|
--version Zeek version number
|
|
--zeek_dist Toplevel directory of source tree the distribution built from
|
|
--zeekpath ZEEKPATH environment variable paths for this distribution
|
|
|
|
Specific directories in the Zeek distribution:
|
|
|
|
--btest_tools_dir Zeek-related BTest tooling
|
|
--cmake_dir Zeek's cmake modules
|
|
--config_dir Configuration files for cluster topology, zkg, etc
|
|
--include_dir C/C++ header folders for Zeek and related components, colon-separated
|
|
--lib_dir Toplevel folder for shared libraries, Python packages, etc
|
|
--plugin_dir Native-code Zeek plugins
|
|
--python_dir Python packages (Broker, ZeekControl, zkg, etc)
|
|
--script_dir Toplevel folder for Zeek scripts
|
|
--site_dir Site-specific Zeek scripts
|
|
|
|
Toplevel installation directories for third-party components:
|
|
|
|
--binpac_root BinPAC compiler
|
|
--broker_root Broker communication framework
|
|
|
|
Feature tests:
|
|
|
|
--have-spicy-analyzers Prints 'yes' if built-in Spicy analyzers are available; exit code reflects result
|
|
"
|
|
}
|
|
|
|
if [ $# -eq 0 ]; then
|
|
usage 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
while [ $# -ne 0 ]; do
|
|
case "$1" in
|
|
-*=*) optarg=$(echo "$1" | sed 's/[-_a-zA-Z0-9]*=//') ;;
|
|
*) optarg= ;;
|
|
esac
|
|
|
|
case $1 in
|
|
--binpac_root)
|
|
echo $binpac_root
|
|
;;
|
|
--bro_dist) # For compatibility with legacy Bro plugins.
|
|
echo $zeek_dist
|
|
;;
|
|
--broker_root)
|
|
echo $broker_root
|
|
;;
|
|
--bropath) # For compatibility with legacy Bro plugins.
|
|
echo $zeekpath
|
|
;;
|
|
--btest_tools_dir)
|
|
echo $btest_tools_dir
|
|
;;
|
|
--build_type)
|
|
echo $build_type
|
|
;;
|
|
--cmake_dir)
|
|
echo $cmake_dir
|
|
;;
|
|
--config_dir)
|
|
echo $config_dir
|
|
;;
|
|
--have-spicy-analyzers)
|
|
if [ "$have_spicy" = "yes" ]; then
|
|
echo "yes"
|
|
exit 0
|
|
else
|
|
echo "no"
|
|
exit 1
|
|
fi
|
|
;;
|
|
--include_dir)
|
|
echo $include_dir
|
|
;;
|
|
--lib_dir)
|
|
echo $lib_dir
|
|
;;
|
|
--plugin_dir)
|
|
echo $plugin_dir
|
|
;;
|
|
--prefix)
|
|
echo $prefix
|
|
;;
|
|
--python_dir)
|
|
echo $python_dir
|
|
;;
|
|
--script_dir)
|
|
echo $script_dir
|
|
;;
|
|
--site_dir)
|
|
echo $site_dir
|
|
;;
|
|
--version)
|
|
echo $version
|
|
;;
|
|
--zeek_dist)
|
|
echo $zeek_dist
|
|
;;
|
|
--zeekpath)
|
|
echo $zeekpath
|
|
;;
|
|
*)
|
|
usage 1>&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
exit 0
|