From 6b110c88d9cd684d9e6db5ffdfe61bf1d152b5b2 Mon Sep 17 00:00:00 2001 From: Markus Blatt <markus@dr-blatt.de> Date: Wed, 8 Jan 2014 18:36:18 +0100 Subject: [PATCH] [bugfix,dunecontrol] Fixes sed statements to capture sequences variables. Some ^[$BLANK] or [^[$BLANK]^'], where $BLANK is space followed by tab did not work as a capturing statement in some cases (e.g. opts files with CONFIGURE_FLAGS="CXX='bla'"). After this patch we use [$NOBLANK] with NOBLANK=^$space^$tab which works. In addition the other patches form feature/posix-sed-dunecontrol have been backported to close flyspray 1401. --- bin/dunecontrol | 11 ++++++----- cmake/modules/DuneMacros.cmake | 5 +++++ lib/dunecommonam2cmake.lib | 13 ++++++++----- lib/dunemodules.lib | 17 +++++++++-------- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/bin/dunecontrol b/bin/dunecontrol index f00b021ab..75c9dd152 100755 --- a/bin/dunecontrol +++ b/bin/dunecontrol @@ -150,7 +150,7 @@ build_module() { load_opts() { local command=$1 local COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]') - CMD_FLAGS="$(eval echo \$${COMMAND}_FLAGS)" + CMD_FLAGS=$(eval echo \$${COMMAND}_FLAGS) local CMD_FLAGS_FROM_FILE="" if test "$command" = "NONE"; then BUILDDIR=$DUNE_BUILDDIR @@ -210,6 +210,7 @@ load_opts() { space=" " tab=" " BLANK="$space$tab" +NOBLANK="^$space^$tab" if test -z $GREP; then GREP=grep @@ -225,11 +226,11 @@ extract_multiarch(){ fi if test "x$USE_CMAKE" = "xyes"; then load_opts "cmake" - my_cxx_compiler=`echo $CMAKE_FLAGS | $GREP CXX | sed "s/.*CXX=[\"']\?\([^[$BLANK]^'^\"]*\)[\"']\?.*/\1/"` + my_cxx_compiler=`echo $CMAKE_FLAGS | $GREP CXX | sed "s/.*CXX=[\"']\?\([$NOBLANK^'^\"]*\)[\"']\?.*/\1/"` fi if test "x$my_cxx_compiler" == "x"; then load_opts "configure" - my_cxx_compiler=`echo $CONFIGURE_FLAGS | $GREP CXX| sed "s/.*CXX=[\"']\?\([^[$BLANK]^'^\"]*\)[\"']\?.*/\1/"` + my_cxx_compiler=`echo $CONFIGURE_FLAGS | $GREP CXX| sed "s/.*CXX=[\"']\?\([$NOBLANK^'^\"]*\)[\"']\?.*/\1/"` fi if test "x$my_cxx_compiler" == "x"; then set +e @@ -434,7 +435,7 @@ run_default_vcsetup() { if [ -d .git -o -f .git ] ; then # Read Whitespace-Hook setting from dune.module file - local SETUPGITHOOK="$($GREP -i "^[$BLANK]*Whitespace-Hook:" dune.module | cut -d ':' -f2 | eval $PARSER_TRIM | tr '[:upper:]' '[:lower:]')" + local SETUPGITHOOK="$($GREP -i "[$NOBLANK]*Whitespace-Hook:" dune.module | cut -d ':' -f2 | eval $PARSER_TRIM | tr '[:upper:]' '[:lower:]')" if [ "x$SETUPGITHOOK" = "xyes" ]; then # we have to install the Git whitespace hook @@ -665,7 +666,7 @@ run_default_configure () { # such that they are honored by cmake. flags="CXX CC CXXFLAGS CFLAGS CPPFLAGS LDFLAGS F77 FFLAGS FLIBS FC FCFLAGS FCLIBS LIBS" for i in $flags; do - cflags=`echo "$PARAMS" | $GREP $i= | sed "s/.*\($i=\"[^\"]*\"\|$i='[^']*'\|$i=[^[$BLANK]^ ]*\).*/\1/"` + cflags=`echo "$PARAMS" | $GREP $i= | sed "s/.*\($i=\"[^\"]\+\"\|$i='[^']\+'\|$i=[$NOBLANK]\+\).*/\1/"` if test -n "$cflags" ; then PREPARAMS="$PREPARAMS $cflags" fi diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index cf4a26ce8..cb86f604f 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -649,6 +649,11 @@ endif(NOT @DUNE_MOD_NAME@_FOUND)") set(DUNE_INSTALL_LIBDIR ${DUNE_INSTALL_NONOBJECTLIBDIR}) endif(DUNE_MODULE_LIBRARIES) +message(" configure_package_config_file(${CONFIG_SOURCE_FILE} + ${PROJECT_BINARY_DIR}/cmake/pkg/${DUNE_MOD_NAME}-config.cmake + INSTALL_DESTINATION ${DUNE_INSTALL_LIBDIR}/cmake/${DUNE_MOD_NAME} + PATH_VARS CMAKE_INSTALL_DATAROOTDIR DUNE_INSTALL_MODULEDIR CMAKE_INSTALL_INCLUDEDIR + DOXYSTYLE_DIR SCRIPT_DIR)") configure_package_config_file(${CONFIG_SOURCE_FILE} ${PROJECT_BINARY_DIR}/cmake/pkg/${DUNE_MOD_NAME}-config.cmake INSTALL_DESTINATION ${DUNE_INSTALL_LIBDIR}/cmake/${DUNE_MOD_NAME} diff --git a/lib/dunecommonam2cmake.lib b/lib/dunecommonam2cmake.lib index 043c0fa83..eeaec25f1 100644 --- a/lib/dunecommonam2cmake.lib +++ b/lib/dunecommonam2cmake.lib @@ -6,7 +6,10 @@ ### to CMake options for dune-common ### ########################################## - +space=" " +tab=" " +BLANK="$space$tab" +NOBLANK="^$space^$tab" dune_common_options_am2cmake() { @@ -39,14 +42,14 @@ dune_common_options_am2cmake() fi # Check for --with-minimal-debug-level - local arg=`echo "$PARAMS"| sed "s/.*--with-minimal-debug-level=\(\S*\).*/\1/"` - if test "x$arg" != "x$PARAMS"; then + local arg=`echo "$PARAMS"| grep \\\\--with-minimal-debug-level= | sed "s/.*--with-minimal-debug-level=\([$NOBLANK]*\).*/\1/"` + if test "x$arg" != "x"; then CMAKE_PARAMS="$CMAKE_PARAMS -DMINIMAL_DEBUG_LEVEL:String=$arg" fi #Check for --prefix - local arg=`echo "$PARAMS"| sed "s/.*--prefix=\(\S*\).*/\1/"` - if test "x$arg" != "x$PARAMS"; then + local arg=`echo "$PARAMS"| grep \\\\--prefix= | sed "s/.*--prefix=\([$NOBLANK]*\).*/\1/"` + if test "x$arg" != "x"; then CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_INSTALL_PREFIX=$arg" fi } diff --git a/lib/dunemodules.lib b/lib/dunemodules.lib index cbf5eabe3..603593abe 100644 --- a/lib/dunemodules.lib +++ b/lib/dunemodules.lib @@ -36,6 +36,7 @@ vtab="" # embedded newline. Instead one can often get away with using $BLANK SPACE="$space$formfeed$newline$cr$tab$vtab" BLANK="$space$tab" +NOBLANK="^$space^$tab" # # read paramters from a $CONTROL file @@ -66,10 +67,10 @@ parse_control() { exit 1 fi # read dune.module file - local deps="$($GREP "^[$BLANK]*Depends:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" - local sugs="$($GREP "^[$BLANK]*Suggests:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" - local vers="$($GREP "^[$BLANK]*Version:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" - local main="$($GREP "^[$BLANK]*Maintainer:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" + local deps="$($GREP "[$NOBLANK]*Depends:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" + local sugs="$($GREP "[$NOBLANK]*Suggests:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" + local vers="$($GREP "[$NOBLANK]*Version:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" + local main="$($GREP "[$NOBLANK]*Maintainer:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" # check whether the module is installed. # - installed modules can be found via pkg-config # - pkg-config --var=prefix should be the same as $path @@ -600,7 +601,7 @@ default_am2cmake_options(){ continue fi # process --with-$lowercase=<arg> - local arg=`echo $PARAMS| sed "s/.*--with-$lowercase=\(\S*\).*/\1/"` + local arg=`echo $PARAMS| sed "s/.*--with-$lowercase=\([$NOBLANK]*\).*/\1/"` local arg=`eval echo $arg` # expand tilde to prevent problems if test "x$arg" = "xno"; then CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_DISABLE_FIND_PACKAGE_$package=TRUE" @@ -629,9 +630,9 @@ default_am2cmake_libraries(){ continue fi export "$lowercase"-lib_processed=1 - term="s/.*--with-""$lowercase""-lib=\(\S*\).*/\1/" - arg=`echo "$PARAMS" | sed "$term"` - if test "x$arg" != "x" && test "x$PARAMS" != "x$arg"; then + term="s/.*--with-""$lowercase""-lib=\([$NOBLANK]*\).*/\1/" + arg=`echo "$PARAMS" | grep \\-\\-with-$lowercase | sed "$term"` + if test "x$arg" != "x"; then CMAKE_PARAMS="$CMAKE_PARAMS -D$uppercase""_LIBRARY=$arg" fi done -- GitLab