[PATCH 10/11] build: use meson for building virt-login-shell

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

 



Switch over to using meson for building the virt-login-shell
tool

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 m4/virt-login-shell.m4 | 43 -------------------------------
 meson.build            |  2 ++
 meson_options.txt      |  1 +
 tools/Makefile.am      | 35 --------------------------
 tools/meson.build      | 57 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 60 insertions(+), 78 deletions(-)
 delete mode 100644 m4/virt-login-shell.m4

diff --git a/m4/virt-login-shell.m4 b/m4/virt-login-shell.m4
deleted file mode 100644
index 713c488599..0000000000
--- a/m4/virt-login-shell.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-dnl Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
-dnl Copyright (C) 2016 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/>.
-
-AC_DEFUN([LIBVIRT_ARG_LOGIN_SHELL], [
-  LIBVIRT_ARG_WITH([LOGIN_SHELL], [build virt-login-shell], [check])
-])
-
-AC_DEFUN([LIBVIRT_CHECK_LOGIN_SHELL], [
-  if test "x$with_login_shell" != "xno"; then
-    if test "x$with_linux" != "xyes"; then
-      if test "x$with_login_shell" = "xyes"; then
-        AC_MSG_ERROR([virt-login-shell is supported on Linux only])
-      else
-        with_login_shell=no;
-      fi
-    else
-      with_login_shell=yes;
-    fi
-  fi
-
-  if test "x$with_login_shell" = "xyes" ; then
-      AC_DEFINE_UNQUOTED([WITH_LOGIN_SHELL], 1, [whether virt-login-shell is built])
-  fi
-  AM_CONDITIONAL([WITH_LOGIN_SHELL], [test "$with_login_shell" = "yes"])
-])
-
-AC_DEFUN([LIBVIRT_RESULT_LOGIN_SHELL], [
-  LIBVIRT_RESULT([virt-login-shell], [$with_login_shell])
-])
diff --git a/meson.build b/meson.build
index 4e759d147b..bda0ee0373 100644
--- a/meson.build
+++ b/meson.build
@@ -13,11 +13,13 @@ project(
 prefix = get_option('prefix')
 bin_dir = get_option('bindir')
 lib_dir = get_option('libdir')
+libexec_dir = get_option('libexecdir')
 sys_conf_dir = get_option('sysconfdir')
 data_dir = get_option('datadir')
 local_state_dir = get_option('localstatedir')
 pkg_data_dir = data_dir / meson.project_name()
 pkg_doc_dir = data_dir / 'doc' / meson.project_name() + '-' + meson.project_version()
+pkg_sys_conf_dir = sys_conf_dir / 'libvirt'
 
 public_inc_dir = include_directories('include')
 gnulib_inc_dir = include_directories('gnulib/lib')
diff --git a/meson_options.txt b/meson_options.txt
index 92062f5d63..d092f30ba7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -23,3 +23,4 @@ option('with-driver-secret', type: 'boolean', value: true, description: 'Enable
 option('with-driver-storage', type: 'boolean', value: true, description: 'Enable storage driver')
 
 option('with-tools-host-validate', type: 'boolean', value: true, description: 'Enable virt-host-validate tool')
+option('with-tools-login-shell', type: 'boolean', value: true, description: 'Enable virt-login-shell tool')
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 749eaa12ff..94146632cb 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -53,7 +53,6 @@ ICON_FILES = \
 
 PODFILES = \
 	virt-admin.pod \
-	virt-login-shell.pod \
 	virt-pki-validate.pod \
 	virt-sanlock-cleanup.pod \
 	virt-xml-validate.pod \
@@ -62,7 +61,6 @@ PODFILES = \
 
 MANINFILES = \
 	virt-admin.1.in \
-	virt-login-shell.1.in \
 	virt-pki-validate.1.in \
 	virt-sanlock-cleanup.8.in \
 	virt-xml-validate.1.in \
@@ -76,7 +74,6 @@ EXTRA_DIST = \
 	virt-pki-validate.in \
 	virt-sanlock-cleanup.in \
 	libvirt-guests.sysconf \
-	virt-login-shell.conf \
 	virsh-edit.c \
 	bash-completion/vsh \
 	libvirt_recover_xattrs.sh \
@@ -107,13 +104,6 @@ man8_MANS = virt-sanlock-cleanup.8
 DISTCLEANFILES += virt-sanlock-cleanup
 endif WITH_SANLOCK
 
-if WITH_LOGIN_SHELL
-conf_DATA += virt-login-shell.conf
-bin_PROGRAMS += virt-login-shell
-libexec_PROGRAMS = virt-login-shell-helper
-man1_MANS += virt-login-shell.1
-endif WITH_LOGIN_SHELL
-
 virt-xml-validate: virt-xml-validate.in Makefile
 	$(AM_V_GEN)sed -e 's|[@]schemadir@|$(pkgdatadir)/schemas|g' \
 		       -e 's|[@]VERSION@|$(VERSION)|g' \
@@ -150,31 +140,6 @@ libvirt_shell_la_SOURCES = \
 		vsh-table.c vsh-table.h
 
 
-# virt-login-shell will be setuid, and must not link to anything
-# except glibc. It wil scrub the environment and then invoke the
-# real virt-login-shell-helper binary.
-virt_login_shell_SOURCES = \
-		virt-login-shell.c
-
-virt_login_shell_CPPFLAGS = $(STANDALONE_CPPFLAGS)
-
-virt_login_shell_helper_SOURCES = \
-		virt-login-shell-helper.c
-
-virt_login_shell_helper_LDFLAGS = \
-		$(AM_LDFLAGS) \
-		$(PIE_LDFLAGS) \
-		$(COVERAGE_LDFLAGS) \
-		$(NULL)
-virt_login_shell_helper_LDADD = \
-		../src/libvirt.la \
-		../src/libvirt-lxc.la \
-		../gnulib/lib/libgnu.la
-
-virt_login_shell_helper_CFLAGS = \
-		$(AM_CFLAGS) \
-		$(NULL)
-
 virsh_SOURCES = \
 		virsh.c virsh.h \
 		virsh-checkpoint.c virsh-checkpoint.h \
diff --git a/tools/meson.build b/tools/meson.build
index fdc3549411..6349dec2fb 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -6,6 +6,11 @@ if not (with_driver_qemu or with_driver_lxc or with_driver_bhyve)
   with_tools_host_validate = false
 endif
 
+with_tools_login_shell = get_option('with-tools-login-shell')
+if not with_driver_lxc
+  with_tools_login_shell = false
+endif
+
 if with_tools_host_validate
   virt_host_validate_src = [
     'virt-host-validate.c',
@@ -59,3 +64,55 @@ if with_tools_host_validate
     install_dir : join_paths(get_option('mandir'), 'man1')
   )
 endif
+
+if with_tools_login_shell
+  virt_login_shell_inc = [
+    top_inc_dir,
+  ]
+  virt_login_shell_src = [
+    'virt-login-shell.c',
+  ]
+  virt_login_shell = executable(
+    'virt-login-shell',
+    install: true,
+    sources: virt_login_shell_src,
+    include_directories: virt_login_shell_inc,
+    # We'll let downstream turn on setuid bit if they
+    # feel it is justified for their needs
+    #install_mode: ['rwsr-x---', 'root', 'root'],
+  )
+
+  virt_login_shell_helper_src = [
+    'virt-login-shell-helper.c',
+  ]
+  virt_login_shell_helper_inc = common_inc_dir
+  virt_login_shell_helper_libs = [libvirt_dep, libvirt_lxc_dep, libxml_dep, gnulib_dep]
+  virt_login_shell_helper = executable(
+    'virt-login-shell-helper',
+    install: true,
+    install_dir: libexec_dir,
+    sources: virt_login_shell_helper_src,
+    include_directories: virt_login_shell_helper_inc,
+    dependencies: virt_login_shell_helper_libs
+  )
+
+  install_data(
+    'virt-login-shell.conf',
+    install_dir: pkg_sys_conf_dir,
+  )
+
+  virt_login_shell_man = custom_target(
+    'virt_login_shell_man',
+    output : 'virt-login-shell.1',
+    input : 'virt-login-shell.pod',
+    command : [
+      pod2man,
+      '--section=1',
+      '--center=Virtualization Support',
+      '--release=libvirt @0@'.format(meson.project_version()),
+      '@INPUT@', '@OUTPUT@'
+    ],
+    install : true,
+    install_dir : join_paths(get_option('mandir'), 'man1')
+  )
+endif
-- 
2.21.0

--
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]

  Powered by Linux