2018-01-18 22:42:31 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2018-03-29 10:18:47 +02:00
|
|
|
from __future__ import print_function, division, absolute_import
|
2018-01-18 22:42:31 +01:00
|
|
|
|
|
|
|
import io, os, re, sys
|
|
|
|
|
2018-07-09 19:11:29 +02:00
|
|
|
if len (sys.argv) < 3:
|
|
|
|
sys.exit("usage: gen-def.py harfbuzz.def hb.h [hb-blob.h hb-buffer.h ...]")
|
|
|
|
|
|
|
|
output_file = sys.argv[1]
|
|
|
|
header_paths = sys.argv[2:]
|
|
|
|
|
2018-01-18 22:42:31 +01:00
|
|
|
headers_content = []
|
2018-07-09 19:11:29 +02:00
|
|
|
for h in header_paths:
|
2018-01-18 22:42:31 +01:00
|
|
|
if h.endswith (".h"):
|
2018-03-16 22:35:03 +01:00
|
|
|
with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ())
|
2018-01-18 22:42:31 +01:00
|
|
|
|
2018-02-12 12:40:13 +01:00
|
|
|
result = """EXPORTS
|
|
|
|
%s
|
|
|
|
LIBRARY lib%s-0.dll""" % (
|
|
|
|
"\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))),
|
2018-07-09 19:11:29 +02:00
|
|
|
output_file.replace ('.def', '')
|
2018-02-12 12:40:13 +01:00
|
|
|
)
|
2018-01-18 22:42:31 +01:00
|
|
|
|
2018-07-09 19:11:29 +02:00
|
|
|
with open (output_file, "w") as f: f.write (result)
|