qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH 16/18] cap_ng: convert to meson
Date: Thu, 17 Dec 2020 17:54:45 +0400	[thread overview]
Message-ID: <CAMxuvay_R0-EioOMRuty6RDrt3RSGUTgiy48aZPz8zgxRhc=vw@mail.gmail.com> (raw)
In-Reply-To: <20201217094044.46462-17-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 7659 bytes --]

Hi

On Thu, Dec 17, 2020 at 1:41 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure         | 34 ++++------------------------------
>  meson.build       | 24 ++++++++++++++++++++----
>  meson_options.txt |  2 ++
>  tools/meson.build |  4 ++--
>  4 files changed, 28 insertions(+), 36 deletions(-)
>
> diff --git a/configure b/configure
> index 11d6f40f92..faee71612f 100755
> --- a/configure
> +++ b/configure
> @@ -331,7 +331,7 @@ xen_ctrl_version="$default_feature"
>  xen_pci_passthrough="auto"
>  linux_aio="$default_feature"
>  linux_io_uring="$default_feature"
> -cap_ng="$default_feature"
> +cap_ng="auto"
>  attr="$default_feature"
>  libattr="$default_feature"
>  xfs="$default_feature"
> @@ -1123,9 +1123,9 @@ for opt do
>    ;;
>    --enable-tcg-interpreter) tcg_interpreter="yes"
>    ;;
> -  --disable-cap-ng)  cap_ng="no"
> +  --disable-cap-ng)  cap_ng="disabled"
>    ;;
> -  --enable-cap-ng) cap_ng="yes"
> +  --enable-cap-ng) cap_ng="enabled"
>    ;;
>    --disable-tcg) tcg="disabled"
>    ;;
> @@ -3193,28 +3193,6 @@ EOF
>    fi
>  fi
>
> -##########################################
> -# libcap-ng library probe
> -if test "$cap_ng" != "no" ; then
> -  cap_libs="-lcap-ng"
> -  cat > $TMPC << EOF
> -#include <cap-ng.h>
> -int main(void)
> -{
> -    capng_capability_to_name(CAPNG_EFFECTIVE);
> -    return 0;
> -}
> -EOF
> -  if compile_prog "" "$cap_libs" ; then
> -    cap_ng=yes
> -  else
> -    if test "$cap_ng" = "yes" ; then
> -      feature_not_found "cap_ng" "Install libcap-ng devel"
> -    fi
> -    cap_ng=no
> -  fi
> -fi
> -
>  ##########################################
>  # Sound support libraries probe
>
> @@ -5671,10 +5649,6 @@ fi
>  if test "$gprof" = "yes" ; then
>    echo "CONFIG_GPROF=y" >> $config_host_mak
>  fi
> -if test "$cap_ng" = "yes" ; then
> -  echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
> -  echo "LIBCAP_NG_LIBS=$cap_libs" >> $config_host_mak
> -fi
>  echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
>  for drv in $audio_drv_list; do
>      def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
> @@ -6561,7 +6535,7 @@ NINJA=$ninja $meson setup \
>          -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2
> -Dlibiscsi=$libiscsi \
>          -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses
> -Dlibudev=$libudev\
>          -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy
> -Dlzfse=$lzfse \
> -        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs \
> +        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng
> \
>          -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
>          -Dvhost_user_blk_server=$vhost_user_blk_server \
>          -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
> diff --git a/meson.build b/meson.build
> index 08d3586df5..56ab291d87 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -334,10 +334,25 @@ if not get_option('libiscsi').auto() or have_system
> or have_tools
>                         required: get_option('seccomp'),
>                         method: 'pkg-config', static: enable_static)
>  endif
> -libcap_ng = not_found
> -if 'CONFIG_LIBCAP_NG' in config_host
> -  libcap_ng = declare_dependency(link_args:
> config_host['LIBCAP_NG_LIBS'].split())
> +
> +libcap_ng = cc.find_library('cap-ng', has_headers: ['cap-ng.h'],
> +                      required: get_option('cap_ng'),
> +                      static: enable_static)
> +if libcap_ng.found() and not cc.links('''
> +   #include <cap-ng.h>
> +   int main(void)
> +   {
> +     capng_capability_to_name(CAPNG_EFFECTIVE);
> +     return 0;
> +   }''', dependencies: libcap_ng)
> +  libcap_ng = not_found
> +  if get_option('cap_ng').enabled()
> +    error('could not link libcap-ng')
> +  else
> +    warning('could not link libcap-ng, disabling')
>

.pc file is provided since 0.6.5
curl -s 'https://repology.org/api/v1/project/libcap-ng' |  \
   jq -r 'group_by(.repo) | .[] | "\(.[0].repo): \(map(.version))"' | \
   egrep -i 'ubuntu_18|debian_old|rhel|centos|bsd|suse_leap_15_2|sles'

centos_6: ["0.6.4"]
centos_7: ["0.7.5"]
centos_8: ["0.7.9"]
debian_oldstable: ["0.7.7"]
opensuse_leap_15_2: ["0.7.9"]
ubuntu_18_04: ["0.7.7"]

RHEL6 is EOL, we no longer support it, right?

Then we should be good to switch to pkg-config method.

It can be done later. For this patch:
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


