[libvirt PATCH 314/351] meson: examples: build and install example files

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:59:10 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 Makefile.am                      |   2 +-
 configure.ac                     |   3 +-
 examples/Makefile.am             | 127 -------------------------------
 examples/c/admin/meson.build     |  27 +++++++
 examples/c/domain/meson.build    |  24 ++++++
 examples/c/meson.build           |   3 +
 examples/c/misc/meson.build      |  22 ++++++
 examples/meson.build             |   7 ++
 examples/polkit/meson.build      |   1 +
 examples/sh/meson.build          |   1 +
 examples/systemtap/meson.build   |   9 +++
 examples/xml/meson.build         |   2 +
 examples/xml/storage/meson.build |  15 ++++
 examples/xml/test/meson.build    |  14 ++++
 meson.build                      |   2 +
 15 files changed, 129 insertions(+), 130 deletions(-)
 delete mode 100644 examples/Makefile.am
 create mode 100644 examples/c/admin/meson.build
 create mode 100644 examples/c/domain/meson.build
 create mode 100644 examples/c/meson.build
 create mode 100644 examples/c/misc/meson.build
 create mode 100644 examples/meson.build
 create mode 100644 examples/polkit/meson.build
 create mode 100644 examples/sh/meson.build
 create mode 100644 examples/systemtap/meson.build
 create mode 100644 examples/xml/meson.build
 create mode 100644 examples/xml/storage/meson.build
 create mode 100644 examples/xml/test/meson.build

diff --git a/Makefile.am b/Makefile.am
index 549ade3db20..4b3abc82728 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@
 DISTCHECK_CONFIGURE_FLAGS = --enable-werror
 
 SUBDIRS = . docs \
-  po examples
+  po
 
 XZ_OPT ?= -v -T0
 export XZ_OPT
diff --git a/configure.ac b/configure.ac
index 78676d73d2b..4f7ad909468 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,5 @@ AC_CONFIG_FILES([\
         libvirt-lxc.pc \
         libvirt-admin.pc \
         libvirt.spec mingw-libvirt.spec \
-        po/Makefile \
-        examples/Makefile])
+        po/Makefile])
 AC_OUTPUT
