Re: [PATCH 2/3] wireshark: Try a bunch of possible prefixes

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

 



On 26.10.2016 18:08, Andrea Bolognani wrote:
> If we can't obtain Wireshark's plugindir variable from
> pkg-config, we fall back to building it ourselves starting
> from $libdir.
> 
> The problem with that is that we have zero insights on what
> $libdir actually looks like, so we can't simply strip $prefix
> and call it a day. On the other hand, we have to do *something*
> or $ws_plugindir will be unusable.
> 
> Our solution is to try the four most likely prefixes, and use
> the first one that matches. It's not perfect, but should be
> able to cope with all but the weirdest setups.
> 
> Worst case scenario, the user can pass --with-ws-plugindir to
> configure and explicitly provide a suitable installation path.
> ---
>  m4/virt-wireshark.m4 | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/m4/virt-wireshark.m4 b/m4/virt-wireshark.m4
> index 556272a..75786de 100644
> --- a/m4/virt-wireshark.m4
> +++ b/m4/virt-wireshark.m4
> @@ -35,11 +35,20 @@ AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
>          dnl On some systems the plugindir variable may not be stored within pkg config.
>          dnl Fall back to older style of constructing the plugin dir path.
>          ws_plugindir="$libdir/wireshark/plugins/$ws_modversion"
> -        ws_prefix="$prefix"
> +        dnl We have no idea what the contents of $libdir look like, so we'll
> +        dnl have to play a bit of a guessing game: let's try stripping off
> +        dnl a bunch of likels prefixed and pick the first one that matches.
> +        dnl Even if none does, we'll still have one last shot later
> +        for try in "$prefix" "$exec_prefix" '${prefix}' '${exec_prefix}'; do
> +          if test "x${ws_plugindir#$try}" != "x$ws_plugindir"; then
> +            ws_prefix="$try"
> +            break
> +          fi
> +        done
>        fi
>        if test "x$ws_prefix" = "x" ; then
> -        dnl If the wireshark prefix cannot be retrieved from pkg-config,
> -        dnl /usr is our best bet
> +        dnl If the wireshark prefix cannot be retrieved from pkg-config
> +        dnl or otherwise guessed, /usr is our best bet
>          ws_prefix="/usr"
>        fi
>        dnl Replace the wireshark prefix with our own.
> 
I am under the impression that it will be pretty hard to build a
functioning solution for a plugindir-less wireshark.pc file other than
for the purpose to fix the RPM build (and don't break make distcheck).

My first idea was to start off using the libdir value from wireshark,
see
https://www.redhat.com/archives/libvir-list/2016-October/msg01186.html
(the wireshark.pc versions I've seen all have it set, as well as the
prefix). This would cover the case where libdir[wireshark] !=
libdir.

But both your and my approach will only be correct if the [exec_]prefix
of both libvirt and wireshark match, which will not be the case for
non-RPM builds for the default configuration (exec_prefix=/usr/local) or
the less usual but valid /opt/$package naming scheme.

Plus libdir has to be the same in both packages anyway in order to not
break the RPM build (unless you want to tweak the spec file). I'd
suggest to stick to your original version (and rely on the last shot as
you put it): the general case is really hard to fix properly.

-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]