]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: src: build libvirt.syms and libvirt.def symbol files
authorPavel Hrdina <phrdina@redhat.com>
Mon, 27 Jul 2020 06:35:58 +0000 (08:35 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:04 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
15 files changed:
m4/virt-win-symbols.m4
src/Makefile.am
src/access/Makefile.inc.am
src/access/meson.build
src/esx/Makefile.inc.am [deleted file]
src/esx/meson.build
src/meson.build
src/openvz/Makefile.inc.am [deleted file]
src/openvz/meson.build
src/remote/Makefile.inc.am
src/remote/meson.build
src/vmware/Makefile.inc.am [deleted file]
src/vmware/meson.build
src/vmx/Makefile.inc.am [deleted file]
src/vmx/meson.build

index eba5596e4b4b022c03d847d95bf15d7bcb54d404..f7b8e612a8d2b2dd9ebd323a5ea01bbb376086ca 100644 (file)
@@ -18,7 +18,6 @@ dnl <http://www.gnu.org/licenses/>.
 dnl
 
 AC_DEFUN([LIBVIRT_WIN_CHECK_SYMBOLS], [
-  LIBVIRT_SYMBOL_FILE=libvirt.syms
   LIBVIRT_ADMIN_SYMBOL_FILE=admin/libvirt_admin.syms
   LIBVIRT_LXC_SYMBOL_FILE='$(srcdir)/libvirt_lxc.syms'
   LIBVIRT_QEMU_SYMBOL_FILE='$(srcdir)/libvirt_qemu.syms'
@@ -27,13 +26,11 @@ AC_DEFUN([LIBVIRT_WIN_CHECK_SYMBOLS], [
       # Also set the symbol file to .def, so src/Makefile generates libvirt.def
       # from libvirt.syms and passes libvirt.def instead of libvirt.syms to the
       # linker
-      LIBVIRT_SYMBOL_FILE=libvirt.def
       LIBVIRT_ADMIN_SYMBOL_FILE=admin/libvirt_admin.def
       LIBVIRT_LXC_SYMBOL_FILE=libvirt_lxc.def
       LIBVIRT_QEMU_SYMBOL_FILE=libvirt_qemu.def
       ;;
   esac
-  AC_SUBST([LIBVIRT_SYMBOL_FILE])
   AC_SUBST([LIBVIRT_ADMIN_SYMBOL_FILE])
   AC_SUBST([LIBVIRT_LXC_SYMBOL_FILE])
   AC_SUBST([LIBVIRT_QEMU_SYMBOL_FILE])
index 0d08ce1d9653f3779b6c62906a2460c600b3ca6c..67b8e5733575930f431b3b1ab89781663513e3b7 100644 (file)
@@ -75,11 +75,7 @@ include access/Makefile.inc.am
 include logging/Makefile.inc.am
 include locking/Makefile.inc.am
 include admin/Makefile.inc.am
-include esx/Makefile.inc.am
-include vmx/Makefile.inc.am
-include vmware/Makefile.inc.am
 include vbox/Makefile.inc.am
-include openvz/Makefile.inc.am
 include qemu/Makefile.inc.am
 include bhyve/Makefile.inc.am
 include libxl/Makefile.inc.am
@@ -221,9 +217,8 @@ check-local: check-protocol check-symfile check-symsorting \
 # All .syms files should be placed in exactly one of these three lists,
 # depending on whether they are stored in git and/or used in the build.
 SYM_FILES += $(USED_SYM_FILES)
-USED_SYM_FILES += $(srcdir)/libvirt_private.syms
 GENERATED_SYM_FILES += \
-       libvirt.syms libvirt.def libvirt_qemu.def libvirt_lxc.def \
+       libvirt_qemu.def libvirt_lxc.def \
        $(NULL)
 
 
@@ -245,52 +240,6 @@ check-augeas: $(augeas_DATA) $(augeastest_DATA)
 AUG_GENTEST_SCRIPT = $(top_srcdir)/scripts/augeas-gentest.py
 AUG_GENTEST = $(RUNUTF8) $(PYTHON) $(AUG_GENTEST_SCRIPT)
 
-
-#
-# Build our version script.  This is composed of three parts:
-#
-# 1. libvirt_public.syms - public API.  These functions are always
-# present in the library and should never change incompatibly.
-#
-# 2. libvirt_private.syms - private API.  These symbols are private and
-# semantics may change on every release, hence the version number is
-# spliced in at build time. This ensures that if libvirtd, virsh, or a
-# driver module was built against one libvirt release, it will refuse to
-# load with another where symbols may have same names but different
-# semantics. Such symbols should never be visible in an (installed)
-# public header file.
-#
-# 3. libvirt_*.syms - dynamic private API.  Like libvirt_private.syms,
-# except that build options (such as --enable-debug) can mean these
-# symbols aren't present at all.
-#
-
-USED_SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
-
-if WITH_LINUX
-USED_SYM_FILES += $(srcdir)/libvirt_linux.syms
-else ! WITH_LINUX
-SYM_FILES += $(srcdir)/libvirt_linux.syms
-endif ! WITH_LINUX
-
-if WITH_SASL
-USED_SYM_FILES += $(srcdir)/libvirt_sasl.syms
-else ! WITH_SASL
-SYM_FILES += $(srcdir)/libvirt_sasl.syms
-endif ! WITH_SASL
-
-if WITH_SSH2
-USED_SYM_FILES += $(srcdir)/libvirt_libssh2.syms
-else ! WITH_SSH2
-SYM_FILES += $(srcdir)/libvirt_libssh2.syms
-endif ! WITH_SSH2
-
-if WITH_LIBSSH
-USED_SYM_FILES += $(srcdir)/libvirt_libssh.syms
-else ! WITH_LIBSSH
-SYM_FILES += $(srcdir)/libvirt_libssh.syms
-endif ! WITH_LIBSSH
-
 BUILT_SOURCES += $(GENERATED_SYM_FILES)
 
 # Empty source list - it merely links a bunch of convenience libs together
index 4ede8a61eff6afb7f1d3e14dcb9808173226634b..a3dcc69fe0990c9e8d4fa5c80c5fdf2289bcb57f 100644 (file)
@@ -1,11 +1,5 @@
 # vim: filetype=automake
 
-ACCESS_DRIVER_SYM_FILES = \
-       libvirt_access.syms \
-       libvirt_access_qemu.syms \
-       libvirt_access_lxc.syms \
-       $(NULL)
-
 ACCESS_DRIVER_API_FILES = \
        libvirt_access.xml \
        libvirt_access_qemu.xml \
@@ -14,8 +8,6 @@ ACCESS_DRIVER_API_FILES = \
 
 ACCESS_DRIVER_POLKIT_POLICY = access/org.libvirt.api.policy
 
-GENERATED_SYM_FILES += $(ACCESS_DRIVER_SYM_FILES)
-
 libvirt_la_BUILT_LIBADD += libvirt_driver_access.la
 
 $(ACCESS_DRIVER_POLKIT_POLICY): $(srcdir)/access/viraccessperm.h \
@@ -33,24 +25,10 @@ endif WITH_LIBVIRTD
 BUILT_SOURCES += $(ACCESS_DRIVER_POLKIT_POLICY)
 endif WITH_POLKIT
 
-
 BUILT_SOURCES += \
        $(ACCESS_DRIVER_API_FILES) \
        $(NULL)
 
-libvirt_access.syms: $(srcdir)/rpc/gendispatch.pl \
-                       $(REMOTE_PROTOCOL) Makefile.am
-       $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclsym \
-         remote REMOTE $(REMOTE_PROTOCOL) > $@
-libvirt_access_qemu.syms: $(srcdir)/rpc/gendispatch.pl \
-                       $(QEMU_PROTOCOL) Makefile.am
-       $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclsym \
-         qemu QEMU $(QEMU_PROTOCOL) > $@
-libvirt_access_lxc.syms: $(srcdir)/rpc/gendispatch.pl \
-                       $(LXC_PROTOCOL) Makefile.am
-       $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclsym \
-         lxc LXC $(LXC_PROTOCOL) > $@
-
 libvirt_access.xml: $(srcdir)/rpc/gendispatch.pl \
                        $(REMOTE_PROTOCOL) Makefile.am
        $(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
index c5784fa4a98bdb9666de29b9486e587a22ddab67..dc962166873b9ec5c106366276d1c4425031b4fd 100644 (file)
@@ -13,14 +13,17 @@ remote_path = meson.source_root() / 'src' / 'remote'
 
 access_gen_headers = []
 access_gen_sources = []
+access_gen_sym = []
 
 foreach name : [ 'remote', 'qemu', 'lxc' ]
   if name == 'remote'
     header_file = 'viraccessapicheck.h'
     source_file = 'viraccessapicheck.c'
+    syms_file = 'libvirt_access.syms'
   else
     header_file = 'viraccessapicheck@0@.h'.format(name)
     source_file = 'viraccessapicheck@0@.c'.format(name)
+    syms_file = 'libvirt_access_@0@.syms'.format(name)
   endif
   protocol_file = remote_path / '@0@_protocol.x'.format(name)
 
@@ -42,6 +45,15 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
     ],
     capture: true,
   )
+
+  access_gen_sym += custom_target(
+    syms_file,
+    output: syms_file,
+    capture: true,
+    command: [
+      gendispatch_prog, '--mode=aclsym', name, name.to_upper(), protocol_file,
+    ]
+  )
 endforeach
 
 if conf.has('WITH_POLKIT')
@@ -70,3 +82,5 @@ access_dep = declare_dependency(
   include_directories: access_inc_dir,
   sources: access_gen_headers,
 )
+
+generated_sym_files += access_gen_sym
diff --git a/src/esx/Makefile.inc.am b/src/esx/Makefile.inc.am
deleted file mode 100644 (file)
index 2e776d1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# vim: filetype=automake
-
-if WITH_ESX
-USED_SYM_FILES += $(srcdir)/libvirt_esx.syms
-else ! WITH_ESX
-SYM_FILES += $(srcdir)/libvirt_esx.syms
-endif ! WITH_ESX
index c49ec8d9961ed191f29f8f1178a20873781ad903..b15f515fe2e8ff851f1dd8fc898bc484f47a0925 100644 (file)
@@ -54,3 +54,9 @@ if conf.has('WITH_ESX')
     ],
   )
 endif
+
+if conf.has('WITH_ESX')
+  used_sym_files += 'libvirt_esx.syms'
+else
+  sym_files += 'libvirt_esx.syms'
+endif
index 02ce9176ce0ab320a50d2aab73cf267895bd9ca6..5e89c1a34370afecefb744aa8733b506b87a6363 100644 (file)
@@ -85,6 +85,44 @@ if conf.has('WITH_DTRACE_PROBES')
 endif
 
 
+# symbol files
+
+public_sym_file = 'libvirt_public.syms'
+
+used_sym_files = [
+  'libvirt_private.syms',
+  'libvirt_driver_modules.syms',
+]
+
+generated_sym_files = []
+
+sym_files = []
+
+if host_machine.system() == 'linux'
+  used_sym_files += 'libvirt_linux.syms'
+else
+  sym_files += 'libvirt_linux.syms'
+endif
+
+if conf.has('WITH_SASL')
+  used_sym_files += 'libvirt_sasl.syms'
+else
+  sym_files += 'libvirt_sasl.syms'
+endif
+
+if conf.has('WITH_LIBSSH')
+  used_sym_files += 'libvirt_libssh.syms'
+else
+  sym_files += 'libvirt_libssh.syms'
+endif
+
+if conf.has('WITH_SSH2')
+  used_sym_files += 'libvirt_libssh2.syms'
+else
+  sym_files += 'libvirt_libssh2.syms'
+endif
+
+
 # list subdirectories
 
 subdir('util')
@@ -150,3 +188,44 @@ driver_lib = static_library(
     conf_inc_dir,
   ],
 )
+
+
+# symbol files for libvirt.so
+
+# Build our version script.  This is composed of three parts:
+#
+# 1. libvirt_public.syms - public API.  These functions are always
+# present in the library and should never change incompatibly.
+#
+# 2. libvirt_private.syms - private API.  These symbols are private and
+# semantics may change on every release, hence the version number is
+# spliced in at build time. This ensures that if libvirtd, virsh, or a
+# driver module was built against one libvirt release, it will refuse to
+# load with another where symbols may have same names but different
+# semantics. Such symbols should never be visible in an (installed)
+# public header file.
+#
+# 3. libvirt_*.syms - dynamic private API.  Like libvirt_private.syms,
+# except that build options (such as --enable-debug) can mean these
+# symbols aren't present at all.
+
+libvirt_syms = custom_target(
+  'libvirt.syms',
+  input: [ public_sym_file ] + used_sym_files + generated_sym_files,
+  output: 'libvirt.syms',
+  command: [
+    meson_python_prog, python3_prog.path(), meson_gen_sym_prog.path(),
+    '@OUTPUT@', 'LIBVIRT_PRIVATE_' + meson.project_version(), '@INPUT@',
+  ],
+)
+if host_machine.system() == 'windows'
+  libvirt_def = custom_target(
+    'libvirt.def',
+    input: libvirt_syms,
+    output: 'libvirt.def',
+    command: [
+      meson_python_prog, python3_prog.path(), meson_gen_def_prog.path(),
+      '@INPUT@', '@OUTPUT@',
+    ],
+  )
+endif
diff --git a/src/openvz/Makefile.inc.am b/src/openvz/Makefile.inc.am
deleted file mode 100644 (file)
index c01e331..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# vim: filetype=automake
-
-if WITH_OPENVZ
-USED_SYM_FILES += $(srcdir)/libvirt_openvz.syms
-else ! WITH_OPENVZ
-SYM_FILES += $(srcdir)/libvirt_openvz.syms
-endif ! WITH_OPENVZ
index b4e3befccb5bb007528abf86f269031cb6ac1054..427b25fed1cefdd3fc28c41c9c0691f58b2ec4d0 100644 (file)
@@ -18,3 +18,9 @@ if conf.has('WITH_OPENVZ')
     ],
   )
 endif
