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

meson: docs: build api XML 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-06-25 14:31:59 +02:00
parent c4fbc69491
commit 4dc0e601c7
4 changed files with 60 additions and 68 deletions

View File

@ -297,13 +297,6 @@ dot_html = \
htmldir = $(HTML_DIR)
html_DATA = $(dot_html)
apidir = $(pkgdatadir)/api
api_DATA = \
libvirt-api.xml \
libvirt-qemu-api.xml \
libvirt-lxc-api.xml \
libvirt-admin-api.xml
schemadir = $(pkgdatadir)/schemas
schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
@ -392,51 +385,3 @@ check-html:
$(XMLLINT) --nonet --noout html/*.html
check-local: check-html
python_generated_files = $(api_DATA)
APIBUILD=$(top_srcdir)/scripts/apibuild.py
APIBUILD_STAMP=apibuild.py.stamp
$(python_generated_files): $(APIBUILD_STAMP)
$(APIBUILD_STAMP): $(top_srcdir)/scripts/apibuild.py \
$(top_srcdir)/include/libvirt/libvirt.h \
$(top_srcdir)/include/libvirt/libvirt-common.h.in \
$(top_srcdir)/include/libvirt/libvirt-domain-checkpoint.h \
$(top_srcdir)/include/libvirt/libvirt-domain-snapshot.h \
$(top_srcdir)/include/libvirt/libvirt-domain.h \
$(top_srcdir)/include/libvirt/libvirt-event.h \
$(top_srcdir)/include/libvirt/libvirt-host.h \
$(top_srcdir)/include/libvirt/libvirt-interface.h \
$(top_srcdir)/include/libvirt/libvirt-network.h \
$(top_srcdir)/include/libvirt/libvirt-nodedev.h \
$(top_srcdir)/include/libvirt/libvirt-nwfilter.h \
$(top_srcdir)/include/libvirt/libvirt-secret.h \
$(top_srcdir)/include/libvirt/libvirt-storage.h \
$(top_srcdir)/include/libvirt/libvirt-stream.h \
$(top_srcdir)/include/libvirt/libvirt-lxc.h \
$(top_srcdir)/include/libvirt/libvirt-qemu.h \
$(top_srcdir)/include/libvirt/libvirt-admin.h \
$(top_srcdir)/include/libvirt/virterror.h \
$(top_srcdir)/src/libvirt.c \
$(top_srcdir)/src/libvirt-domain-checkpoint.c \
$(top_srcdir)/src/libvirt-domain-snapshot.c \
$(top_srcdir)/src/libvirt-domain.c \
$(top_srcdir)/src/libvirt-host.c \
$(top_srcdir)/src/libvirt-interface.c \
$(top_srcdir)/src/libvirt-network.c \
$(top_srcdir)/src/libvirt-nodedev.c \
$(top_srcdir)/src/libvirt-nwfilter.c \
$(top_srcdir)/src/libvirt-secret.c \
$(top_srcdir)/src/libvirt-storage.c \
$(top_srcdir)/src/libvirt-stream.c \
$(top_srcdir)/src/libvirt-lxc.c \
$(top_srcdir)/src/libvirt-qemu.c \
$(top_srcdir)/src/admin/libvirt-admin.c \
$(top_srcdir)/src/util/virerror.c \
$(top_srcdir)/src/util/virevent.c \
$(top_srcdir)/src/util/virtypedparam-public.c
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) \
$(RUNUTF8) $(PYTHON) $(APIBUILD)
touch $@

View File

@ -28,3 +28,34 @@ docs_assets = [
]
install_data(docs_assets, install_dir: docs_html_dir)
docs_api_generated = custom_target(
'generate-api',
output: [
'libvirt-api.xml',
'libvirt-lxc-api.xml',
'libvirt-qemu-api.xml',
'libvirt-admin-api.xml',
],
command: [
meson_python_prog, python3_prog.path(), apibuild_prog.path(),
meson.current_source_dir(),
meson.current_build_dir(),
],
install: true,
install_dir: pkgdatadir / 'api',
depend_files: [
libvirt_common_h_in,
libvirt_include,
driver_sources,
libvirt_qemu_sources,
libvirt_lxc_sources,
admin_sources,
util_public_sources,
],
)
docs_api_xml = docs_api_generated[0]
docs_lxc_api_xml = docs_api_generated[1]
docs_qemu_api_xml = docs_api_generated[2]
docs_admin_api_xml = docs_api_generated[3]

View File

@ -12,6 +12,7 @@ import os
import sys
import glob
import re
import argparse
quiet = True
warnings = 0
@ -2404,13 +2405,11 @@ class app:
warnings = warnings + 1
print(msg)
def rebuild(self, name):
def rebuild(self, name, srcdir, builddir):
if name not in ["libvirt", "libvirt-qemu", "libvirt-lxc", "libvirt-admin"]:
self.warning("rebuild() failed, unknown module %s" % name)
return None
builder = None
srcdir = os.path.abspath((os.environ["srcdir"]))
builddir = os.path.abspath((os.environ["builddir"]))
if glob.glob(srcdir + "/../src/libvirt.c") != []:
if not quiet:
print("Rebuilding API description for %s" % name)
@ -2438,15 +2437,24 @@ class app:
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="XML API builder")
parser.add_argument("srcdir", type=str, help="path to docs source dir")
parser.add_argument("builddir", type=str, help="path to docs build dir")
parser.add_argument("-d", "--debug", type=str, help="path to source file")
args = parser.parse_args()
app = app()
if len(sys.argv) > 1:
if args.debug:
debug = 1
app.parse(sys.argv[1])
app.parse(args.debug)
else:
app.rebuild("libvirt")
app.rebuild("libvirt-qemu")
app.rebuild("libvirt-lxc")
app.rebuild("libvirt-admin")
app.rebuild("libvirt", args.srcdir, args.builddir)
app.rebuild("libvirt-qemu", args.srcdir, args.builddir)
app.rebuild("libvirt-lxc", args.srcdir, args.builddir)
app.rebuild("libvirt-admin", args.srcdir, args.builddir)
if warnings > 0:
sys.exit(2)
else:

View File

@ -277,7 +277,7 @@ subdir('vmware')
subdir('vz')
driver_sources = [
driver_sources = files(
'driver.c',
'libvirt.c',
'libvirt-domain.c',
@ -291,7 +291,7 @@ driver_sources = [
'libvirt-secret.c',
'libvirt-storage.c',
'libvirt-stream.c',
]
)
driver_headers = [
'driver-hypervisor.h',
@ -428,9 +428,13 @@ libvirt_qemu_syms_flags = '@0@@1@'.format(
libvirt_qemu_syms_path,
)
libvirt_qemu_sources = files(
'libvirt-qemu.c',
)
libvirt_qemu_lib = shared_library(
'virt-qemu',
'libvirt-qemu.c',
libvirt_qemu_sources,
dependencies: [
src_dep,
],
@ -478,9 +482,13 @@ libvirt_lxc_syms_flags = '@0@@1@'.format(
libvirt_lxc_syms_path,
)
libvirt_lxc_sources = files(
'libvirt-lxc.c',
)
libvirt_lxc_lib = shared_library(
'virt-lxc',
'libvirt-lxc.c',
libvirt_lxc_sources,
dependencies: [
apparmor_dep,
selinux_dep,