Allow building auxilliary projects along with Bro.

BinPAC, Broccoli, Broctl, and Bro auxilliary tools are included
as git submodules.
This commit is contained in:
Jon Siwek 2010-11-13 20:20:40 -06:00
parent 0221c121fc
commit 7737572aab
11 changed files with 93 additions and 75 deletions

18
.gitmodules vendored
View file

@ -1,6 +1,12 @@
[submodule "aux"] [submodule "aux/bro-aux"]
path = aux path = aux/bro-aux
url = ssh://bro@git.icir.org/bro-aux url = git://git.icir.org/bro-aux
[submodule "binpac"] [submodule "aux/binpac"]
path = binpac path = aux/binpac
url = ssh://bro@git.icir.org/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

View file

@ -17,6 +17,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
project(Bro) project(Bro)
set(BRO_ROOT_DIR ${CMAKE_INSTALL_PREFIX})
file(STRINGS "${CMAKE_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1) file(STRINGS "${CMAKE_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1)
if (ENABLE_DEBUG AND ENABLE_RELEASE) if (ENABLE_DEBUG AND ENABLE_RELEASE)
@ -57,6 +59,10 @@ find_package(BISON REQUIRED)
find_package(PCAP REQUIRED) find_package(PCAP REQUIRED)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
find_package(BIND REQUIRED) find_package(BIND REQUIRED)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/aux/binpac/CMakeLists.txt)
add_subdirectory(aux/binpac)
endif ()
find_package(BinPAC REQUIRED) find_package(BinPAC REQUIRED)
include_directories(BEFORE include_directories(BEFORE
@ -130,8 +136,34 @@ add_subdirectory(policy)
#add_subdirectory(scripts) #add_subdirectory(scripts)
#add_subdirectory(doc) #add_subdirectory(doc)
if (INSTALL_AUXTOOLS) if (INSTALL_BROCCOLI)
add_subdirectory(aux) 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 () endif ()
######################################################################## ########################################################################
@ -198,8 +230,8 @@ message(
"\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}" "\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}"
"\nCPP: ${CMAKE_CXX_COMPILER}" "\nCPP: ${CMAKE_CXX_COMPILER}"
"\n" "\n"
"\nBroccoli: ${use_broccoli}" "\nBroccoli: ${INSTALL_BROCCOLI}"
"\nBroctl: ${use_broctl}" "\nBroctl: ${INSTALL_BROCTL}"
"\nGeoIP: ${USE_GEOIP}" "\nGeoIP: ${USE_GEOIP}"
"\nlibz: ${HAVE_LIBZ}" "\nlibz: ${HAVE_LIBZ}"
"\nlibmagic: ${HAVE_LIBMAGIC}" "\nlibmagic: ${HAVE_LIBMAGIC}"

1
aux

@ -1 +0,0 @@
Subproject commit 3aff865343ae3f152f6c9dc20a8015830e1b9412

1
aux/binpac Submodule

@ -0,0 +1 @@
Subproject commit 7ebfe11ce241560bc7450ebb71eb077cf1d80783

1
aux/bro-aux Submodule

@ -0,0 +1 @@
Subproject commit 34049cd5d9b150fa72c35772931f2fc9d754ee08

1
aux/broccoli Submodule

@ -0,0 +1 @@
Subproject commit bdec0ca0911e4f40afd747dfc95e47609428f6f4

1
aux/broctl Submodule

@ -0,0 +1 @@
Subproject commit 406d02505eb19400359a08c83b321a9ae1d4ad8c

1
binpac

@ -1 +0,0 @@
Subproject commit 37f8d8b16be30b5011db2e74cc7d07b6e857d2ca

View file

@ -10,10 +10,6 @@
# BinPAC_ROOT_DIR Set this variable to the root installation of # BinPAC_ROOT_DIR Set this variable to the root installation of
# BinPAC if the module has problems finding the # BinPAC if the module has problems finding the
# proper installation path. # 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: # Variables defined by this module:
# #
@ -22,21 +18,6 @@
# BinPAC_LIBRARY The libbinpac.a library # BinPAC_LIBRARY The libbinpac.a library
# BinPAC_INCLUDE_DIR The binpac headers # 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 # look for BinPAC in standard locations or user-provided root
find_path(BinPAC_ROOT_DIR find_path(BinPAC_ROOT_DIR
NAMES include/binpac.h NAMES include/binpac.h
@ -56,7 +37,6 @@ else ()
NAMES binpac.h NAMES binpac.h
HINTS ${BinPAC_ROOT_DIR}/include HINTS ${BinPAC_ROOT_DIR}/include
) )
endif ()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BinPAC DEFAULT_MSG find_package_handle_standard_args(BinPAC DEFAULT_MSG

47
configure vendored
View file

@ -27,12 +27,11 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--enable-release compile with optimizations --enable-release compile with optimizations
--enable-brov6 enable IPv6 processing --enable-brov6 enable IPv6 processing
--enable-perftools use Google's perftools --enable-perftools use Google's perftools
--build-binpac build BinPAC from source located in --enable-broccoli build/install the Broccoli library
'binpac' subdirectory --enable-broctl install Broctl configured in standalone mode
--install-binpac if --build-binpac, this option adds --enable-cluster install Broctl configured for cluster operation
BinPAC build files to the install target --enable-auxtools build and install auxilliary tools located
--install-auxtools build and install auxilliary tools located in 'aux/bro-aux' subdirectory
in 'aux' subdirectory
Required Packages in Non-Standard Locations: Required Packages in Non-Standard Locations:
--with-openssl=PATH path to OpenSSL install root --with-openssl=PATH path to OpenSSL install root
@ -71,16 +70,15 @@ append_cache_entry () {
builddir=build builddir=build
CMakeCacheEntries="" CMakeCacheEntries=""
append_cache_entry CMAKE_INSTALL_PREFIX PATH /usr/local/bro 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 DATADIR STRING share/bro
append_cache_entry ENABLE_DEBUG BOOL false append_cache_entry ENABLE_DEBUG BOOL false
append_cache_entry ENABLE_RELEASE BOOL false append_cache_entry ENABLE_RELEASE BOOL false
append_cache_entry BROv6 BOOL false append_cache_entry BROv6 BOOL false
append_cache_entry ENABLE_PERFTOOLS 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 BinPAC_SKIP_INSTALL BOOL true
append_cache_entry INSTALL_AUX_TOOLS BOOL false append_cache_entry BUILD_SHARED_LIBS BOOL true
# parse arguments # parse arguments
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
@ -99,6 +97,8 @@ while [ $# -ne 0 ]; do
;; ;;
--prefix=*) --prefix=*)
append_cache_entry CMAKE_INSTALL_PREFIX PATH $optarg 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=*) --datadir=*)
append_cache_entry DATADIR STRING $optarg append_cache_entry DATADIR STRING $optarg
@ -115,24 +115,19 @@ while [ $# -ne 0 ]; do
--enable-perftools) --enable-perftools)
append_cache_entry ENABLE_PERFTOOLS BOOL true append_cache_entry ENABLE_PERFTOOLS BOOL true
;; ;;
--build-binpac) --enable-broccoli)
if [ -f $sourcedir/binpac/CMakeLists.txt ]; then append_cache_entry INSTALL_BROCCOLI BOOL true
append_cache_entry BinPAC_PREFER_BUILD BOOL true
else
echo "Error: BinPAC source not found in $sourcedir/binpac" >&2
exit 1
fi
;; ;;
--install-binpac) --enable-broctl)
append_cache_entry BinPAC_SKIP_INSTALL BOOL false append_cache_entry INSTALL_BROCTL BOOL true
append_cache_entry STANDALONE BOOL true
;; ;;
--install-auxtools) --enable-cluster)
if [ -f $sourcedir/aux/CMakeLists.txt ]; then append_cache_entry INSTALL_BROCTL BOOL true
append_cache_entry INSTALL_AUX_TOOLS BOOL false append_cache_entry STANDALONE BOOL false
else ;;
echo "Error: Bro-Aux source not found in $sourcedir/aux" >&2 --enable-auxtools)
exit 1 append_cache_entry INSTALL_AUX_TOOLS BOOL true
fi
;; ;;
--with-openssl=*) --with-openssl=*)
append_cache_entry OpenSSL_ROOT_DIR PATH $optarg append_cache_entry OpenSSL_ROOT_DIR PATH $optarg

View file

@ -394,3 +394,6 @@ target_link_libraries(bro ${brolibs})
install(TARGETS bro DESTINATION bin) install(TARGETS bro DESTINATION bin)
install(FILES ${INSTALL_BIF_OUTPUTS} DESTINATION ${DATADIR}) install(FILES ${INSTALL_BIF_OUTPUTS} DESTINATION ${DATADIR})
set(BRO_EXE bro
CACHE STRING "Bro executable binary" FORCE)