Skip to content

Commit

Permalink
Prefer cmake3 in Zeek plugin configure skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiwek committed Oct 29, 2019
1 parent 8fa6c98 commit bcb9775
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGES
@@ -1,4 +1,8 @@

0.43-11 | 2019-10-28 22:22:26 -0700

* Prefer cmake3 in Zeek plugin configure skeleton (Jon Siwek, Corelight)

0.43-10 | 2019-10-28 18:05:09 -0700

* Move CMake project() after cmake_minimum_required() (Jon Siwek, Corelight)
Expand Down
2 changes: 1 addition & 1 deletion README
@@ -1,7 +1,7 @@
.. -*- mode: rst; -*-
..
.. Version number is filled in automatically.
.. |version| replace:: 0.43-10
.. |version| replace:: 0.43-11

=======================
Zeek Auxiliary Programs
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.43-10
0.43-11
30 changes: 20 additions & 10 deletions plugin-support/skeleton/configure
Expand Up @@ -14,21 +14,13 @@ if [ -e `dirname $0`/configure.plugin ]; then
. `dirname $0`/configure.plugin
fi

# 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() {

cat 1>&2 <<EOF
Usage: $0 [OPTIONS]
Plugin Options:
--cmake=PATH Path to CMake binary
--zeek-dist=DIR Path to Zeek source tree
--install-root=DIR Path where to install plugin into
--with-binpac=DIR Path to BinPAC installation root
Expand Down Expand Up @@ -73,6 +65,10 @@ while [ $# -ne 0 ]; do
usage
;;

--cmake=*)
CMakeCommand=$optarg
;;

--zeek-dist=*)
zeekdist=`cd $optarg && pwd`
;;
Expand Down Expand Up @@ -120,6 +116,20 @@ while [ $# -ne 0 ]; do
shift
done

if [ -z "$CMakeCommand" ]; then
# prefer cmake3 over "regular" cmake (cmake == cmake2 on RHEL)
if command -v cmake3 >/dev/null 2>&1 ; then
CMakeCommand="cmake3"
elif command -v cmake >/dev/null 2>&1 ; then
CMakeCommand="cmake"
else
echo "This package requires CMake, please install it first."
echo "Then you may use this script to configure the CMake build."
echo "Note: pass --cmake=PATH to use cmake in non-standard locations."
exit 1;
fi
fi

if [ -z "$zeekdist" ]; then
if type zeek-config >/dev/null 2>&1; then
zeek_config="zeek-config"
Expand Down Expand Up @@ -194,7 +204,7 @@ echo "Zeek Source Directory : $zeekdist"
mkdir -p $builddir
cd $builddir

cmake $CMakeCacheEntries ..
"$CMakeCommand" $CMakeCacheEntries ..

echo "# This is the command used to configure this build" > config.status
echo $command >> config.status
Expand Down

0 comments on commit bcb9775

Please sign in to comment.