octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60413] build: sed expression problems when pr


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #60413] build: sed expression problems when prefix is empty or slash
Date: Sun, 18 Apr 2021 07:01:52 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36 Edg/89.0.774.77

Follow-up Comment #7, bug #60413 (project octave):

Along the lines that Mike suggested in comment #0, maybe, we could change the
sed command to something like this:

if test -n "$prefix"; then echo "$var" | sed -E "s%(-L|-I| )${prefix}([/\\
]|$)%\1\$\{prefix\}\2%g"; else echo "$var"; fi


IIUC, that would only replace anything in the respective variable ($var in the
example) if the prefix is non-empty and the prefix is preceded by "-I", "-L"
or " " in the variable and it is followed by "/", "\" or " " or ends with the
prefix.

An example in subst-config-vals.in.h could maybe look like:

if test -n "@prefix@"; then echo '@CPPFLAGS@' | sed -E "s%(-L|-I|
)@prefix@([/\\ ]|$)%\1\$\{prefix\}\2%g"; else echo '@CPPFLAGS@'; fi


Does "sed -E" work on all platforms we'd like to support (GNU, BSD, Mac, ...)?
Fwiw, "sed -r" seems to work similarly for me with GNU sed 4.7 if that should
be better supported cross-platform.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60413>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]