+  endif
>  endif
> +
>  if get_option('xkbcommon').auto() and not have_system and not have_tools
>    xkbcommon = not_found
>  else
> @@ -1006,6 +1021,7 @@ config_host_data.set('CONFIG_GLUSTERFS_FALLOCATE',
> glusterfs.version().version_c
>  config_host_data.set('CONFIG_GLUSTERFS_ZEROFILL',
> glusterfs.version().version_compare('>=6'))
>  config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT',
> glusterfs_ftruncate_has_stat)
>  config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT',
> glusterfs_iocb_has_stat)
> +config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found())
>  config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
>  config_host_data.set('CONFIG_LIBNFS', libnfs.found())
>  config_host_data.set('CONFIG_LIBSSH', libssh.found())
> @@ -2348,7 +2364,7 @@ summary_info += {'fdatasync':
>  config_host.has_key('CONFIG_FDATASYNC')}
>  summary_info += {'madvise':
>  config_host.has_key('CONFIG_MADVISE')}
>  summary_info += {'posix_madvise':
>  config_host.has_key('CONFIG_POSIX_MADVISE')}
>  summary_info += {'posix_memalign':
> config_host.has_key('CONFIG_POSIX_MEMALIGN')}
> -summary_info += {'libcap-ng support':
> config_host.has_key('CONFIG_LIBCAP_NG')}
> +summary_info += {'libcap-ng support': libcap_ng.found()}
>  summary_info += {'vhost-kernel support':
> config_host.has_key('CONFIG_VHOST_KERNEL')}
>  summary_info += {'vhost-net support':
> config_host.has_key('CONFIG_VHOST_NET')}
>  summary_info += {'vhost-crypto support':
> config_host.has_key('CONFIG_VHOST_CRYPTO')}
> diff --git a/meson_options.txt b/meson_options.txt
> index 59a8a50e5b..12a1872f20 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -44,6 +44,8 @@ option('brlapi', type : 'feature', value : 'auto',
>         description: 'brlapi character device driver')
>  option('bzip2', type : 'feature', value : 'auto',
>         description: 'bzip2 support for DMG images')
> +option('cap_ng', type : 'feature', value : 'auto',
> +       description: 'cap_ng support')
>  option('cocoa', type : 'feature', value : 'auto',
>         description: 'Cocoa user interface (macOS only)')
>  option('curl', type : 'feature', value : 'auto',
> diff --git a/tools/meson.build b/tools/meson.build
> index 5c52d79fe4..fdce66857d 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -1,14 +1,14 @@
>  have_virtiofsd = (targetos == 'linux' and
>      have_tools and
>      seccomp.found() and
> -    'CONFIG_LIBCAP_NG' in config_host and
> +    libcap_ng.found() and
>      'CONFIG_VHOST_USER' in config_host)
>
>  if get_option('virtiofsd').enabled()
>    if not have_virtiofsd
>      if targetos != 'linux'
>        error('virtiofsd requires Linux')
> -    elif not seccomp.found() or 'CONFIG_LIBCAP_NG' not in config_host
> +    elif not seccomp.found() or not libcap_ng.found()
>        error('virtiofsd requires libcap-ng-devel and seccomp-devel')
>      elif not have_tools or 'CONFIG_VHOST_USER' not in config_host
>        error('virtiofsd needs tools and vhost-user support')
> --
> 2.29.2
>
>
>

[-- Attachment #2: Type: text/html, Size: 10054 bytes --]

  reply	other threads:[~2020-12-17 13:56 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17  9:40 [PATCH 00/22] meson: move detection of various libraries to meson.build Paolo Bonzini
2020-12-17  9:40 ` [PATCH 01/18] brlapi: convert to meson Paolo Bonzini
2020-12-17 11:35   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 02/18] curl: remove compatibility code, require 7.29.0 Paolo Bonzini
2020-12-17 10:08   ` Daniel P. Berrangé
2020-12-17 11:48   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 03/18] curl: convert to meson Paolo Bonzini
2020-12-17 10:11   ` Daniel P. Berrangé
2020-12-17 11:59   ` Marc-André Lureau
2020-12-17 12:00     ` Marc-André Lureau
2020-12-17 12:05       ` Paolo Bonzini
2020-12-17  9:40 ` [PATCH 04/18] glusterfs: " Paolo Bonzini
2020-12-17 12:15   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 05/18] bzip2: " Paolo Bonzini
2020-12-17 12:24   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 06/18] libiscsi: " Paolo Bonzini
2020-12-17 12:25   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 07/18] libnfs: " Paolo Bonzini
2020-12-17 12:26   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 08/18] libssh: " Paolo Bonzini
2020-12-17 12:35   ` Marc-André Lureau
2020-12-17 13:09     ` Paolo Bonzini
2020-12-17  9:40 ` [PATCH 09/18] rbd: " Paolo Bonzini
2020-12-17 12:36   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 10/18] lzo: " Paolo Bonzini
2020-12-17 12:42   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 11/18] snappy: " Paolo Bonzini
2020-12-17 12:47   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 12/18] lzfse: " Paolo Bonzini
2020-12-17 13:11   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 13/18] zstd: " Paolo Bonzini
2020-12-17 13:31   ` Marc-André Lureau
2020-12-17 13:32     ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 14/18] seccomp: " Paolo Bonzini
2020-12-17 13:36   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 15/18] virtfs: " Paolo Bonzini
2020-12-17 13:38   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 16/18] cap_ng: " Paolo Bonzini
2020-12-17 13:54   ` Marc-André Lureau [this message]
2020-12-17  9:40 ` [PATCH 17/18] libattr: " Paolo Bonzini
2020-12-17 14:05   ` Marc-André Lureau
2020-12-17  9:40 ` [PATCH 18/18] meson.build: convert --with-default-devices " Paolo Bonzini
2020-12-17 14:08   ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMxuvay_R0-EioOMRuty6RDrt3RSGUTgiy48aZPz8zgxRhc=vw@mail.gmail.com' \
    --to=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).