summaryrefslogtreecommitdiffstats
path: root/gfx/harfbuzz/src/gen-def.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/harfbuzz/src/gen-def.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/harfbuzz/src/gen-def.py')
-rwxr-xr-xgfx/harfbuzz/src/gen-def.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/gfx/harfbuzz/src/gen-def.py b/gfx/harfbuzz/src/gen-def.py
new file mode 100755
index 0000000000..6011817bc5
--- /dev/null
+++ b/gfx/harfbuzz/src/gen-def.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+"usage: gen-def.py harfbuzz.def hb.h [hb-blob.h hb-buffer.h ...]"
+
+import os, re, sys
+
+if len (sys.argv) < 3:
+ sys.exit(__doc__)
+
+output_file = sys.argv[1]
+header_paths = sys.argv[2:]
+
+headers_content = []
+for h in header_paths:
+ if h.endswith (".h"):
+ with open (h, encoding='utf-8') as f: headers_content.append (f.read ())
+
+symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))
+if '--experimental-api' not in sys.argv:
+ # Move these to harfbuzz-sections.txt when got stable
+ experimental_symbols = \
+"""hb_shape_justify
+hb_subset_repack_or_fail
+hb_subset_input_override_name_table
+""".splitlines ()
+ symbols = [x for x in symbols if x not in experimental_symbols]
+symbols = "\n".join (symbols)
+
+result = symbols if os.getenv ('PLAIN_LIST', '') else """EXPORTS
+%s
+LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', ''))
+
+with open (output_file, "w") as f: f.write (result)