diff --git a/examples/Makefile.am b/examples/Makefile.am
deleted file mode 100644
index 15ff897cf1f..00000000000
--- a/examples/Makefile.am
+++ /dev/null
@@ -1,127 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-## Copyright (C) 2005-2016 Red Hat, Inc.
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-ADMIN_EXAMPLES = \
-	$(wildcard $(srcdir)/c/admin/*.c) \
-	$(NULL)
-
-DOMAIN_EXAMPLES = \
-	$(wildcard $(srcdir)/c/domain/*.c) \
-	$(NULL)
-
-MISC_EXAMPLES = \
-	$(wildcard $(srcdir)/c/misc/*.c) \
-	$(NULL)
-
-POLKIT_EXAMPLES = \
-	$(wildcard $(srcdir)/polkit/*.rules) \
-	$(NULL)
-
-SH_EXAMPLES = \
-	$(wildcard $(srcdir)/sh/*) \
-	$(NULL)
-
-STORAGE_XML_EXAMPLES = \
-	$(wildcard $(srcdir)/xml/storage/*.xml) \
-	$(NULL)
-
-SYSTEMTAP_EXAMPLES = \
-	$(wildcard $(srcdir)/systemtap/*.stp) \
-	$(NULL)
-
-TEST_XML_EXAMPLES = \
-	$(wildcard $(srcdir)/xml/test/*.xml) \
-	$(NULL)
-
-AM_CPPFLAGS = \
-	-I$(top_builddir)/include \
-	-I$(top_srcdir)/include \
-	$(NULL)
-
-AM_CFLAGS = \
-	$(WARN_CFLAGS) \
-	$(NULL)
-
-AM_LDFLAGS = \
-	$(STATIC_BINARIES) \
-	$(NULL)
-
-LDADD = \
-	$(top_builddir)/src/libvirt.la \
-	$(top_builddir)/src/libvirt-admin.la \
-	$(NULL)
-
-noinst_PROGRAMS = \
-	c/admin/client_close \
-	c/admin/client_info \
-	c/admin/client_limits \
-	c/admin/list_clients \
-	c/admin/list_servers \
-	c/admin/logging \
-	c/admin/threadpool_params \
-	c/domain/dommigrate \
-	c/domain/domtop \
-	c/domain/info1 \
-	c/domain/rename \
-	c/domain/suspend \
-	c/misc/event-test \
-	c/misc/hellolibvirt \
-	c/misc/openauth \
-	$(NULL)
-
-c_admin_client_close_SOURCES = c/admin/client_close.c
-c_admin_client_info_SOURCES = c/admin/client_info.c
-c_admin_client_limits_SOURCES = c/admin/client_limits.c
-c_admin_list_clients_SOURCES = c/admin/list_clients.c
-c_admin_list_servers_SOURCES = c/admin/list_servers.c
-c_admin_logging_SOURCES = c/admin/logging.c
-c_admin_threadpool_params_SOURCES = c/admin/threadpool_params.c
-c_domain_dommigrate_SOURCES = c/domain/dommigrate.c
-c_domain_domtop_SOURCES = c/domain/domtop.c
-c_domain_info1_SOURCES = c/domain/info1.c
-c_domain_rename_SOURCES = c/domain/rename.c
-c_domain_suspend_SOURCES = c/domain/suspend.c
-c_misc_event_test_SOURCES = c/misc/event-test.c
-c_misc_hellolibvirt_SOURCES = c/misc/hellolibvirt.c
-c_misc_openauth_SOURCES = c/misc/openauth.c
-
-examplesdir = $(docdir)/examples
-
-adminexamplesdir = $(examplesdir)/c/admin
-adminexamples_DATA = $(ADMIN_EXAMPLES)
-
-domainexamplesdir = $(examplesdir)/c/domain
-domainexamples_DATA = $(DOMAIN_EXAMPLES)
-
-miscexamplesdir = $(examplesdir)/c/misc
-miscexamples_DATA = $(MISC_EXAMPLES)
-
-polkitexamplesdir = $(examplesdir)/polkit
-polkitexamples_DATA = $(POLKIT_EXAMPLES)
-
-shexamplesdir = $(examplesdir)/sh
-shexamples_DATA = $(SH_EXAMPLES)
-
-storagexmlexamplesdir = $(examplesdir)/xml/storage
-storagexmlexamples_DATA = $(STORAGE_XML_EXAMPLES)
-
-systemtapexamplesdir = $(examplesdir)/systemtap
-systemtapexamples_DATA = $(SYSTEMTAP_EXAMPLES)
-
-testxmlexamplesdir = $(examplesdir)/xml/test
-testxmlexamples_DATA = $(TEST_XML_EXAMPLES)
diff --git a/examples/c/admin/meson.build b/examples/c/admin/meson.build
new file mode 100644
index 00000000000..094408a63c2
--- /dev/null
+++ b/examples/c/admin/meson.build
@@ -0,0 +1,27 @@
+example_admin_files = [
+  'client_close',
+  'client_info',
+  'client_limits',
+  'list_clients',
+  'list_servers',
+  'logging',
+  'threadpool_params',
+]
+
+foreach name : example_admin_files
+  source_file = '@0 at .c'.format(name)
+  executable(
+    name,
+    [
+      source_file,
+    ],
+    include_directories: [
+      libvirt_inc,
+    ],
+    link_with: [
+      libvirt_lib,
+      libvirt_admin_lib,
+    ],
+  )
+  install_data(source_file, install_dir: example_dir / 'c' / 'admin')
+endforeach
diff --git a/examples/c/domain/meson.build b/examples/c/domain/meson.build
new file mode 100644
index 00000000000..51cd03afc85
--- /dev/null
+++ b/examples/c/domain/meson.build
@@ -0,0 +1,24 @@
+example_domain_files = [
+  'dommigrate',
+  'domtop',
+  'info1',
+  'rename',
+  'suspend',
+]
+
+foreach name : example_domain_files
+  source_file = '@0 at .c'.format(name)
+  executable(
+    name,
+    [
+      source_file,
+    ],
+    include_directories: [
+      libvirt_inc,
+    ],
+    link_with: [
+      libvirt_lib,
+    ],
+  )
+  install_data(source_file, install_dir: example_dir / 'c' / 'domain')
+endforeach
diff --git a/examples/c/meson.build b/examples/c/meson.build
new file mode 100644
index 00000000000..727e4caafaa
--- /dev/null
+++ b/examples/c/meson.build
@@ -0,0 +1,3 @@
+subdir('admin')
+subdir('domain')
+subdir('misc')
diff --git a/examples/c/misc/meson.build b/examples/c/misc/meson.build
new file mode 100644
index 00000000000..b106467912f
--- /dev/null
+++ b/examples/c/misc/meson.build
@@ -0,0 +1,22 @@
+example_misc_files = [
+  'event-test',
+  'hellolibvirt',
+  'openauth',
+]
+
+foreach name : example_misc_files
+  source_file = '@0 at .c'.format(name)
+  executable(
+    name,
+    [
+      source_file,
+    ],
+    include_directories: [
+      libvirt_inc,
+    ],
+    link_with: [
+      libvirt_lib,
+    ],
+  )
+  install_data(source_file, install_dir: example_dir / 'c' / 'misc')
+endforeach
diff --git a/examples/meson.build b/examples/meson.build
new file mode 100644
index 00000000000..a57820aaed5
--- /dev/null
+++ b/examples/meson.build
@@ -0,0 +1,7 @@
+example_dir = docdir / 'examples'
+
+subdir('c')
+subdir('polkit')
+subdir('sh')
+subdir('systemtap')
+subdir('xml')
diff --git a/examples/polkit/meson.build b/examples/polkit/meson.build
new file mode 100644
index 00000000000..d57c5a19868
--- /dev/null
+++ b/examples/polkit/meson.build
@@ -0,0 +1 @@
+install_data('libvirt-acl.rules', install_dir: example_dir / 'polkit')
diff --git a/examples/sh/meson.build b/examples/sh/meson.build
new file mode 100644
index 00000000000..0cdbe17c677
--- /dev/null
+++ b/examples/sh/meson.build
@@ -0,0 +1 @@
+install_data('virt-lxc-convert', install_dir: example_dir / 'sh')
diff --git a/examples/systemtap/meson.build b/examples/systemtap/meson.build
new file mode 100644
index 00000000000..f31187e1877
--- /dev/null
+++ b/examples/systemtap/meson.build
@@ -0,0 +1,9 @@
+install_data(
+  [
+    'rpc-monitor.stp',
+    'qemu-monitor.stp',
+    'lock-debug.stp',
+    'events.stp',
+  ],
+  install_dir: example_dir / 'systemtap',
+)
diff --git a/examples/xml/meson.build b/examples/xml/meson.build
new file mode 100644
index 00000000000..650d6a15d27
--- /dev/null
+++ b/examples/xml/meson.build
@@ -0,0 +1,2 @@
+subdir('storage')
+subdir('test')
diff --git a/examples/xml/storage/meson.build b/examples/xml/storage/meson.build
new file mode 100644
index 00000000000..c142bb1e08d
--- /dev/null
+++ b/examples/xml/storage/meson.build
@@ -0,0 +1,15 @@
+install_data(
+  [
+    'pool-dir.xml',
+    'pool-fs.xml',
+    'pool-logical.xml',
+    'pool-netfs.xml',
+    'vol-cow.xml',
+    'vol-qcow.xml',
+    'vol-qcow2.xml',
+    'vol-raw.xml',
+    'vol-sparse.xml',
+    'vol-vmdk.xml',
+  ],
+  install_dir: example_dir / 'xml' / 'storage',
+)
diff --git a/examples/xml/test/meson.build b/examples/xml/test/meson.build
new file mode 100644
index 00000000000..89ebf03a7bc
--- /dev/null
+++ b/examples/xml/test/meson.build
@@ -0,0 +1,14 @@
+install_data(
+  [
+    'testdev.xml',
+    'testnodeinline.xml',
+    'testdomfc4.xml',
+    'testdomfv0.xml',
+    'testnode.xml',
+    'testnetdef.xml',
+    'testvol.xml',
+    'testnetpriv.xml',
+    'testpool.xml',
+  ],
+  install_dir: example_dir / 'xml' / 'test',
+)
diff --git a/meson.build b/meson.build
index 2e894df1ab2..caee54a5818 100644
--- a/meson.build
+++ b/meson.build
@@ -2207,6 +2207,8 @@ subdir('tools')
 
 subdir('tests')
 
+subdir('examples')
+
 
 # generate meson-config.h file
 configure_file(output: 'meson-config.h', configuration: conf)
-- 
2.26.2




More information about the libvir-list mailing list