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

[dunecontrol,bugfix] Fixes issues with posix sed.

(cherry picked from commit b01c7774)

Signed-off-by: default avatarMarkus Blatt <markus@dr-blatt.de>
parent 1bc58bd8
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ set -e
### check for environment variables
###
if test -z $MAKE; then
if test -z "$MAKE"; then
MAKE=make
fi
......@@ -210,11 +210,14 @@ load_opts() {
space=" "
tab=" "
BLANK="$space$tab"
NOBLANK="^$space^$tab"
NOBLANK="^$space$tab"
if test -z $GREP; then
if test -z "$GREP"; then
GREP=grep
fi
if test -z "$SED"; then
SED=sed
fi
# Uses the current compiler to extract information about the
# multiarch triplets and sets the export variable MULTIARCH_LIBDIR
# according to it.
......@@ -226,11 +229,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=[\"']\?\([$NOBLANK^'^\"]*\)[\"']\?.*/\1/"`
my_cxx_compiler=`echo $CMAKE_FLAGS | $GREP CXX | $SED "s/.*CXX=[\"']\?\([$BLANK'\"]*\)[\"']\?.*/\1/"`
fi
if test "x$my_cxx_compiler" == "x"; then
load_opts "configure"
my_cxx_compiler=`echo $CONFIGURE_FLAGS | $GREP CXX| sed "s/.*CXX=[\"']\?\([$NOBLANK^'^\"]*\)[\"']\?.*/\1/"`
my_cxx_compiler=`echo $CONFIGURE_FLAGS | $GREP CXX| $SED "s/.*CXX=[\"']\?\([^$BLANK'\"]*\)[\"']\?.*/\1/"`
fi
if test "x$my_cxx_compiler" == "x"; then
set +e #error in the multiarch detection should not be fatal.
......@@ -243,7 +246,7 @@ extract_multiarch(){
fi
multiarch=$($my_cxx_compiler --print-multiarch 2>/dev/null)
if test $? -gt 0; then
multiarch=$($my_cxx_compiler -v 2>&1| $GREP target | sed "s/.*target=\([a-z0-9_-]\+\)/\1/")
multiarch=$($my_cxx_compiler -v 2>&1| $GREP target | $SED "s/.*target=\([a-z0-9_-]*\)/\1/")
fi
set -e # set to old value.
export MULTIARCH_LIBDIR="lib/$multiarch"
......@@ -296,7 +299,7 @@ check_commands() {
is_command() {
eval '
case "$1" in
'`echo $COMMANDS | sed -e 's/ / | /g'`')
'`echo $COMMANDS | $SED -e 's/ / | /g'`')
return 0
;;
*)
......@@ -444,7 +447,7 @@ run_default_vcsetup() {
if [ -f .git ] ; then
# submodule -> .git contains a pointer to the repository
GITHOOKPATH="$(sed 's/gitdir: //' < .git)/hooks/pre-commit"
GITHOOKPATH="$($SED 's/gitdir: //' < .git)/hooks/pre-commit"
else
# standard case, .git is the repository
GITHOOKPATH=.git/hooks/pre-commit
......@@ -667,9 +670,14 @@ 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=[$NOBLANK]\+\).*/\1/"`
if test -n "$cflags" ; then
cflags=`echo "$PARAMS" | $GREP $i= | $SED -e "s/.*\($i=\"[^\"]*\"\).*/\1/" -e "s/.*\($i='[^']*'\).*/\1/"`
if test -n "$cflags" && test "$PARAMS" != "$cflags" ; then
PREPARAMS="$PREPARAMS $cflags"
else
cflags=`echo "$PARAMS" | $GREP $i= | $SED -e "s/.*\($i=[^$BLANK]*\).*/\1/"`
if test -n "$cflags" && test "$PARAMS" != "$cflags" ; then
PREPARAMS="$PREPARAMS $cflags"
fi
fi
done
# create build directory if requested
......@@ -1023,7 +1031,7 @@ case "$command" in
fi
fi
done
echo export DUNE_CONTROL_PATH=$(echo $DUNE_CONTROL_PATH | sed -e 's/^://')
echo export DUNE_CONTROL_PATH=$(echo $DUNE_CONTROL_PATH | $SED -e 's/^://')
;;
printdeps)
find_modules_in_path
......@@ -1058,13 +1066,13 @@ case "$command" in
# get dependencies
eval deps=\$DEPS_$mainmod
#initially remove leading space
deps=`echo "$deps" | sed 's/^ *//'`
deps=`echo "$deps" | $SED 's/^ *//'`
while test -n "$deps"; do
#the end of the name is marked either by space, opening paren
#or comma
depname="${deps%%[ (,]*}"
#remove the name and adjacent whitespace
deps=`echo "$deps" | sed 's/^[^ (,]* *//'`
deps=`echo "$deps" | $SED 's/^[^ (,]* *//'`
#check whether there is a dependency version
case "$deps" in
'('*) deps="${deps#(}"
......@@ -1075,20 +1083,20 @@ case "$command" in
;;
esac
#remove any leading whitespace or commas for te next iteration
deps=`echo "$deps" | sed 's/^[, ]*//'`
deps=`echo "$deps" | $SED 's/^[, ]*//'`
requires="$requires $depname $depver "
done
# get suggestions
eval sugs=\$SUGS_$mainmod
#initially remove leading space
sugs=`echo "$sugs" | sed 's/^ *//'`
sugs=`echo "$sugs" | $SED 's/^ *//'`
while test -n "$sugs"; do
#the end of the name is marked either by space, opening paren
#or comma
sugsname="${sugs%%[ (,]*}"
#remove the name and adjacent whitespace
sugs=`echo "$sugs" | sed 's/^[^ (,]* *//'`
sugs=`echo "$sugs" | $SED 's/^[^ (,]* *//'`
#check whether there is a dependency version
case "$sugs" in
'('*) sugs="${sugs#(}"
......@@ -1099,7 +1107,7 @@ case "$command" in
;;
esac
#remove any leading whitespace or commas for te next iteration
sugs=`echo "$sugs" | sed 's/^[, ]*//'`
sugs=`echo "$sugs" | $SED 's/^[, ]*//'`
suggests="$suggests $sugsname"
suggestsall="$suggestsall $sugsname $sugsver "
......
......@@ -9,7 +9,6 @@
space=" "
tab=" "
BLANK="$space$tab"
NOBLANK="^$space^$tab"
dune_common_options_am2cmake()
{
......@@ -42,13 +41,13 @@ dune_common_options_am2cmake()
fi
# Check for --with-minimal-debug-level
local arg=`echo "$PARAMS"| grep \\\\--with-minimal-debug-level= | sed "s/.*--with-minimal-debug-level=\([$NOBLANK]*\).*/\1/"`
local arg=`echo "$PARAMS"| grep \\\\--with-minimal-debug-level= | sed "s/.*--with-minimal-debug-level=\([^$BLANK]*\).*/\1/"`
if test "x$arg" != "x"; then
CMAKE_PARAMS="$CMAKE_PARAMS -DMINIMAL_DEBUG_LEVEL:String=$arg"
fi
#Check for --prefix
local arg=`echo "$PARAMS"| grep \\\\--prefix= | sed "s/.*--prefix=\([$NOBLANK]*\).*/\1/"`
local arg=`echo "$PARAMS"| grep \\\\--prefix= | sed "s/.*--prefix=\([^$BLANK]*\).*/\1/"`
if test "x$arg" != "x"; then
CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_INSTALL_PREFIX=$arg"
fi
......
......@@ -36,7 +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"
NOBLANK="^$space$tab"
#
# read paramters from a $CONTROL file
......
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