2013-07-30 13:30:45 -05:00
|
|
|
#!/bin/sh
|
2013-08-14 14:41:23 -05:00
|
|
|
# this file is supposed to be located in the source directory
|
|
|
|
src_dir=$(dirname $0)
|
|
|
|
|
|
|
|
# scan the arguments and set this if build macros could be specified
|
|
|
|
mod_dir=
|
|
|
|
for OPT in "$@"; do
|
|
|
|
case "$OPT" in
|
2015-05-15 07:34:17 -05:00
|
|
|
--with-opm-cmake=*)
|
2013-08-14 14:41:23 -05:00
|
|
|
# remove everything before equal sign and assign the rest
|
|
|
|
mod_dir=${OPT#*=}
|
|
|
|
# tilde expansion; note that doing eval may have side effects
|
|
|
|
mod_dir=$(eval echo $mod_dir)
|
|
|
|
# absolute path
|
|
|
|
[ -d "$mod_dir" ] && mod_dir=$(cd $mod_dir ; pwd)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# if it isn't specified, the look around in other known places
|
|
|
|
conf_file=cmake/Scripts/configure
|
|
|
|
if [ -z "$mod_dir" ]; then
|
|
|
|
if [ -r "$src_dir/$conf_file" ]; then
|
|
|
|
mod_dir="$src_dir"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# terminate with error message here if the module directory is not found
|
|
|
|
if [ ! -r "$mod_dir/$conf_file" ]; then
|
2015-05-15 07:34:17 -05:00
|
|
|
echo Build macros not located in \"$mod_dir\", use --with-opm-cmake= to specify! 1>&2
|
2013-08-14 14:41:23 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-07-30 13:30:45 -05:00
|
|
|
# forward to the corresponding script in the cmake/Scripts/ directory
|
2013-08-14 14:41:23 -05:00
|
|
|
exec "$mod_dir/$conf_file" --src-dir="$src_dir" "$@"
|