libtool-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 05/12] ltmain.in: Don't encode RATHS which match default link


From: Mike Frysinger
Subject: Re: [PATCH 05/12] ltmain.in: Don't encode RATHS which match default linker paths
Date: Tue, 16 Jan 2024 21:10:11 -0500

On 25 Oct 2021 15:33, Richard Purdie wrote:
> We don't want to add RPATHS which match default linker search paths, they're
> a waste of space. This patch filters libtools list of paths to encoode and
> removes the ones we don't need.
> 
> Libtool may be passed link paths of the form "/usr/lib/../lib" so normalize
> the paths before comparision.

add a bit more detail to the commit message, add the changelog, and fix the
typo in the subject line ("RATHS").

> --- a/build-aux/ltmain.in
> +++ b/build-aux/ltmain.in
> @@ -7672,8 +7672,16 @@ EOF
>                 esac
>               fi
>             else
> -             eval flag=\"$hardcode_libdir_flag_spec\"
> -             func_append dep_rpath " $flag"
> +                # We only want to hardcode in an rpath if it isn't in the
> +                # default dlsearch path.
> +                func_normal_abspath "$libdir"
> +                libdir_norm=$func_normal_abspath_result
> +             case " $sys_lib_dlsearch_path " in
> +             *" $libdir_norm "*) ;;
> +             *) eval flag=\"$hardcode_libdir_flag_spec\"
> +                   func_append dep_rpath " $flag"
> +                   ;;
> +             esac

this is a non-trivial amount of boiler plate that you're pasting in here.
can we introduce a func to make this more readable ?  something like this
untested code.

# func_is_in_list <ELEMENT> <LIST> [separator]
# blah blah blah
func_is_in_list ()
{
    case "${3:- }$2${3:- }" in
    *"${3:- }$1${3:- }"*) return 0;;
    esac
    return 1
}

then you could write:
  func_normal_abspath "$libdir"
  if ! func_is_in_list "$func_normal_abspath_result" "$sys_lib_dlsearch_path"; 
then
    eval flag=\"$hardcode_libdir_flag_spec\"
    func_append dep_rpath " $flag"
  fi

and there's 2 other places where $sys_lib_dlsearch_path is checked that could
be converted over to this helper.
-mike

Attachment: signature.asc
Description: PGP signature


reply via email to

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