]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: scripts: introduce meson-gen-sym.py script
authorPavel Hrdina <phrdina@redhat.com>
Mon, 27 Jul 2020 06:28:46 +0000 (08:28 +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>
scripts/meson-gen-sym.py [new file with mode: 0755]
scripts/meson.build
src/Makefile.am

diff --git a/scripts/meson-gen-sym.py b/scripts/meson-gen-sym.py
new file mode 100755 (executable)
index 0000000..65a13e5
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+
+import sys
+
+if len(sys.argv) < 5:
+    print('invalid arguments')
+    print('usage: {0} OUTPUT VERSION PUBLIC PRIVATE ...')
+    sys.exit(1)
+
+outfilepath = sys.argv[1]
+version = sys.argv[2]
+public = sys.argv[3]
+private = sys.argv[4:]
+
+with open(outfilepath, 'w') as out:
+    out.write('# WARNING: generated from the following files:\n\n')
+
+    with open(public) as tmp:
+        out.write(tmp.read())
+
+    out.write('\n\n# Private symbols\n\n')
+    out.write('{0} {{\n\n'.format(version))
+    out.write('global:\n\n')
+
+    for priv in private:
+        with open(priv) as tmp:
+            out.write(tmp.read())
+
+    out.write('\n\nlocal:\n*;\n\n};')
index 09340bb6c6577b49e30c18c01bb8915b28055014..93ac4aa2cda5ecb4059cb5e893bbfbc951bd9956 100644 (file)
@@ -19,6 +19,7 @@ scripts = [
   'hvsupport.py',
   'hyperv_wmi_generator.py',
   'meson-gen-def.py',
+  'meson-gen-sym.py',
   'meson-python.sh',
   'mock-noinline.py',
   'prohibit-duplicate-header.py',
index 36edda1616217f86e5c730c25b7d1da1c6a59286..0d08ce1d9653f3779b6c62906a2460c600b3ca6c 100644 (file)
@@ -293,20 +293,6 @@ endif ! WITH_LIBSSH
 
 BUILT_SOURCES += $(GENERATED_SYM_FILES)
 
-libvirt.syms: libvirt_public.syms $(USED_SYM_FILES) \
-               $(ACCESS_DRIVER_SYM_FILES) \
-               $(top_builddir)/config.status
-       $(AM_V_GEN)rm -f $@-tmp $@ ; \
-       printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp && \
-       cat $(srcdir)/libvirt_public.syms >>$@-tmp && \
-       printf '\n\n# Private symbols\n\n' >>$@-tmp && \
-       printf 'LIBVIRT_PRIVATE_$(VERSION) {\n\n'  >>$@-tmp && \
-       printf 'global:\n\n' >>$@-tmp && \
-       cat $(USED_SYM_FILES) $(ACCESS_DRIVER_SYM_FILES) >>$@-tmp && \
-       printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
-       chmod a-w $@-tmp && \
-       mv $@-tmp libvirt.syms
-
 # Empty source list - it merely links a bunch of convenience libs together
 libvirt_la_SOURCES =
 libvirt_la_LDFLAGS = \