+
+if conf.has('WITH_OPENVZ')
+  used_sym_files += 'libvirt_openvz.syms'
+else
+  sym_files += 'libvirt_openvz.syms'
+endif
index 2fbdfedbd035586db994754ea01d2544911ed95f..2ab3f1ec5081c2e9b56e432533214d880efd3a3f 100644 (file)
@@ -133,12 +133,6 @@ BUILT_SOURCES += \
        $(REMOTE_DAEMON_GENERATED) \
        $(NULL)
 
-if WITH_REMOTE
-USED_SYM_FILES += $(srcdir)/libvirt_remote.syms
-else ! WITH_REMOTE
-SYM_FILES += $(srcdir)/libvirt_remote.syms
-endif ! WITH_REMOTE
-
 if WITH_LIBVIRTD
 
 sbin_PROGRAMS += libvirtd virtproxyd
index 383b265ea2180e30b6c343f1b74f775875bfbf4e..f029edefd7e1379c42d496d5d37c34358b21cb6a 100644 (file)
@@ -57,3 +57,9 @@ if conf.has('WITH_REMOTE')
     ],
   )
 endif
+
+if conf.has('WITH_REMOTE')
+  used_sym_files += 'libvirt_remote.syms'
+else
+  sym_files += 'libvirt_remote.syms'
+endif
diff --git a/src/vmware/Makefile.inc.am b/src/vmware/Makefile.inc.am
deleted file mode 100644 (file)
index 125e030..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# vim: filetype=automake
-
-if WITH_VMWARE
-USED_SYM_FILES += $(srcdir)/libvirt_vmware.syms
-else ! WITH_VMWARE
-SYM_FILES += $(srcdir)/libvirt_vmware.syms
-endif ! WITH_VMWARE
index 285cc5eb9a3c2072b70aa29e8f94e32c5f6e0f29..dc2a32a1610dce80b1de8338aa58be6704dfb8e3 100644 (file)
@@ -16,3 +16,9 @@ if conf.has('WITH_VMWARE')
     ],
   )
 endif
+
+if conf.has('WITH_VMWARE')
+  used_sym_files += 'libvirt_vmware.syms'
+else
+  sym_files += 'libvirt_vmware.syms'
+endif
diff --git a/src/vmx/Makefile.inc.am b/src/vmx/Makefile.inc.am
deleted file mode 100644 (file)
index 8912f6e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# vim: filetype=automake
-
-if WITH_VMX
-USED_SYM_FILES += $(srcdir)/libvirt_vmx.syms
-else ! WITH_VMX
-SYM_FILES += $(srcdir)/libvirt_vmx.syms
-endif ! WITH_VMX
index 8bed1fac9fa319d23e7eacfbe6e038c2d1f2d168..25e3d1a6fcaf94a7ab84505b22a864329a90a8fb 100644 (file)
@@ -18,3 +18,9 @@ if conf.has('WITH_VMX')
 endif
 
 vmx_inc_dir = include_directories('.')
+
+if conf.has('WITH_VMX')
+  used_sym_files += 'libvirt_vmx.syms'
+else
+  sym_files += 'libvirt_vmx.syms'
+endif