mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Add 'bro-config' script.
This commit is contained in:
parent
5c0d8c649a
commit
c29cd54618
4 changed files with 76 additions and 4 deletions
|
@ -170,9 +170,19 @@ include(RequireCXX11)
|
|||
# Tell the plugin code that we're building as part of the main tree.
|
||||
set(BRO_PLUGIN_INTERNAL_BUILD true CACHE INTERNAL "" FORCE)
|
||||
|
||||
set(DEFAULT_BROPATH .:${BRO_SCRIPT_INSTALL_PATH}:${BRO_SCRIPT_INSTALL_PATH}/policy:${BRO_SCRIPT_INSTALL_PATH}/site)
|
||||
|
||||
if ( NOT BINARY_PACKAGING_MODE )
|
||||
set(BRO_DIST ${CMAKE_SOURCE_DIR})
|
||||
endif ()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bro-config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/bro-config.h)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bro-config.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/bro-config @ONLY)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bro-config DESTINATION bin)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
########################################################################
|
||||
|
|
63
bro-config.in
Executable file
63
bro-config.in
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh
|
||||
|
||||
version=@VERSION@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
script_dir=@BRO_SCRIPT_INSTALL_PATH@
|
||||
site_dir=@BRO_SCRIPT_INSTALL_PATH@/site
|
||||
plugin_dir=@BRO_PLUGIN_INSTALL_PATH@
|
||||
config_dir=@BRO_ETC_INSTALL_DIR@
|
||||
python_dir=@PY_MOD_INSTALL_DIR@
|
||||
bropath=@DEFAULT_BROPATH@
|
||||
bro_dist=@BRO_DIST@
|
||||
|
||||
usage="\
|
||||
Usage: bro-config [--version] [--prefix] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--bropath] [--bro_dist]"
|
||||
|
||||
if [ $# -eq 0 ] ; then
|
||||
echo "${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
|
||||
--version)
|
||||
echo $version
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
;;
|
||||
--script_dir)
|
||||
echo $script_dir
|
||||
;;
|
||||
--site_dir)
|
||||
echo $site_dir
|
||||
;;
|
||||
--plugin_dir)
|
||||
echo $plugin_dir
|
||||
;;
|
||||
--config_dir)
|
||||
echo $config_dir
|
||||
;;
|
||||
--python_dir)
|
||||
echo $python_dir
|
||||
;;
|
||||
--bropath)
|
||||
echo $bropath
|
||||
;;
|
||||
--bro_dist)
|
||||
echo $bro_dist
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -1,2 +1,3 @@
|
|||
#define BRO_SCRIPT_INSTALL_PATH "@BRO_SCRIPT_INSTALL_PATH@"
|
||||
#define BRO_PLUGIN_INSTALL_PATH "@BRO_PLUGIN_INSTALL_PATH@"
|
||||
#define DEFAULT_BROPATH "@DEFAULT_BROPATH@"
|
||||
|
|
|
@ -949,11 +949,9 @@ const std::string& bro_path()
|
|||
if ( bro_path_value.empty() )
|
||||
{
|
||||
const char* path = getenv("BROPATH");
|
||||
|
||||
if ( ! path )
|
||||
path = ".:"
|
||||
BRO_SCRIPT_INSTALL_PATH ":"
|
||||
BRO_SCRIPT_INSTALL_PATH "/policy" ":"
|
||||
BRO_SCRIPT_INSTALL_PATH "/site";
|
||||
path = DEFAULT_BROPATH;
|
||||
|
||||
bro_path_value = path;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue