[Mesa-dev] [PATCH] Convert sed(1) syntax to be compatible with FreeBSD and OpenBSD

Eric Engestrom eric.engestrom at imgtec.com
Mon Mar 13 11:43:35 UTC 2017


On Sunday, 2017-03-12 03:19:14 +0000, Jan Beich wrote:
> BSD regex library doesn't support extended RE escapes (e.g. \+) and
> shorthand character classes (e.g. \s, \S) and SVR4-style word
> delimiters[1] (on DragonFly and NetBSD). Both GNU and BSD sed support
> -E and -r to enable extended RE but OS X still lacks -r.
> 
> [1] https://www.illumos.org/issues/516
> ---
>  configure.ac | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 21a73b031f..5d66400c61 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -908,18 +908,18 @@ llvm_add_target() {
>  # $1 is the llvm-config command with arguments.
>  strip_unwanted_llvm_flags() {
>      # Use \> (marks the end of the word)
> -    echo " `$1`" | sed \
> -        -e 's/\s\+-m\S*//g' \
> -        -e 's/\s\+-DNDEBUG\>//g' \
> -        -e 's/\s\+-D_GNU_SOURCE\>//g' \
> -        -e 's/\s\+-pedantic\>//g' \
> -        -e 's/\s\+-W\S*//g' \
> -        -e 's/\s\+-O\S*//g' \
> -        -e 's/\s\+-g\S*//g' \
> +    echo " `$1`" | sed -E \
> +        -e 's/[[[:space:]]]+-m[[^[:space:]]]*//g' \

These only work for me if I remove the outermost `[]` on each line,
leaving one pair around `:space:` and one for the set.
The above line, for instance, becomes:
  -e 's/[[:space:]]+-m[^[:space:]]*//g' \

Are those outer brackets necessary on *BSD? I don't have one available
to test this myself.

With that changed, it works on GNU sed, so if you send a v2 with that
fixed, it gets my:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom at imgtec.com>

Cheers,
  Eric


> +        -e 's/[[[:space:]]]+-DNDEBUG\>//g' \
> +        -e 's/[[[:space:]]]+-D_GNU_SOURCE\>//g' \
> +        -e 's/[[[:space:]]]+-pedantic\>//g' \
> +        -e 's/[[[:space:]]]+-W[[^[:space:]]]*//g' \
> +        -e 's/[[[:space:]]]+-O[[^[:space:]]]*//g' \
> +        -e 's/[[[:space:]]]+-g[[^[:space:]]]*//g' \
>          -e 's/-fno-rtti\>/-Fno-rtti/g' \
> -        -e 's/\s\+-f\S*//g' \
> +        -e 's/[[[:space:]]]+-f[[^[:space:]]]*//g' \
>          -e 's/-Fno-rtti\>/-fno-rtti/g' \
> -        -e 's/^ //'
> +        -e 's/^[[[:space:]]]//'
>  }
>  
>  llvm_set_environment_variables() {


More information about the mesa-dev mailing list