1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

meson: src: build libvirt.syms and libvirt.def symbol files

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-27 08:35:58 +02:00
parent 8fc4d28dba
commit 215a753222
15 changed files with 124 additions and 111 deletions

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

View 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

View 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 \

View 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

View File

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

View 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

View 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

View File

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

View 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

View 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

View 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

View File

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

View 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

View File

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

View 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