components/ggrep/patches/correct_prefix.patch
changeset 5391 5aa4a8c4577f
parent 4574 7ddafe81d631
equal deleted inserted replaced
5390:a8538443770a 5391:5aa4a8c4577f
     1 This patch was created inhouse and is not applicable for submitting to
     1 This patch was created inhouse and is not applicable for submitting to
     2 upstream. This is because it implements Solaris oddity - having the binaries
     2 upstream. This is because it implements Solaris oddity - having the binaries
     3 available both without prefix and with 'g' prefix at the same time, only in
     3 available both without prefix and with 'g' prefix at the same time, only in
     4 different paths.
     4 different paths.
     5 
     5 
     6 --- grep-2.20/src/egrep.sh	2015-06-29 16:48:08.536062429 +0200
     6 --- grep-2.22-orig/src/egrep.sh	Wed Oct 21 22:00:20 2015
     7 +++ grep-2.20/src/egrep.sh	2015-06-29 16:47:57.380731794 +0200
     7 +++ grep-2.22/src/egrep.sh	Tue Jan 19 14:42:27 2016
     8 @@ -1,11 +1,29 @@
     8 @@ -1,2 +1,29 @@
     9  #!@SHELL@
     9  #!@SHELL@
    10 -grep=grep
    10 -exec @grep@ @option@ "$@"
    11 -case $0 in
       
    12 +# The script is a wrapper to GNU grep to be called with apropriate (-E or -F)
    11 +# The script is a wrapper to GNU grep to be called with apropriate (-E or -F)
    13 +# command line option. We can't just run 'ggrep' as the path may not contain
    12 +# command line option. We can't just run 'ggrep' as the path may not contain
    14 +# '/usr/bin' and we can't just use 'grep' as the PATH may not contain
    13 +# '/usr/bin' and we can't just use 'grep' as the PATH may not contain
    15 +# '/usr/gnu/bin'. Also we can't just use fixed path as /usr/gnu/bin/grep because
    14 +# '/usr/gnu/bin'. Also we can't just use fixed path as /usr/gnu/bin/grep because
    16 +# this script must work even from workspace before being installed into /usr/...
    15 +# this script must work even from workspace before being installed into /usr/...
    23 +  # fgrep or egrep in (potentially in /usr/gnu/bin)
    22 +  # fgrep or egrep in (potentially in /usr/gnu/bin)
    24 +  grep=grep
    23 +  grep=grep
    25 +fi
    24 +fi
    26 +
    25 +
    27 +case "$0" in
    26 +case "$0" in
    28    */*)
    27 +  */*)
    29 -    dir=${0%/*}
       
    30 -    if test -x "$dir/@grep@"; then
       
    31 -      PATH=$dir:$PATH
       
    32 -      grep=@grep@
       
    33 -    fi;;
       
    34 +    dir="${0%/*}"
    28 +    dir="${0%/*}"
    35 +    if test -x "$dir/$grep"; then
    29 +    if test -x "$dir/$grep"; then
    36 +      PATH="$dir:$PATH"
    30 +      PATH="$dir:$PATH"
    37 +    fi
    31 +    fi
    38 +    ;;
    32 +    ;;
    39 +  *)
    33 +  *)
    40 +    PATH="@prefix@/bin:$PATH"
    34 +    PATH="@prefix@/bin:$PATH"
    41 +    ;;
    35 +    ;;
    42  esac
    36 +esac
    43 -exec $grep @option@ "$@"
       
    44 +
    37 +
    45 +exec "$grep" @option@ "$@"
    38 +exec "$grep" @option@ "$@"