zeek/auxil/spicy/tests/Scripts/build-directory
Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

25 lines
601 B
Bash
Executable File

#! /bin/sh
#
# Infers the build directory and returns it.
if [ -n "${SPICY_BUILD_DIRECTORY}" ]; then
echo ${SPICY_BUILD_DIRECTORY}
exit 0
fi
base=$(cd $(dirname $0) && pwd)
for i in "${base}/../../build"; do
if [ -d ${i} -a -e ${i}/CMakeCache.txt ]; then
cd ${i}
pwd
exit 0
fi
done
# Fail silently if we got an installation directory. We are
# probably running from with the alternative's settings and
# can ignore the initial error.
test -n "${SPICY_INSTALLATION_DIRECTORY}" || echo "cannot determine build directory, set SPICY_BUILD_DIRECTORY" >&2
exit 1