From 7b07a19cd6a0267ce889b22646ce013848fa8528 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 10 Aug 2011 17:16:26 -0500 Subject: [PATCH] bro scripts generated from bifs now install to $prefix/share/bro/base/ Addresses #545 --- scripts/base/frameworks/logging/main.bro | 2 +- scripts/base/init-bare.bro | 12 ++++++------ src/CMakeLists.txt | 9 ++++++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/base/frameworks/logging/main.bro b/scripts/base/frameworks/logging/main.bro index e31f931de9..be575247ec 100644 --- a/scripts/base/frameworks/logging/main.bro +++ b/scripts/base/frameworks/logging/main.bro @@ -149,7 +149,7 @@ export { # We keep a script-level copy of all filters so that we can manipulate them. global filters: table[ID, string] of Filter; -@load logging.bif.bro # Needs Filter and Stream defined. +@load base/logging.bif # Needs Filter and Stream defined. module Log; diff --git a/scripts/base/init-bare.bro b/scripts/base/init-bare.bro index 30674fafc7..42580e95e7 100644 --- a/scripts/base/init-bare.bro +++ b/scripts/base/init-bare.bro @@ -1,5 +1,5 @@ -@load const.bif.bro -@load types.bif.bro +@load base/const.bif +@load base/types.bif # Type declarations type string_array: table[count] of string; @@ -298,9 +298,9 @@ type entropy_test_result: record { }; # Prototypes of Bro built-in functions. -@load strings.bif.bro -@load bro.bif.bro -@load reporter.bif.bro +@load base/strings.bif +@load base/bro.bif +@load base/reporter.bif global log_file_name: function(tag: string): string &redef; global open_log_file: function(tag: string): file &redef; @@ -1264,7 +1264,7 @@ type bittorrent_benc_dir: table[string] of bittorrent_benc_value; # The header table type used by the bittorrenttracker analyzer. type bt_tracker_headers: table[string] of string; -@load event.bif.bro +@load base/event.bif # The filter the user has set via the -f command line options, or # empty if none. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a5f096f70..db6a139e58 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -107,6 +107,12 @@ macro(BIF_TARGET bifInput) add_custom_command(OUTPUT ${bifOutputs} COMMAND bifcl ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${bifInput} || (rm -f ${bifOutputs} && exit 1) + # in order be able to run bro from the build directory, + # a copy of the generated bro script needs to be copied + # to a directory tree named the same way it will be + # referenced from an @load + COMMAND "${CMAKE_COMMAND}" + ARGS -E copy ${bifInput}.bro base/${bifInput}.bro DEPENDS ${bifInput} DEPENDS bifcl COMMENT "[BIFCL] Processing ${bifInput}" @@ -121,6 +127,7 @@ endmacro(BIF_TARGET) macro(GET_BIF_OUTPUT_FILES inputFile outputFileVar) set(${outputFileVar} ${inputFile}.bro + base/${inputFile}.bro ${inputFile}.func_def ${inputFile}.func_h ${inputFile}.func_init @@ -423,7 +430,7 @@ set(brolibs target_link_libraries(bro ${brolibs}) install(TARGETS bro DESTINATION bin) -install(FILES ${INSTALL_BIF_OUTPUTS} DESTINATION ${POLICYDIR}) +install(FILES ${INSTALL_BIF_OUTPUTS} DESTINATION ${POLICYDIR}/base) set(BRO_EXE bro CACHE STRING "Bro executable binary" FORCE)