From 2ffaa1cdb17515266b2d69add9bbb4f202be06fd Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Fri, 13 Jul 2018 17:23:08 -0500 Subject: [PATCH] Support building plugins from Bro installation root As opposed to plugins depending on a Bro source/build tree. This required installing various Bro headers, BinPAC and it's headers, bifcl, and Bro's custom CMake modules. --- CMakeLists.txt | 5 ++++- aux/bro-aux | 2 +- bro-config.in | 10 +++++++++- cmake | 2 +- src/CMakeLists.txt | 20 ++++++++++++++++++++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 370bf78c92..dd47aaaf9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -235,12 +235,15 @@ endif () configure_file(${CMAKE_CURRENT_SOURCE_DIR}/bro-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/bro-config.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bro-config.h DESTINATION include/bro) 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}) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake DESTINATION share/bro + USE_SOURCE_PERMISSIONS) ######################################################################## ## Recurse on sub-directories diff --git a/aux/bro-aux b/aux/bro-aux index eeb677ff69..2fb15af398 160000 --- a/aux/bro-aux +++ b/aux/bro-aux @@ -1 +1 @@ -Subproject commit eeb677ff696f8ea3eaa43a765fe40da07ed5281d +Subproject commit 2fb15af398f899ea5f8999f332a832a31e3def73 diff --git a/bro-config.in b/bro-config.in index 0c426fd17b..bd02d80bb2 100755 --- a/bro-config.in +++ b/bro-config.in @@ -7,11 +7,13 @@ 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@ +cmake_dir=@CMAKE_INSTALL_PREFIX@/share/bro/cmake +include_dir=@CMAKE_INSTALL_PREFIX@/include/bro 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]" +Usage: bro-config [--version] [--prefix] [--script_dir] [--site_dir] [--plugin_dir] [--config_dir] [--python_dir] [--include_dir] [--cmake_dir] [--bropath] [--bro_dist]" if [ $# -eq 0 ] ; then echo "${usage}" 1>&2 @@ -46,6 +48,12 @@ while [ $# -ne 0 ]; do --python_dir) echo $python_dir ;; + --cmake_dir) + echo $cmake_dir + ;; + --include_dir) + echo $include_dir + ;; --bropath) echo $bropath ;; diff --git a/cmake b/cmake index a416553abc..aebe1173f7 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit a416553abcb7aa650e934cd3800bcab0cbcf3e63 +Subproject commit aebe1173f74c505e04dd7959bb087a59a0e85fac diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff0cfc019e..363860a65e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -400,3 +400,23 @@ install(CODE " ${BRO_SCRIPT_INSTALL_PATH}/policy/tuning/logs-to-elasticsearch.bro ) ") + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION include/bro + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.pac" + PATTERN "3rdparty/*" EXCLUDE +) + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ + DESTINATION include/bro + FILES_MATCHING + PATTERN "*.bif.func_h" + PATTERN "*.bif.netvar_h" + PATTERN "*.bif.h" +) + +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/sqlite3.h + DESTINATION include/bro/3rdparty +)