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

[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.
parent 234ba118
No related branches found
No related tags found
No related merge requests found
...@@ -150,7 +150,7 @@ build_module() { ...@@ -150,7 +150,7 @@ build_module() {
load_opts() { load_opts() {
local command=$1 local command=$1
local COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]') local COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]')
CMD_FLAGS="$(eval echo \$${COMMAND}_FLAGS)" CMD_FLAGS=$(eval echo \$${COMMAND}_FLAGS)
local CMD_FLAGS_FROM_FILE="" local CMD_FLAGS_FROM_FILE=""
if test "$command" = "NONE"; then if test "$command" = "NONE"; then
BUILDDIR=$DUNE_BUILDDIR BUILDDIR=$DUNE_BUILDDIR
...@@ -210,6 +210,7 @@ load_opts() { ...@@ -210,6 +210,7 @@ load_opts() {
space=" " space=" "
tab=" " tab=" "
BLANK="$space$tab" BLANK="$space$tab"
NOBLANK="^$space^$tab"
if test -z $GREP; then if test -z $GREP; then
GREP=grep GREP=grep
...@@ -225,11 +226,11 @@ extract_multiarch(){ ...@@ -225,11 +226,11 @@ extract_multiarch(){
fi fi
if test "x$USE_CMAKE" = "xyes"; then if test "x$USE_CMAKE" = "xyes"; then
load_opts "cmake" 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 fi
if test "x$my_cxx_compiler" == "x"; then if test "x$my_cxx_compiler" == "x"; then
load_opts "configure" 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 fi
if test "x$my_cxx_compiler" == "x"; then if test "x$my_cxx_compiler" == "x"; then
set +e set +e
...@@ -434,7 +435,7 @@ run_default_vcsetup() { ...@@ -434,7 +435,7 @@ run_default_vcsetup() {
if [ -d .git -o -f .git ] ; then if [ -d .git -o -f .git ] ; then
# Read Whitespace-Hook setting from dune.module file # 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 if [ "x$SETUPGITHOOK" = "xyes" ]; then
# we have to install the Git whitespace hook # we have to install the Git whitespace hook
...@@ -665,7 +666,7 @@ run_default_configure () { ...@@ -665,7 +666,7 @@ run_default_configure () {
# such that they are honored by cmake. # such that they are honored by cmake.
flags="CXX CC CXXFLAGS CFLAGS CPPFLAGS LDFLAGS F77 FFLAGS FLIBS FC FCFLAGS FCLIBS LIBS" flags="CXX CC CXXFLAGS CFLAGS CPPFLAGS LDFLAGS F77 FFLAGS FLIBS FC FCFLAGS FCLIBS LIBS"
for i in $flags; do 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 if test -n "$cflags" ; then
PREPARAMS="$PREPARAMS $cflags" PREPARAMS="$PREPARAMS $cflags"
fi fi
......
...@@ -649,6 +649,11 @@ endif(NOT @DUNE_MOD_NAME@_FOUND)") ...@@ -649,6 +649,11 @@ endif(NOT @DUNE_MOD_NAME@_FOUND)")
set(DUNE_INSTALL_LIBDIR ${DUNE_INSTALL_NONOBJECTLIBDIR}) set(DUNE_INSTALL_LIBDIR ${DUNE_INSTALL_NONOBJECTLIBDIR})
endif(DUNE_MODULE_LIBRARIES) 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} configure_package_config_file(${CONFIG_SOURCE_FILE}
${PROJECT_BINARY_DIR}/cmake/pkg/${DUNE_MOD_NAME}-config.cmake ${PROJECT_BINARY_DIR}/cmake/pkg/${DUNE_MOD_NAME}-config.cmake
INSTALL_DESTINATION ${DUNE_INSTALL_LIBDIR}/cmake/${DUNE_MOD_NAME} INSTALL_DESTINATION ${DUNE_INSTALL_LIBDIR}/cmake/${DUNE_MOD_NAME}
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
### to CMake options for dune-common ### to CMake options for dune-common
### ###
########################################## ##########################################
space=" "
tab=" "
BLANK="$space$tab"
NOBLANK="^$space^$tab"
dune_common_options_am2cmake() dune_common_options_am2cmake()
{ {
...@@ -39,14 +42,14 @@ dune_common_options_am2cmake() ...@@ -39,14 +42,14 @@ dune_common_options_am2cmake()
fi fi
# Check for --with-minimal-debug-level # Check for --with-minimal-debug-level
local arg=`echo "$PARAMS"| sed "s/.*--with-minimal-debug-level=\(\S*\).*/\1/"` local arg=`echo "$PARAMS"| grep \\\\--with-minimal-debug-level= | sed "s/.*--with-minimal-debug-level=\([$NOBLANK]*\).*/\1/"`
if test "x$arg" != "x$PARAMS"; then if test "x$arg" != "x"; then
CMAKE_PARAMS="$CMAKE_PARAMS -DMINIMAL_DEBUG_LEVEL:String=$arg" CMAKE_PARAMS="$CMAKE_PARAMS -DMINIMAL_DEBUG_LEVEL:String=$arg"
fi fi
#Check for --prefix #Check for --prefix
local arg=`echo "$PARAMS"| sed "s/.*--prefix=\(\S*\).*/\1/"` local arg=`echo "$PARAMS"| grep \\\\--prefix= | sed "s/.*--prefix=\([$NOBLANK]*\).*/\1/"`
if test "x$arg" != "x$PARAMS"; then if test "x$arg" != "x"; then
CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_INSTALL_PREFIX=$arg" CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_INSTALL_PREFIX=$arg"
fi fi
} }
...@@ -36,6 +36,7 @@ vtab=" " ...@@ -36,6 +36,7 @@ vtab=" "
# embedded newline. Instead one can often get away with using $BLANK # embedded newline. Instead one can often get away with using $BLANK
SPACE="$space$formfeed$newline$cr$tab$vtab" SPACE="$space$formfeed$newline$cr$tab$vtab"
BLANK="$space$tab" BLANK="$space$tab"
NOBLANK="^$space^$tab"
# #
# read paramters from a $CONTROL file # read paramters from a $CONTROL file
...@@ -66,10 +67,10 @@ parse_control() { ...@@ -66,10 +67,10 @@ parse_control() {
exit 1 exit 1
fi fi
# read dune.module file # read dune.module file
local deps="$($GREP "^[$BLANK]*Depends:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" local deps="$($GREP "[$NOBLANK]*Depends:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)"
local sugs="$($GREP "^[$BLANK]*Suggests:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" local sugs="$($GREP "[$NOBLANK]*Suggests:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)"
local vers="$($GREP "^[$BLANK]*Version:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)" local vers="$($GREP "[$NOBLANK]*Version:" "$1" | cut -d ':' -f2 | eval $PARSER_TRIM)"
local main="$($GREP "^[$BLANK]*Maintainer:" "$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. # check whether the module is installed.
# - installed modules can be found via pkg-config # - installed modules can be found via pkg-config
# - pkg-config --var=prefix should be the same as $path # - pkg-config --var=prefix should be the same as $path
...@@ -600,7 +601,7 @@ default_am2cmake_options(){ ...@@ -600,7 +601,7 @@ default_am2cmake_options(){
continue continue
fi fi
# process --with-$lowercase=<arg> # 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 local arg=`eval echo $arg` # expand tilde to prevent problems
if test "x$arg" = "xno"; then if test "x$arg" = "xno"; then
CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_DISABLE_FIND_PACKAGE_$package=TRUE" CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_DISABLE_FIND_PACKAGE_$package=TRUE"
...@@ -629,9 +630,9 @@ default_am2cmake_libraries(){ ...@@ -629,9 +630,9 @@ default_am2cmake_libraries(){
continue continue
fi fi
export "$lowercase"-lib_processed=1 export "$lowercase"-lib_processed=1
term="s/.*--with-""$lowercase""-lib=\(\S*\).*/\1/" term="s/.*--with-""$lowercase""-lib=\([$NOBLANK]*\).*/\1/"
arg=`echo "$PARAMS" | sed "$term"` arg=`echo "$PARAMS" | grep \\-\\-with-$lowercase | sed "$term"`
if test "x$arg" != "x" && test "x$PARAMS" != "x$arg"; then if test "x$arg" != "x"; then
CMAKE_PARAMS="$CMAKE_PARAMS -D$uppercase""_LIBRARY=$arg" CMAKE_PARAMS="$CMAKE_PARAMS -D$uppercase""_LIBRARY=$arg"
fi fi
done done
......
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