diff --git a/.gitmodules b/.gitmodules index a09b575f2a..e2dcd2b8a4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,12 @@ -[submodule "aux"] - path = aux - url = ssh://bro@git.icir.org/bro-aux -[submodule "binpac"] - path = binpac - url = ssh://bro@git.icir.org/binpac +[submodule "aux/bro-aux"] + path = aux/bro-aux + url = git://git.icir.org/bro-aux +[submodule "aux/binpac"] + path = aux/binpac + url = git://git.icir.org/binpac +[submodule "aux/broccoli"] + path = aux/broccoli + url = git://git.icir.org/broccoli +[submodule "aux/broctl"] + path = aux/broctl + url = git://git.icir.org/broctl diff --git a/CMakeLists.txt b/CMakeLists.txt index ae06e308b1..891e29355f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) project(Bro) +set(BRO_ROOT_DIR ${CMAKE_INSTALL_PREFIX}) + file(STRINGS "${CMAKE_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1) if (ENABLE_DEBUG AND ENABLE_RELEASE) @@ -57,6 +59,10 @@ find_package(BISON REQUIRED) find_package(PCAP REQUIRED) find_package(OpenSSL REQUIRED) find_package(BIND REQUIRED) + +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/aux/binpac/CMakeLists.txt) + add_subdirectory(aux/binpac) +endif () find_package(BinPAC REQUIRED) include_directories(BEFORE @@ -130,8 +136,34 @@ add_subdirectory(policy) #add_subdirectory(scripts) #add_subdirectory(doc) -if (INSTALL_AUXTOOLS) - add_subdirectory(aux) +if (INSTALL_BROCCOLI) + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/aux/broccoli/CMakeLists.txt) + add_subdirectory(aux/broccoli) + else () + message(FATAL_ERROR "Broccoli selected for installation, " + "but the source code does not exist in " + "${CMAKE_CURRENT_SOURCE_DIR}/aux/broccoli") + endif () +endif () + +if (INSTALL_BROCTL) + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/aux/broctl/CMakeLists.txt) + add_subdirectory(aux/broctl) + else () + message(FATAL_ERROR "Broctl selected for installation, " + "but the source code does not exist in " + "${CMAKE_CURRENT_SOURCE_DIR}/aux/broctl") + endif () +endif () + +if (INSTALL_AUX_TOOLS) + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/aux/bro-aux/CMakeLists.txt) + add_subdirectory(aux/bro-aux) + else () + message(FATAL_ERROR "Bro auxilliary tools selected for installation, " + "but the source code does not exist in " + "${CMAKE_CURRENT_SOURCE_DIR}/aux/bro-aux") + endif () endif () ######################################################################## @@ -198,8 +230,8 @@ message( "\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}" "\nCPP: ${CMAKE_CXX_COMPILER}" "\n" - "\nBroccoli: ${use_broccoli}" - "\nBroctl: ${use_broctl}" + "\nBroccoli: ${INSTALL_BROCCOLI}" + "\nBroctl: ${INSTALL_BROCTL}" "\nGeoIP: ${USE_GEOIP}" "\nlibz: ${HAVE_LIBZ}" "\nlibmagic: ${HAVE_LIBMAGIC}" diff --git a/aux b/aux deleted file mode 160000 index 3aff865343..0000000000 --- a/aux +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3aff865343ae3f152f6c9dc20a8015830e1b9412 diff --git a/aux/binpac b/aux/binpac new file mode 160000 index 0000000000..7ebfe11ce2 --- /dev/null +++ b/aux/binpac @@ -0,0 +1 @@ +Subproject commit 7ebfe11ce241560bc7450ebb71eb077cf1d80783 diff --git a/aux/bro-aux b/aux/bro-aux new file mode 160000 index 0000000000..34049cd5d9 --- /dev/null +++ b/aux/bro-aux @@ -0,0 +1 @@ +Subproject commit 34049cd5d9b150fa72c35772931f2fc9d754ee08 diff --git a/aux/broccoli b/aux/broccoli new file mode 160000 index 0000000000..bdec0ca091 --- /dev/null +++ b/aux/broccoli @@ -0,0 +1 @@ +Subproject commit bdec0ca0911e4f40afd747dfc95e47609428f6f4 diff --git a/aux/broctl b/aux/broctl new file mode 160000 index 0000000000..406d02505e --- /dev/null +++ b/aux/broctl @@ -0,0 +1 @@ +Subproject commit 406d02505eb19400359a08c83b321a9ae1d4ad8c diff --git a/binpac b/binpac deleted file mode 160000 index 37f8d8b16b..0000000000 --- a/binpac +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 37f8d8b16be30b5011db2e74cc7d07b6e857d2ca diff --git a/cmake/FindBinPAC.cmake b/cmake/FindBinPAC.cmake index 927252c543..5cd1697bb3 100644 --- a/cmake/FindBinPAC.cmake +++ b/cmake/FindBinPAC.cmake @@ -10,10 +10,6 @@ # BinPAC_ROOT_DIR Set this variable to the root installation of # BinPAC if the module has problems finding the # proper installation path. -# BinPAC_PREFER_BUILD Set this to true if BinPAC should be built -# from sources located in the root source -# directory in subidrectory 'binpac'. The -# module will not look for BinPAC elsewhere. # # Variables defined by this module: # @@ -22,41 +18,25 @@ # BinPAC_LIBRARY The libbinpac.a library # BinPAC_INCLUDE_DIR The binpac headers -if (BinPAC_PREFER_BUILD) - # check if we can build BinPAC locally - if (EXISTS ${CMAKE_SOURCE_DIR}/binpac/CMakeLists.txt) - if (NOT BinPAC_EXE) - # Display only first time - message(STATUS "Building local version of BinPAC") - endif () - # BinPAC's CMake project must declare: - # BinPAC_EXE, BinPAC_LIBRARY, BinPAC_INCLUDE_DIR - add_subdirectory(${CMAKE_SOURCE_DIR}/binpac) - else () - message(WARNING "Option to build BinPAC from source selected, " - "but no sources found in ${CMAKE_SOURCE_DIR}/binpac") - endif () -else () - # look for BinPAC in standard locations or user-provided root - find_path(BinPAC_ROOT_DIR - NAMES include/binpac.h - ) +# look for BinPAC in standard locations or user-provided root +find_path(BinPAC_ROOT_DIR + NAMES include/binpac.h +) - find_file(BinPAC_EXE - NAMES binpac - HINTS ${BinPAC_ROOT_DIR}/bin - ) +find_file(BinPAC_EXE + NAMES binpac + HINTS ${BinPAC_ROOT_DIR}/bin +) - find_library(BinPAC_LIBRARY - NAMES libbinpac.a - HINTS ${BinPAC_ROOT_DIR}/lib - ) +find_library(BinPAC_LIBRARY + NAMES libbinpac.a + HINTS ${BinPAC_ROOT_DIR}/lib +) - find_path(BinPAC_INCLUDE_DIR - NAMES binpac.h - HINTS ${BinPAC_ROOT_DIR}/include - ) -endif () +find_path(BinPAC_INCLUDE_DIR + NAMES binpac.h + HINTS ${BinPAC_ROOT_DIR}/include +) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(BinPAC DEFAULT_MSG diff --git a/configure b/configure index c9f63c6e38..81b8887604 100755 --- a/configure +++ b/configure @@ -27,12 +27,11 @@ Usage: $0 [OPTION]... [VAR=VALUE]... --enable-release compile with optimizations --enable-brov6 enable IPv6 processing --enable-perftools use Google's perftools - --build-binpac build BinPAC from source located in - 'binpac' subdirectory - --install-binpac if --build-binpac, this option adds - BinPAC build files to the install target - --install-auxtools build and install auxilliary tools located - in 'aux' subdirectory + --enable-broccoli build/install the Broccoli library + --enable-broctl install Broctl configured in standalone mode + --enable-cluster install Broctl configured for cluster operation + --enable-auxtools build and install auxilliary tools located + in 'aux/bro-aux' subdirectory Required Packages in Non-Standard Locations: --with-openssl=PATH path to OpenSSL install root @@ -71,16 +70,15 @@ append_cache_entry () { builddir=build CMakeCacheEntries="" append_cache_entry CMAKE_INSTALL_PREFIX PATH /usr/local/bro +append_cache_entry BRO_ROOT_DIR PATH /usr/local/bro +append_cache_entry PY_MOD_INSTALL_DIR PATH /usr/local/bro/lib/broctl append_cache_entry DATADIR STRING share/bro append_cache_entry ENABLE_DEBUG BOOL false append_cache_entry ENABLE_RELEASE BOOL false append_cache_entry BROv6 BOOL false append_cache_entry ENABLE_PERFTOOLS BOOL false - -# these settings should be set depending on whether the submodule exists -append_cache_entry BinPAC_PREFER_BUILD BOOL false -append_cache_entry BinPAC_SKIP_INSTALL BOOL true -append_cache_entry INSTALL_AUX_TOOLS BOOL false +append_cache_entry BinPAC_SKIP_INSTALL BOOL true +append_cache_entry BUILD_SHARED_LIBS BOOL true # parse arguments while [ $# -ne 0 ]; do @@ -99,6 +97,8 @@ while [ $# -ne 0 ]; do ;; --prefix=*) append_cache_entry CMAKE_INSTALL_PREFIX PATH $optarg + append_cache_entry BRO_ROOT_DIR PATH $optarg + append_cache_entry PY_MOD_INSTALL_DIR PATH $optarg/lib/broctl ;; --datadir=*) append_cache_entry DATADIR STRING $optarg @@ -115,24 +115,19 @@ while [ $# -ne 0 ]; do --enable-perftools) append_cache_entry ENABLE_PERFTOOLS BOOL true ;; - --build-binpac) - if [ -f $sourcedir/binpac/CMakeLists.txt ]; then - append_cache_entry BinPAC_PREFER_BUILD BOOL true - else - echo "Error: BinPAC source not found in $sourcedir/binpac" >&2 - exit 1 - fi + --enable-broccoli) + append_cache_entry INSTALL_BROCCOLI BOOL true ;; - --install-binpac) - append_cache_entry BinPAC_SKIP_INSTALL BOOL false + --enable-broctl) + append_cache_entry INSTALL_BROCTL BOOL true + append_cache_entry STANDALONE BOOL true ;; - --install-auxtools) - if [ -f $sourcedir/aux/CMakeLists.txt ]; then - append_cache_entry INSTALL_AUX_TOOLS BOOL false - else - echo "Error: Bro-Aux source not found in $sourcedir/aux" >&2 - exit 1 - fi + --enable-cluster) + append_cache_entry INSTALL_BROCTL BOOL true + append_cache_entry STANDALONE BOOL false + ;; + --enable-auxtools) + append_cache_entry INSTALL_AUX_TOOLS BOOL true ;; --with-openssl=*) append_cache_entry OpenSSL_ROOT_DIR PATH $optarg diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23253b57fd..bffff82377 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -394,3 +394,6 @@ target_link_libraries(bro ${brolibs}) install(TARGETS bro DESTINATION bin) install(FILES ${INSTALL_BIF_OUTPUTS} DESTINATION ${DATADIR}) + +set(BRO_EXE bro + CACHE STRING "Bro executable binary" FORCE)