]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: scripts: introduce meson-gen-def.py script
authorPavel Hrdina <phrdina@redhat.com>
Sun, 3 May 2020 11:48:37 +0000 (13:48 +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-def.py [new file with mode: 0755]
scripts/meson.build
src/Makefile.am

diff --git a/scripts/meson-gen-def.py b/scripts/meson-gen-def.py
new file mode 100755 (executable)
index 0000000..06c9bdf
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import re
+import sys
+
+if len(sys.argv) != 3:
+    print('invalid arguments')
+    print('usage: {0} INPUT OUTPUT'.format(sys.argv[0]))
+    sys.exit(1)
+
+infilepath = sys.argv[1]
+outfilepath = sys.argv[2]
+
+with open(infilepath) as f:
+    text = f.read()
+
+text = re.sub(r'^(|.*[#:}*].*|LIBVIRT_.*)\n?', '', text, flags=re.M)
+text = re.sub(r'\n$', '', text)
+text = re.sub(r'^[ ]*(.*);', r'    \1', text, flags=re.M)
+
+with open(outfilepath, 'w') as f:
+    f.write('EXPORTS\n')
+    f.write(text)
index 5d3f0af4793f4d54a3e6383352bd0b71c81a84fc..09340bb6c6577b49e30c18c01bb8915b28055014 100644 (file)
@@ -18,6 +18,7 @@ scripts = [
   'header-ifdef.py',
   'hvsupport.py',
   'hyperv_wmi_generator.py',
+  'meson-gen-def.py',
   'meson-python.sh',
   'mock-noinline.py',
   'prohibit-duplicate-header.py',
index 9764a648f9896f3607556ffb94a16b8709cd8987..36edda1616217f86e5c730c25b7d1da1c6a59286 100644 (file)
@@ -307,14 +307,6 @@ libvirt.syms: libvirt_public.syms $(USED_SYM_FILES) \
        chmod a-w $@-tmp && \
        mv $@-tmp libvirt.syms
 
-%.def: %.syms
-       $(AM_V_GEN)rm -f -- $@-tmp $@ ; \
-       printf 'EXPORTS\n' > $@-tmp && \
-       sed -e '/^$$/d; /#/d; /:/d; /}/d; /\*/d; /LIBVIRT_/d' \
-           -e 's/[      ]*\(.*\)\;/    \1/g' $^ >> $@-tmp && \
-       chmod a-w $@-tmp && \
-       mv $@-tmp $@
-
 # Empty source list - it merely links a bunch of convenience libs together
 libvirt_la_SOURCES =
 libvirt_la_LDFLAGS = \