meson: add wireshark build dependency

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-07-29 14:22:10 +02:00
parent 4b896dda9c
commit 1ba3d2895a
4 changed files with 46 additions and 77 deletions

View File

@ -109,12 +109,10 @@ fi
LIBVIRT_ARG_NSS
LIBVIRT_ARG_PM_UTILS
LIBVIRT_ARG_WIRESHARK
LIBVIRT_ARG_YAJL
LIBVIRT_CHECK_NWFILTER
LIBVIRT_CHECK_PM_UTILS
LIBVIRT_CHECK_WIRESHARK
LIBVIRT_CHECK_XDR
LIBVIRT_CHECK_YAJL
@ -411,10 +409,6 @@ LIBVIRT_RESULT_LOGIN_SHELL
LIBVIRT_RESULT_HOST_VALIDATE
LIBVIRT_RESULT_TLS_PRIORITY
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Developer Tools])
AC_MSG_NOTICE([])
LIBVIRT_RESULT_WIRESHARK
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Privileges])
AC_MSG_NOTICE([])
LIBVIRT_RESULT_QEMU_PRIVILEGES

View File

@ -1,71 +0,0 @@
dnl The libvirt.so wireshark plugin
dnl
dnl Copyright (C) 2015 Red Hat, Inc.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public
dnl License as published by the Free Software Foundation; either
dnl version 2.1 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_ARG_WIRESHARK],[
LIBVIRT_ARG_WITH_FEATURE([WIRESHARK_DISSECTOR], [wireshark], [check], [2.4.0])
LIBVIRT_ARG_WITH([WS_PLUGINDIR],
[wireshark plugins directory for use when installing
wireshark plugin], [check])
])
AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [2.4.0])
dnl Check for system location of wireshark plugins
if test "x$with_wireshark_dissector" != "xno" ; then
if test "x$with_ws_plugindir" = "xcheck" ; then
ws_plugindir="$($PKG_CONFIG --variable plugindir wireshark)"
ws_exec_prefix="$($PKG_CONFIG --variable exec_prefix wireshark)"
ws_modversion="$($PKG_CONFIG --modversion wireshark)"
if test "x$ws_plugindir" = "x" ; then
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"
else
if test "x$ws_exec_prefix" = "x" ; then
dnl If wireshark's exec_prefix cannot be retrieved from pkg-config,
dnl this is our best bet
ws_exec_prefix="/usr"
fi
dnl Replace wireshark's exec_prefix with our own.
dnl Note that ${exec_prefix} is kept verbatim at this point in time,
dnl and will only be expanded later, when make is called: this makes
dnl it possible to override such prefix at compilation or installation
dnl time
ws_plugindir='${exec_prefix}'"${ws_plugindir#$ws_exec_prefix}"
fi
dnl Since wireshark 2.5.0 plugins can't live in top level
dnl plugindir but have to be under one of ["epan",
dnl "wiretap", "codecs"] subdir. The first one looks okay.
ws_plugindir="$ws_plugindir/epan"
elif test "x$with_ws_plugindir" = "xno" || test "x$with_ws_plugindir" = "xyes"; then
AC_MSG_ERROR([ws-plugindir must be used only with valid path])
else
ws_plugindir=$with_ws_plugindir
fi
fi
AC_SUBST([ws_plugindir])
])
AC_DEFUN([LIBVIRT_RESULT_WIRESHARK],[
LIBVIRT_RESULT_LIB([WIRESHARK_DISSECTOR])
])

View File

@ -1422,6 +1422,45 @@ else
win32_link_flags = []
endif
wireshark_version = '2.4.0'
wireshark_dep = dependency('wireshark', version: '>=' + wireshark_version, required: get_option('wireshark_dissector'))
if wireshark_dep.found()
wireshark_plugindir = get_option('wireshark_plugindir')
if wireshark_plugindir == ''
wireshark_plugindir = wireshark_dep.get_pkgconfig_variable('plugindir')
endif
# On some systems the plugindir variable may not be stored within pkg config.
# Fall back to older style of constructing the plugin dir path.
if wireshark_plugindir == ''
wireshark_modversion = wireshark_dep.version()
wireshark_plugindir = '@0@/wireshark/plugins/@1@'.format(
libdir, wireshark_modversion
)
else
wireshark_prefix = wireshark_dep.get_pkgconfig_variable('prefix')
if wireshark_prefix == ''
# If wireshark's prefix cannot be retrieved from pkg-config,
# this is our best bet.
wireshark_prefix = '/usr'
endif
# Replace wireshark's prefix with our own.
# There is no replace method in meson so we have to workaround it.
rc = run_command(
'python3', '-c',
'print("@0@".replace("@1@", "@2@"))'.format(
wireshark_plugindir, wireshark_prefix, prefix,
),
check: true,
)
wireshark_plugindir = rc.stdout().strip()
endif
# Since wireshark 2.5.0 plugins can't live in top level plugindir but have
# to be under one of ["epan", "wiretap", "codecs"] subdir. The first one looks okay.
wireshark_plugindir = wireshark_plugindir / 'epan'
endif
# generic build dependencies checks
@ -1555,3 +1594,8 @@ misc_summary = {
'Warning Flags': supported_cc_flags,
}
summary(misc_summary, section: 'Miscellaneous', bool_yn: true, list_sep: ' ')
devtools_summary = {
'wireshark_dissector': wireshark_dep.found(),
}
summary(devtools_summary, section: 'Developer Tools', bool_yn: true)

View File

@ -42,6 +42,8 @@ option('selinux', type: 'feature', value: 'auto', description: 'selinux support'
option('selinux_mount', type: 'string', value: '', description: 'set SELinux mount point')
option('udev', type: 'feature', value: 'auto', description: 'udev support')
option('virtualport', type: 'feature', value: 'auto', description: 'enable virtual port support')
option('wireshark_dissector', type: 'feature', value: 'auto', description: 'wireshark support')
option('wireshark_plugindir', type: 'string', value: '', description: 'wireshark plugins directory for use when installing wireshark plugin')
# build driver options