mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Added logic to find installed BinPAC or build from source.
This commit is contained in:
parent
f176cb905a
commit
79596c03d5
4 changed files with 94 additions and 16 deletions
|
@ -53,9 +53,18 @@ set(ENABLE_PERFTOOLS false
|
||||||
# Uncomment to specify a custom prefix that contains the libpcap installation.
|
# Uncomment to specify a custom prefix that contains the libpcap installation.
|
||||||
#set(PCAP_ROOT_DIR path/to/your/pcap)
|
#set(PCAP_ROOT_DIR path/to/your/pcap)
|
||||||
|
|
||||||
|
# Uncomment to specify a custom prefix containing the BinPAC installation.
|
||||||
|
#set(BinPAC_ROOT_DIR path/to/your/binpac)
|
||||||
|
|
||||||
|
# Uncomment to prefer building BinPAC from existing sources rather than
|
||||||
|
# use an existing installation (i.e. you have initialized Bro's BinPAC
|
||||||
|
# git submodule and updated sources local to the Bro source tree)
|
||||||
|
#set(BinPAC_PREFER_LOCAL_BUILD true)
|
||||||
|
|
||||||
|
# Comment this if local build of BinPAC should be scheduled for installation
|
||||||
|
set(BinPAC_SKIP_INSTALL true)
|
||||||
|
|
||||||
# TODO: more dependencies:
|
# TODO: more dependencies:
|
||||||
# BinPAC
|
|
||||||
#
|
|
||||||
# Libmagic
|
# Libmagic
|
||||||
# LibGeoIP
|
# LibGeoIP
|
||||||
# Libz
|
# Libz
|
||||||
|
|
|
@ -72,6 +72,25 @@ include_directories(BEFORE
|
||||||
${OPENSSL_INCLUDE_DIR}
|
${OPENSSL_INCLUDE_DIR}
|
||||||
${BIND_INCLUDE_DIR})
|
${BIND_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# This test is for when the user would like to use rebuild BinPAC
|
||||||
|
# rather than use an existing installation
|
||||||
|
if (NOT BinPAC_PREFER_LOCAL_BUILD)
|
||||||
|
find_package(BinPAC)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (NOT BINPAC_FOUND)
|
||||||
|
# check if we can build BinPAC locally
|
||||||
|
if (EXISTS ${CMAKE_SOURCE_DIR}/binpac/CMakeLists.txt)
|
||||||
|
add_subdirectory(binpac)
|
||||||
|
# find_package called just to set the _FOUND variable
|
||||||
|
find_package(BinPAC)
|
||||||
|
message(STATUS "Building local version of BinPAC")
|
||||||
|
else ()
|
||||||
|
message(FATAL_ERROR "BinPAC required but it is not installed and"
|
||||||
|
" the sources to build it are also not found.")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
# TODO: optional libmagic
|
# TODO: optional libmagic
|
||||||
# TODO: optional libGeoIP
|
# TODO: optional libGeoIP
|
||||||
# TODO: optional libz
|
# TODO: optional libz
|
||||||
|
@ -106,7 +125,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
## Recurse on sub-directories
|
## Recurse on sub-directories
|
||||||
##
|
##
|
||||||
|
|
||||||
add_subdirectory(binpac)
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
#add_subdirectory(aux)
|
#add_subdirectory(aux)
|
||||||
#add_subdirectory(scripts)
|
#add_subdirectory(scripts)
|
||||||
|
@ -134,7 +152,7 @@ message(
|
||||||
"\nlibz: ${use_libz}"
|
"\nlibz: ${use_libz}"
|
||||||
"\nlibmagic: ${use_libmagic}"
|
"\nlibmagic: ${use_libmagic}"
|
||||||
"\nEndace: ${use_endace}"
|
"\nEndace: ${use_endace}"
|
||||||
"\nGoogle perftools: ${summary_perftools}"
|
"\nGoogle perftools: ${use_perftools}"
|
||||||
"\n"
|
"\n"
|
||||||
"\n================================================================\n"
|
"\n================================================================\n"
|
||||||
)
|
)
|
||||||
|
|
52
cmake/FindBinPAC.cmake
Normal file
52
cmake/FindBinPAC.cmake
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
# - Try to find BinPAC binary and library
|
||||||
|
#
|
||||||
|
# Usage of this module as follows:
|
||||||
|
#
|
||||||
|
# find_package(BinPAC)
|
||||||
|
#
|
||||||
|
# Variables used by this module, they can change the default behaviour and need
|
||||||
|
# to be set before calling find_package:
|
||||||
|
#
|
||||||
|
# BinPAC_ROOT_DIR Set this variable to the root installation of
|
||||||
|
# BinPAC if the module has problems finding the
|
||||||
|
# proper installation path.
|
||||||
|
#
|
||||||
|
# Variables defined by this module:
|
||||||
|
#
|
||||||
|
# BINPAC_FOUND System has BinPAC binary and library
|
||||||
|
# BinPAC_EXE The binpac executable
|
||||||
|
# BinPAC_LIBRARY The libbinpac.a library
|
||||||
|
# BinPAC_INCLUDE_DIR The binpac headers
|
||||||
|
|
||||||
|
find_path(BinPAC_ROOT_DIR
|
||||||
|
NAMES include/binpac.h
|
||||||
|
)
|
||||||
|
|
||||||
|
find_file(BinPAC_EXE
|
||||||
|
NAMES binpac
|
||||||
|
HINTS ${BinPAC_ROOT_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(BinPAC DEFAULT_MSG
|
||||||
|
BinPAC_EXE
|
||||||
|
BinPAC_LIBRARY
|
||||||
|
BinPAC_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
BinPAC_ROOT_DIR
|
||||||
|
BinPAC_EXE
|
||||||
|
BinPAC_LIBRARY
|
||||||
|
BinPAC_INCLUDE_DIR
|
||||||
|
)
|
|
@ -1,7 +1,6 @@
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_SOURCE_DIR}/binpac/lib
|
${BinPAC_INCLUDE_DIR}
|
||||||
${CMAKE_BINARY_DIR}/binpac/lib
|
|
||||||
)
|
)
|
||||||
|
|
||||||
macro(REPLACE_YY_PREFIX_TARGET inFile outFile yylexPrefix yyPrefix)
|
macro(REPLACE_YY_PREFIX_TARGET inFile outFile yylexPrefix yyPrefix)
|
||||||
|
@ -64,7 +63,7 @@ flex_target(Scanner scan.l ${CMAKE_CURRENT_BINARY_DIR}/scan.cc
|
||||||
|
|
||||||
configure_file(version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
|
configure_file(version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
|
||||||
|
|
||||||
########### next target ###############
|
########### bifcl target###############
|
||||||
|
|
||||||
set(bifcl_SRCS
|
set(bifcl_SRCS
|
||||||
${BISON_BIFParser_OUTPUTS}
|
${BISON_BIFParser_OUTPUTS}
|
||||||
|
@ -118,7 +117,7 @@ set(BIF_SRCS
|
||||||
|
|
||||||
foreach (bift ${BIF_SRCS})
|
foreach (bift ${BIF_SRCS})
|
||||||
bif_target(${bift})
|
bif_target(${bift})
|
||||||
endforeach(bift)
|
endforeach ()
|
||||||
|
|
||||||
|
|
||||||
########## targets that need binpac ##########
|
########## targets that need binpac ##########
|
||||||
|
@ -127,11 +126,11 @@ macro(BINPAC_TARGET pacFile)
|
||||||
get_filename_component(basename ${pacFile} NAME_WE)
|
get_filename_component(basename ${pacFile} NAME_WE)
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.h
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.h
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.cc
|
${CMAKE_CURRENT_BINARY_DIR}/${basename}_pac.cc
|
||||||
COMMAND binpac
|
COMMAND ${BinPAC_EXE}
|
||||||
ARGS -d ${CMAKE_CURRENT_BINARY_DIR}
|
ARGS -d ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${pacFile}
|
${pacFile}
|
||||||
DEPENDS binpac ${pacFile}
|
DEPENDS ${BinPAC_EXE} ${pacFile}
|
||||||
COMMENT "[BINPAC] Processing ${pacFile}"
|
COMMENT "[BINPAC] Processing ${pacFile}"
|
||||||
)
|
)
|
||||||
list(APPEND ALL_BINPAC_OUTPUTS
|
list(APPEND ALL_BINPAC_OUTPUTS
|
||||||
|
@ -180,9 +179,9 @@ set(BINPAC_RPC_AUXSRC
|
||||||
|
|
||||||
foreach (binpact ${BINPAC_SRCS})
|
foreach (binpact ${BINPAC_SRCS})
|
||||||
binpac_target(${CMAKE_CURRENT_SOURCE_DIR}/${binpact})
|
binpac_target(${CMAKE_CURRENT_SOURCE_DIR}/${binpact})
|
||||||
endforeach(binpact)
|
endforeach ()
|
||||||
|
|
||||||
########### next target ###############
|
########### bro target ###############
|
||||||
|
|
||||||
set(dns_SRCS nb_dns.c nb_dns.h)
|
set(dns_SRCS nb_dns.c nb_dns.h)
|
||||||
|
|
||||||
|
@ -366,7 +365,7 @@ add_executable(bro ${bro_SRCS})
|
||||||
|
|
||||||
target_link_libraries(bro
|
target_link_libraries(bro
|
||||||
m
|
m
|
||||||
binpac_lib
|
${BinPAC_LIBRARY}
|
||||||
${PCAP_LIBRARY}
|
${PCAP_LIBRARY}
|
||||||
${OPENSSL_LIBRARIES}
|
${OPENSSL_LIBRARIES}
|
||||||
${BIND_LIBRARY}
|
${BIND_LIBRARY}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue