From abd92115f422a8e33ed6d8fddb74f7086b4972f6 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 2 Mar 2011 14:14:07 -0600 Subject: [PATCH] Add alternative way to set BROPATH for running bro from build/ dir. Adds two extra shell scripts, one to handle either the c-shell or bourne-shell syntax for setting environment variables, that can be sourced in order to set the BROPATH directly in the current shell/environment in a way that's compatible with running bro from the build/ directory. --- CMakeLists.txt | 4 ++++ INSTALL | 13 ++++++++++--- bro-path-dev.in | 3 ++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e048305c8d..3c3cd05d96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,10 @@ endif () get_filename_component(POLICYDIR ${POLICYDIR} ABSOLUTE) configure_file(bro-path-dev.in ${CMAKE_CURRENT_BINARY_DIR}/bro-path-dev) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bro-path-dev.sh + "export BROPATH=`${CMAKE_CURRENT_BINARY_DIR}/bro-path-dev`\n") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bro-path-dev.csh + "setenv BROPATH `${CMAKE_CURRENT_BINARY_DIR}/bro-path-dev`\n") file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION LIMIT_COUNT 1) diff --git a/INSTALL b/INSTALL index 7692d27966..1220d720ad 100644 --- a/INSTALL +++ b/INSTALL @@ -92,6 +92,13 @@ with it. In the following we give a few simple examples. See the quickstart guide at http://www.bro-ids.org for more information; you can the source that in doc/quick-start. -For developers that wish to run Bro after performing "make", but -without performing "make install", see build/bro-path-dev for -an example. +For developers that wish to run Bro from the the build/ directory +after performing "make", but without performing "make install", they +will have to first set BROPATH to look for scripts inside the build +directory. Sourcing either build/bro-path-dev.sh or build/bro-path-dev.csh +as appropriate for the current shell accomplishes this. e.g.: + + > ./configure + > make + > source build/bro-path-dev.sh + > ./build/src/bro diff --git a/bro-path-dev.in b/bro-path-dev.in index aad1b72dbd..394462924d 100755 --- a/bro-path-dev.in +++ b/bro-path-dev.in @@ -1,3 +1,4 @@ +#!/bin/sh # After configured by CMake, this file prints the absolute path to policy # files that come with the source distributions of Bro and Broctl as well # as policy files that are generated by the BIF compiler at compile time @@ -6,7 +7,7 @@ # the build directory, avoiding the need to install it. This could be # done like: # -# BROPATH=`source bro-path-dev` ./src/bro +# BROPATH=`./bro-path-dev` ./src/bro # broPolicies=${PROJECT_SOURCE_DIR}/policy:${PROJECT_SOURCE_DIR}/policy/sigs:${PROJECT_SOURCE_DIR}/policy/time-machine