Skip to content
Snippets Groups Projects
Commit eaedbeea authored by Markus Blatt's avatar Markus Blatt
Browse files

[Buildsystem] Fixes quoting with spaces inside dune-control (Part I)

With this patch dunecontrol will work even if the path to the module
contains spaces. Unfortunately, the tests for dune modules will still
not work as I could not figure out how to use quoting in the CPP_FLAGS.
parent d4014751
No related branches found
No related tags found
No related merge requests found
...@@ -27,13 +27,13 @@ rm -f dune-all.m4 ...@@ -27,13 +27,13 @@ rm -f dune-all.m4
rm -f $name.m4 rm -f $name.m4
# add current dir to PATH # add current dir to PATH
PATH=`dirname $0`:$PATH PATH=`dirname "$0"`:$PATH
# guess libtool prefix # guess libtool prefix
if test -n "$LIBTOOLIZE"; then if test -n "$LIBTOOLIZE"; then
LIBTOOL_prefix=`dirname \`dirname $LIBTOOLIZE\`` LIBTOOL_prefix=`dirname "\`dirname "$LIBTOOLIZE"\`"`
PATH=$LIBTOOL_prefix:$PATH PATH=$LIBTOOL_prefix:$PATH
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $LIBTOOL_prefix/share/aclocal" ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I \"$LIBTOOL_prefix/share/aclocal\""
fi fi
for OPT in "$@"; do for OPT in "$@"; do
...@@ -61,7 +61,7 @@ for OPT in "$@"; do ...@@ -61,7 +61,7 @@ for OPT in "$@"; do
-h|--help) usage ; exit 0 ;; -h|--help) usage ; exit 0 ;;
*) *)
if test -d "$OPT/m4"; then if test -d "$OPT/m4"; then
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $OPT/m4" ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I \"$OPT/m4\""
fi fi
if test -f "$OPT/dune-common.pc.in" ; then if test -f "$OPT/dune-common.pc.in" ; then
# if test \( -d "$OPT/am" \) -a ! \( -h "$OPT/am" \) ; then # if test \( -d "$OPT/am" \) -a ! \( -h "$OPT/am" \) ; then
...@@ -121,14 +121,14 @@ dunecontrol --only=$name m4create ...@@ -121,14 +121,14 @@ dunecontrol --only=$name m4create
echo "--> aclocal..." echo "--> aclocal..."
rm -f aclocal.m4 rm -f aclocal.m4
rm -rf autom4te.cache rm -rf autom4te.cache
aclocal$AMVERSION -I . $ACLOCAL_FLAGS eval aclocal$AMVERSION "-I . $ACLOCAL_FLAGS"
# create a link to the dune-common am directory # create a link to the dune-common am directory
if [ "$name" != "dune-common" ]; then if [ "$name" != "dune-common" ]; then
if [ -n "$am_dir" ] && [ -d $am_dir ]; then if [ -n "$am_dir" ] && [ -d "$am_dir" ]; then
echo "--> linking dune-common/am..." echo "--> linking dune-common/am..."
rm -f am rm -f am
ln -s $am_dir am ln -s "$am_dir" am
else else
echo echo
echo "Error: Could not find dune-common/am!" echo "Error: Could not find dune-common/am!"
......
...@@ -58,7 +58,7 @@ canonicalpath(){ ...@@ -58,7 +58,7 @@ canonicalpath(){
echo Usage: canonicalpath path >&2 echo Usage: canonicalpath path >&2
return 1 return 1
fi fi
dirname `canonicalname "$1"` dirname "`canonicalname "$1"`"
} }
checkdebug () { checkdebug () {
...@@ -78,7 +78,7 @@ if test "x$DEBUG" = "xyes"; then ...@@ -78,7 +78,7 @@ if test "x$DEBUG" = "xyes"; then
set -v set -v
fi fi
export PREFIX_DIR="`canonicalpath $0`/.." export PREFIX_DIR="`canonicalpath "$0"`/.."
# create PKG_CONFIG_PATH for installed dune modules # create PKG_CONFIG_PATH for installed dune modules
if test -d "$PREFIX_DIR/lib/pkgconfig"; then if test -d "$PREFIX_DIR/lib/pkgconfig"; then
...@@ -91,7 +91,7 @@ fi ...@@ -91,7 +91,7 @@ fi
############################################### ###############################################
onbuildfailure() { onbuildfailure() {
echo "Terminating $(basename $0) due to previous errors!" >&2 echo "Terminating $(basename "$0") due to previous errors!" >&2
exit 1 exit 1
} }
...@@ -136,14 +136,14 @@ build_module() { ...@@ -136,14 +136,14 @@ build_module() {
local runcommand=run_$command local runcommand=run_$command
# build the modules # build the modules
local path=$(eval "echo \$PATH_${module}") local path="$(eval "echo \$PATH_${module}")"
eval echo "--- calling $command for \$NAME_${module} ---" eval echo "--- calling $command for \$NAME_${module} ---"
trap onbuildfailure EXIT trap onbuildfailure EXIT
if ! ( if ! (
set -e set -e
cd "$path" cd "$path"
export module export module
eval_control $runcommand $path/$CONTROL eval_control $runcommand "$path/$CONTROL"
); then eval echo "--- Failed to build \$NAME_${module} ---"; exit 1; fi ); then eval echo "--- Failed to build \$NAME_${module} ---"; exit 1; fi
trap onfailure EXIT trap onfailure EXIT
...@@ -537,15 +537,15 @@ run_default_autogen () { ...@@ -537,15 +537,15 @@ run_default_autogen () {
( test -d .svn || test -d .git || test -d CVS || test -f stamp-vc ); then ( test -d .svn || test -d .git || test -d CVS || test -f stamp-vc ); then
sort_modules $FOUND_MODULES sort_modules $FOUND_MODULES
for m in $FOUND_MODULES; do for m in $FOUND_MODULES; do
path=$(eval "echo \$PATH_$m") path="$(eval "echo \$PATH_$m")"
MODULE_PATHS="$MODULE_PATHS$path " MODULE_PATHS="$MODULE_PATHS\"$path\" "
done done
if test -f autogen.sh; then if test -f autogen.sh; then
eval echo "WARNING: \$NAME_$module contains obsolete autogen.sh," \ eval echo "WARNING: \$NAME_$module contains obsolete autogen.sh," \
>&2 >&2
echo " dune-autogen is used instead." >&2 echo " dune-autogen is used instead." >&2
fi fi
eval "$PREFIX_DIR/bin/dune-autogen" "$MODULE_PATHS" "$PARAMS" || exit 1 eval "\"$PREFIX_DIR/bin/dune-autogen\"" "$MODULE_PATHS" "$PARAMS" || exit 1
else else
echo Skipping dune-autogen echo Skipping dune-autogen
fi fi
...@@ -571,7 +571,7 @@ run_default_configure () { ...@@ -571,7 +571,7 @@ run_default_configure () {
# get dependencies & suggestions # get dependencies & suggestions
sort_modules $module sort_modules $module
for m in $MODULES; do for m in $MODULES; do
path=$(eval "echo \$PATH_$m") path="$(eval "echo \$PATH_$m")"
if test "x$LOCAL_USE_CMAKE" = "xyes"; then if test "x$LOCAL_USE_CMAKE" = "xyes"; then
# #
# Translate the configure PARMS to cmake # Translate the configure PARMS to cmake
...@@ -686,13 +686,13 @@ run_default_git () { ...@@ -686,13 +686,13 @@ run_default_git () {
### ###
onfailure() { onfailure() {
echo "Execution of $(basename $0) terminated due to errors!" >&2 echo "Execution of $(basename "$0") terminated due to errors!" >&2
exit 1 exit 1
} }
usage () { usage () {
( (
echo "Usage: $(basename $0) [OPTIONS] COMMANDS [COMMAND-OPTIONS]" echo "Usage: $(basename "$0") [OPTIONS] COMMANDS [COMMAND-OPTIONS]"
echo "" echo ""
echo " Execute COMMANDS for all Dune modules found. All entries in the" echo " Execute COMMANDS for all Dune modules found. All entries in the"
echo " DUNE_CONTROL_PATH variable are scanned recursively for Dune modules." echo " DUNE_CONTROL_PATH variable are scanned recursively for Dune modules."
...@@ -747,7 +747,7 @@ create_module_list() { ...@@ -747,7 +747,7 @@ create_module_list() {
fi fi
export MODULES= export MODULES=
RESUME="`cat $RESUME_FILE`" RESUME="`cat "$RESUME_FILE"`"
for a in $RESUME ; do for a in $RESUME ; do
export NAME_`fix_variable_name $a`="$a" export NAME_`fix_variable_name $a`="$a"
fix_and_assign MODULE "$a" fix_and_assign MODULE "$a"
...@@ -940,7 +940,7 @@ case "$command" in ...@@ -940,7 +940,7 @@ case "$command" in
create_module_list create_module_list
DUNE_CONTROL_PATH="" DUNE_CONTROL_PATH=""
for mod in $MODULES; do for mod in $MODULES; do
path=$(eval echo \$PATH_$mod) path="$(eval echo \$PATH_$mod)"
name=$(eval echo \$NAME_$mod) name=$(eval echo \$NAME_$mod)
if test -f "$path/dune.module"; then if test -f "$path/dune.module"; then
export DUNE_CONTROL_PATH="$DUNE_CONTROL_PATH:$path/dune.module" export DUNE_CONTROL_PATH="$DUNE_CONTROL_PATH:$path/dune.module"
...@@ -982,7 +982,7 @@ case "$command" in ...@@ -982,7 +982,7 @@ case "$command" in
exit 1 exit 1
fi fi
mainmod=`echo $SEARCH_MODULES` mainmod=`echo $SEARCH_MODULES`
eval mainmodpath=\$PATH_$mainmod eval mainmodpath="\$PATH_$mainmod"
fname="$mainmodpath/dependencies.m4" fname="$mainmodpath/dependencies.m4"
name=`eval echo \\${NAME_$mainmod}` name=`eval echo \\${NAME_$mainmod}`
version=`eval echo \\${VERS_$mainmod}` version=`eval echo \\${VERS_$mainmod}`
...@@ -1044,7 +1044,7 @@ case "$command" in ...@@ -1044,7 +1044,7 @@ case "$command" in
echo " suggests $suggestsall" echo " suggests $suggestsall"
AC_MACRO_DIR="." AC_MACRO_DIR="."
test ! -d m4 || AC_MACRO_DIR=m4 test ! -d m4 || AC_MACRO_DIR=m4
cat > $fname <<EOF cat > "$fname" <<EOF
# dependencies.m4 generated by dunecontrol # dependencies.m4 generated by dunecontrol
m4_define([DUNE_AC_INIT],[ m4_define([DUNE_AC_INIT],[
...@@ -1067,7 +1067,7 @@ EOF ...@@ -1067,7 +1067,7 @@ EOF
mod=$(fix_variable_name $name) mod=$(fix_variable_name $name)
MOD=`echo $mod | tr [:lower:] [:upper:]` MOD=`echo $mod | tr [:lower:] [:upper:]`
if test "x$(eval echo \$HAVE_$mod)" = "x"; then if test "x$(eval echo \$HAVE_$mod)" = "x"; then
cat >> $fname <<EOF cat >> "$fname" <<EOF
### add a conditional check for $name, ### add a conditional check for $name,
# just in case the module is not available at autogen time # just in case the module is not available at autogen time
AM_CONDITIONAL([HAVE_${MOD}], false) AM_CONDITIONAL([HAVE_${MOD}], false)
...@@ -1080,7 +1080,7 @@ EOF ...@@ -1080,7 +1080,7 @@ EOF
for mod in $SORTEDMODULES_DEPS; do for mod in $SORTEDMODULES_DEPS; do
name=`eval echo \\$NAME_$mod` name=`eval echo \\$NAME_$mod`
MOD=`echo $mod | tr [:lower:] [:upper:]` MOD=`echo $mod | tr [:lower:] [:upper:]`
cat >> $fname <<EOF cat >> "$fname" <<EOF
### check dependency $name ### check dependency $name
# invoke checks required by this module # invoke checks required by this module
AC_REQUIRE([${MOD}_CHECKS]) AC_REQUIRE([${MOD}_CHECKS])
...@@ -1095,7 +1095,7 @@ EOF ...@@ -1095,7 +1095,7 @@ EOF
for mod in $SORTEDMODULES_SUGS; do for mod in $SORTEDMODULES_SUGS; do
name=`eval echo \\$NAME_$mod` name=`eval echo \\$NAME_$mod`
MOD=`echo $mod | tr [:lower:] [:upper:]` MOD=`echo $mod | tr [:lower:] [:upper:]`
cat >> $fname <<EOF cat >> "$fname" <<EOF
### check suggestion $name ### check suggestion $name
# invoke checks required by this module # invoke checks required by this module
AC_REQUIRE([${MOD}_CHECKS]) AC_REQUIRE([${MOD}_CHECKS])
...@@ -1112,12 +1112,12 @@ EOF ...@@ -1112,12 +1112,12 @@ EOF
mod=$mainmod mod=$mainmod
name=`eval echo \\$NAME_$mod` name=`eval echo \\$NAME_$mod`
MOD=`echo $mod | tr [:lower:] [:upper:]` MOD=`echo $mod | tr [:lower:] [:upper:]`
cat >> $fname <<EOF cat >> "$fname" <<EOF
### invoke checks for $name ### invoke checks for $name
AC_REQUIRE([${MOD}_CHECKS]) AC_REQUIRE([${MOD}_CHECKS])
EOF EOF
fi fi
cat >> $fname <<EOF cat >> "$fname" <<EOF
]) ])
EOF EOF
;; ;;
...@@ -1152,7 +1152,7 @@ EOF ...@@ -1152,7 +1152,7 @@ EOF
if test -n "$RESUME_FILE"; then if test -n "$RESUME_FILE"; then
# remove the current module from the resume file # remove the current module from the resume file
modules_togo=`cat $RESUME_FILE` modules_togo=`cat "$RESUME_FILE"`
for mod_togo in $modules_togo ; do for mod_togo in $modules_togo ; do
if test "$mod_togo" != "$mod" ; then if test "$mod_togo" != "$mod" ; then
echo "$mod_togo" echo "$mod_togo"
......
...@@ -10,9 +10,9 @@ DOXYDIR="doc/doxygen/" ...@@ -10,9 +10,9 @@ DOXYDIR="doc/doxygen/"
find_doxystyle() find_doxystyle()
{ {
for i in `dirname $0`/../doc/doxygen/Doxystyle `dirname $0`/../share/dune-common/doc/doxygen/Doxystyle; do for i in "`dirname "$0"`/../doc/doxygen/Doxystyle" "`dirname "$0"`/../share/dune-common/doc/doxygen/Doxystyle"; do
if [ -f "$i" ]; then if [ -f "$i" ]; then
export DOXYSTYLE=$i export DOXYSTYLE="$i"
return 0 return 0
fi fi
done done
...@@ -92,7 +92,7 @@ generate_doxyout() ...@@ -92,7 +92,7 @@ generate_doxyout()
{ {
echo "Generating $DOXYOUT from " echo "Generating $DOXYOUT from "
echo " global style" echo " global style"
cat $DOXYSTYLE > $DOXYOUT cat "$DOXYSTYLE" > "$DOXYOUT"
while [ -n "$1" ]; do while [ -n "$1" ]; do
for DOXY in Doxylocal Doxyfile.in Doxyfile; do for DOXY in Doxylocal Doxyfile.in Doxyfile; do
if [ "$1/$DOXYDIR/$DOXY" -ef "$DOXYOUT" ]; then continue; fi if [ "$1/$DOXYDIR/$DOXY" -ef "$DOXYOUT" ]; then continue; fi
......
...@@ -46,7 +46,7 @@ BLANK="$space$tab" ...@@ -46,7 +46,7 @@ BLANK="$space$tab"
PARSER_TRIM="awk '{gsub(/^[ \\t]+|[ \\t]+$/,\"\");printf(\"%s\", \$0);}'" PARSER_TRIM="awk '{gsub(/^[ \\t]+|[ \\t]+$/,\"\");printf(\"%s\", \$0);}'"
parse_control() { parse_control() {
# check file existence # check file existence
if test ! -f "$1" -o "$(basename $1)" != "$CONTROL"; then if test ! -f "$1" -o "$(basename "$1")" != "$CONTROL"; then
echo "ERROR: '$1' is no $CONTROL file" >&2 echo "ERROR: '$1' is no $CONTROL file" >&2
exit 1 exit 1
fi fi
...@@ -164,7 +164,7 @@ parse_control() { ...@@ -164,7 +164,7 @@ parse_control() {
# try to setup the control path # try to setup the control path
# #
setup_control_path() { setup_control_path() {
if test -z $DUNE_CONTROL_PATH; then if test -z "$DUNE_CONTROL_PATH"; then
DUNE_CONTROL_PATH=. DUNE_CONTROL_PATH=.
# try pkg-config locations # try pkg-config locations
if ! pkg-config dune-common; then if ! pkg-config dune-common; then
...@@ -189,7 +189,7 @@ setup_control_path() { ...@@ -189,7 +189,7 @@ setup_control_path() {
local TMP="" local TMP=""
# foreach dir in $@ # foreach dir in $@
while read dir; do while read dir; do
TMP=$TMP:"$(canonicalname $dir)" TMP=$TMP:"$(canonicalname "$dir")"
done <<EOF done <<EOF
$(echo $DUNE_CONTROL_PATH | sed -e 's/:\+/:/g' | tr ':' '\n') $(echo $DUNE_CONTROL_PATH | sed -e 's/:\+/:/g' | tr ':' '\n')
EOF EOF
......
...@@ -356,7 +356,7 @@ AC_DEFUN([DUNE_CHECK_MODULES],[ ...@@ -356,7 +356,7 @@ AC_DEFUN([DUNE_CHECK_MODULES],[
# #
AS_IF([test -d "$with_[]_dune_module"],[ AS_IF([test -d "$with_[]_dune_module"],[
# expand tilde / other stuff # expand tilde / other stuff
_DUNE_MODULE[]_ROOT=`cd $with_[]_dune_module && pwd` _DUNE_MODULE[]_ROOT=`cd "$with_[]_dune_module" && pwd`
_DUNE_MODULE[]_LIBDIR="$_DUNE_MODULE[]_ROOT/lib" _DUNE_MODULE[]_LIBDIR="$_DUNE_MODULE[]_ROOT/lib"
# expand search path (otherwise empty CPPFLAGS) # expand search path (otherwise empty CPPFLAGS)
...@@ -370,14 +370,14 @@ AC_DEFUN([DUNE_CHECK_MODULES],[ ...@@ -370,14 +370,14 @@ AC_DEFUN([DUNE_CHECK_MODULES],[
_DUNE_MODULE[]_SRCDIR=$_DUNE_MODULE[]_ROOT _DUNE_MODULE[]_SRCDIR=$_DUNE_MODULE[]_ROOT
echo "testing $_DUNE_MODULE[]_ROOT/CMakeCache.txt" echo "testing $_DUNE_MODULE[]_ROOT/CMakeCache.txt"
# extract src and build path from Makefile or CMakeCache.txt, if found # extract src and build path from Makefile or CMakeCache.txt, if found
AS_IF([test -f $_DUNE_MODULE[]_ROOT/CMakeCache.txt],[ AS_IF([test -f "$_DUNE_MODULE[]_ROOT/CMakeCache.txt"],[
_DUNE_MODULE[]_SRCDIR="`sed -ne '/^[]_dune_name[]_SOURCE_DIR:STATIC=/{s/^[]_dune_name[]_SOURCE_DIR:STATIC=//; p;}' $_DUNE_MODULE[]_ROOT/CMakeCache.txt`" _DUNE_MODULE[]_SRCDIR="`sed -ne '/^[]_dune_name[]_SOURCE_DIR:STATIC=/{s/^[]_dune_name[]_SOURCE_DIR:STATIC=//; p;}' "$_DUNE_MODULE[]_ROOT/CMakeCache.txt"`"
echo srcdir=$_DUNE_MODULE[]_SRCDIR echo srcdir=$_DUNE_MODULE[]_SRCDIR
],[test -f $_DUNE_MODULE[]_ROOT/Makefile],[ ],[test -f "$_DUNE_MODULE[]_ROOT/Makefile"],[
_DUNE_MODULE[]_SRCDIR="`sed -ne '/^abs_top_srcdir = /{s/^abs_top_srcdir = //; p;}' $_DUNE_MODULE[]_ROOT/Makefile`" _DUNE_MODULE[]_SRCDIR="`sed -ne '/^abs_top_srcdir = /{s/^abs_top_srcdir = //; p;}' "$_DUNE_MODULE[]_ROOT/Makefile"`"
]) ])
_dune_cm_CPPFLAGS="-I$_DUNE_MODULE[]_SRCDIR" _dune_cm_CPPFLAGS="-I$_DUNE_MODULE[]_SRCDIR"
_DUNE_MODULE[]_VERSION="`grep Version $_DUNE_MODULE[]_SRCDIR/dune.module | sed -e 's/^Version: *//'`" 2>/dev/null _DUNE_MODULE[]_VERSION="`grep Version "$_DUNE_MODULE[]_SRCDIR/dune.module" | sed -e 's/^Version: *//'`" 2>/dev/null
AS_IF([test -f "$_DUNE_MODULE[]_LIBDIR[]/lib[]_dune_lib[].la"], [ AS_IF([test -f "$_DUNE_MODULE[]_LIBDIR[]/lib[]_dune_lib[].la"], [
# local modules is linked directly via the .la file # local modules is linked directly via the .la file
_dune_cm_LIBS="$_DUNE_MODULE[]_LIBDIR[]/lib[]_dune_lib[].la"],[ _dune_cm_LIBS="$_DUNE_MODULE[]_LIBDIR[]/lib[]_dune_lib[].la"],[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment