mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

- configure wrapper had bash syntax some places; replaced w/ sh syntax - Added FindOpenSSL module. The one that ships with CMake does not allow for specifying a non-standard location. - datadir configure option changed to be relative to prefix. This simplifies the packaging from having to consider absolute paths. - Added macro for changing install_name of shared libs that need to ship with precompiled Bro for OS X. This is only the optional libmagic and libGeoIP for now.
252 lines
7.5 KiB
Bash
Executable file
252 lines
7.5 KiB
Bash
Executable file
#!/bin/sh
|
|
# Convenience wrapper for easily viewing/setting options that
|
|
# the project's CMake scripts will recognize
|
|
|
|
# check for `cmake` command
|
|
type cmake > /dev/null 2>&1 || {
|
|
echo "\
|
|
This package requires CMake, please install it first, then you may
|
|
use this configure script to access CMake equivalent functionality.\
|
|
" >&2;
|
|
exit 1;
|
|
}
|
|
|
|
usage="\
|
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
|
|
|
Build Directory:
|
|
--builddir=DIR place build files in directory [build]
|
|
|
|
Installation Directories:
|
|
--prefix=PREFIX installation directory [/usr/local/bro]
|
|
--datadir=DIR policy file installation subdirectory
|
|
[PREFIX/share/bro]
|
|
|
|
Optional Features:
|
|
--enable-debug compile with debugging symbols
|
|
--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
|
|
|
|
Required Packages in Non-Standard Locations:
|
|
--with-openssl=PATH path to OpenSSL install root
|
|
--with-bind=PATH path to BIND install root
|
|
--with-pcap=PATH path to libpcap install root
|
|
--with-binpac=PATH path to BinPAC install root
|
|
|
|
Optional Packages in Non-Standard Locations:
|
|
--with-libmagic=PATH path to libmagic install root
|
|
--with-geoip=PATH path to the libGeoIP install root
|
|
--with-perftools=PATH path to Google Perftools install root
|
|
|
|
Influential Environment Variables (only on first invocation
|
|
per build directory):
|
|
CC C compiler command
|
|
CFLAGS C compiler flags
|
|
CXX C++ compiler command
|
|
CXXFLAGS C++ compiler flags
|
|
"
|
|
|
|
sourcedir=`dirname $0`
|
|
if [ "$sourcedir" = "." ]; then
|
|
sourcedir=`pwd`
|
|
fi
|
|
|
|
# set defaults
|
|
builddir=build
|
|
prefix=/usr/local/bro
|
|
datadir=share/bro
|
|
debug=false
|
|
release=false
|
|
use_IPv6=false
|
|
enable_perftools=false
|
|
build_binpac=false
|
|
skip_binpac_install=true
|
|
install_auxtools=false
|
|
|
|
# parse arguments
|
|
while [ $# -ne 0 ]; do
|
|
case "$1" in
|
|
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
|
*) optarg= ;;
|
|
esac
|
|
|
|
case "$1" in
|
|
--help|-h)
|
|
echo "${usage}" 1>&2
|
|
exit 1
|
|
;;
|
|
--builddir=*)
|
|
builddir=$optarg
|
|
;;
|
|
--prefix=*)
|
|
prefix=$optarg
|
|
;;
|
|
--datadir=*)
|
|
datadir=$optarg
|
|
;;
|
|
--enable-debug)
|
|
debug=true
|
|
;;
|
|
--enable-release)
|
|
release=true
|
|
;;
|
|
--enable-brov6)
|
|
use_IPv6=true
|
|
;;
|
|
--enable-perftools)
|
|
enable_perftools=true
|
|
;;
|
|
--build-binpac)
|
|
if [ -f $sourcedir/binpac/CMakeLists.txt ]; then
|
|
build_binpac=true
|
|
else
|
|
echo "Error: BinPAC source not found in $sourcedir/binpac" >&2
|
|
exit 1
|
|
fi
|
|
;;
|
|
--install-binpac)
|
|
skip_binpac_install=false
|
|
;;
|
|
--install-auxtools)
|
|
if [ -f $sourcedir/aux/CMakeLists.txt ]; then
|
|
install_auxtools=true
|
|
else
|
|
echo "Error: Bro-Aux source not found in $sourcedir/aux" >&2
|
|
exit 1
|
|
fi
|
|
;;
|
|
--with-openssl=*)
|
|
openssl_root=$optarg
|
|
;;
|
|
--with-bind=*)
|
|
bind_root=$optarg
|
|
;;
|
|
--with-pcap=*)
|
|
pcap_root=$optarg
|
|
;;
|
|
--with-binpac=*)
|
|
binpac_root=$optarg
|
|
;;
|
|
--with-libmagic=*)
|
|
libmagic_root=$optarg
|
|
;;
|
|
--with-geoip=*)
|
|
geoip_root=$optarg
|
|
;;
|
|
--with-perftools=*)
|
|
perftools_root=$optarg
|
|
;;
|
|
*)
|
|
echo "Invalid option '$1'. Try $0 --help to see available options."
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
# Create build directory
|
|
mkdir -p $builddir
|
|
|
|
# Create a build options file in the build directory w/ selected options
|
|
BuildOptionsFile=$builddir/BuildOptions.cmake
|
|
|
|
cat > $BuildOptionsFile << EOF
|
|
#######################################################################
|
|
#
|
|
# Bro - Build Setup
|
|
#
|
|
#######################################################################
|
|
|
|
#######################################################################
|
|
# Installation Directories
|
|
#######################################################################
|
|
|
|
set(CMAKE_INSTALL_PREFIX $prefix
|
|
CACHE STRING "installation directory" FORCE)
|
|
|
|
set(DATADIR $datadir
|
|
CACHE STRING
|
|
"installation subdirectory (under PREFIX) for Bro policy files"
|
|
FORCE)
|
|
|
|
#######################################################################
|
|
# Optional Features
|
|
#######################################################################
|
|
|
|
set(ENABLE_DEBUG $debug
|
|
CACHE STRING "compile with debugging symbols" FORCE)
|
|
|
|
set(ENABLE_RELEASE $release
|
|
CACHE STRING "use compiler optimizations" FORCE)
|
|
|
|
set(BROv6 $use_IPv6
|
|
CACHE STRING "enable IPv6 processing" FORCE)
|
|
|
|
set(ENABLE_PERFTOOLS $enable_perftools
|
|
CACHE STRING "use Google's perftools" FORCE)
|
|
|
|
# If the following option is set to true, then instead of searching for
|
|
# an installation of BinPac, it will be built from source already
|
|
# available in the 'binpac' subdirectory
|
|
set(BinPAC_PREFER_BUILD $build_binpac
|
|
CACHE STRING "retrieve and build BinPAC dependency from source" FORCE)
|
|
|
|
set(BinPAC_SKIP_INSTALL $skip_binpac_install
|
|
CACHE STRING "don't install BinPAC if built from source" FORCE)
|
|
|
|
# If the following option is set to true, then auxilliary tools will
|
|
# be installed alongside Bro if their source is located in the 'aux'
|
|
# subdirectory
|
|
set(INSTALL_AUXTOOLS $install_auxtools
|
|
CACHE STRING "install Bro auxilliary tools" FORCE)
|
|
|
|
#######################################################################
|
|
# Packages in Non-Standard Locations
|
|
# Uncomment/edit options below in order to aid the CMake
|
|
# configuration scripts in finding dependencies that are installed
|
|
# in atypical locations.
|
|
#######################################################################
|
|
|
|
EOF
|
|
|
|
# Function to set a CMake cache variable that act as a hint for
|
|
# finding packages in non-standard locations.
|
|
# $1 argument is the name of the CMake hint variable
|
|
# $2 argument is path to use as the hint variable's value
|
|
# if empty, then a dummy value is used and the option
|
|
# is commented out of the build options file
|
|
add_search_path_hint () {
|
|
if [ -z "$2" ]; then
|
|
comment="#"
|
|
path=/insert/your/path/here
|
|
else
|
|
comment=""
|
|
path=$2
|
|
fi
|
|
cat >> $BuildOptionsFile << EOF
|
|
${comment}set($1 $path
|
|
${comment} CACHE STRING "Non-Standard install root" FORCE)
|
|
|
|
EOF
|
|
}
|
|
|
|
add_search_path_hint OpenSSL_ROOT_DIR ${openssl_root}
|
|
add_search_path_hint BIND_ROOT_DIR ${bind_root}
|
|
add_search_path_hint PCAP_ROOT_DIR ${pcap_root}
|
|
add_search_path_hint BinPAC_ROOT_DIR ${binpac_root}
|
|
add_search_path_hint LibMagic_ROOT_DIR ${libmagic_root}
|
|
add_search_path_hint LibGeoIP_ROOT_DIR ${geoip_root}
|
|
add_search_path_hint GooglePerftools_ROOT_DIR ${perftools_root}
|
|
|
|
echo "Build Directory : $builddir"
|
|
echo "Build Options : $BuildOptionsFile"
|
|
echo "Source Directory: $sourcedir"
|
|
cd $builddir
|
|
cmake $sourcedir
|