mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Added configure script to wrap cmake functionality
This commit is contained in:
parent
c1e0b41275
commit
02e17e949b
4 changed files with 276 additions and 101 deletions
238
configure
vendored
Executable file
238
configure
vendored
Executable file
|
@ -0,0 +1,238 @@
|
|||
#!/bin/sh
|
||||
# Convenience wrapper for easily viewing/setting options that
|
||||
# the project's CMake scripts will recognize
|
||||
|
||||
# check for `cmake` command
|
||||
type -P cmake &>/dev/null || {
|
||||
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=PATH policy file installation directory
|
||||
[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
|
||||
|
||||
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=$prefix/share/bro
|
||||
debug=false
|
||||
release=false
|
||||
use_IPv6=false
|
||||
enable_perftools=false
|
||||
build_binpac=false
|
||||
skip_binpac_install=true
|
||||
|
||||
# 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=*)
|
||||
if [ "$datadir" == "${prefix}/share/bro" ]; then
|
||||
# User has not explicitly set datadir, so re-root
|
||||
# it to the chosen prefix
|
||||
datadir=$optarg/share/bro
|
||||
fi
|
||||
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
|
||||
;;
|
||||
--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 directory 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 downloaded into the 'binpac'
|
||||
# subdirectory if necessary and then built
|
||||
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)
|
||||
|
||||
#######################################################################
|
||||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue