未验证 提交 bf9e9676 编写于 作者: C Cosimo Lupo 提交者: GitHub

Merge pull request #1091 from anthrotype/fix-gen-def-py

gen-def.py: pass headers as arguments so that msys2 can convert posix paths
......@@ -834,9 +834,8 @@ set_target_properties(hb-ot-tag PROPERTIES COMPILE_FLAGS "-DMAIN")
if (UNIX OR MINGW)
if (BUILD_SHARED_LIBS)
# generate harfbuzz.def after build completion
string(REPLACE ";" " " space_separated_headers "${project_headers}")
add_custom_command(TARGET harfbuzz POST_BUILD
COMMAND ${CMAKE_COMMAND} -E env "headers=${space_separated_headers}" python ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def
COMMAND "${PYTHON_EXECUTABLE}" ${PROJECT_SOURCE_DIR}/src/gen-def.py ${PROJECT_BINARY_DIR}/harfbuzz.def ${project_headers}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
add_test(NAME check-static-inits.sh
......
......@@ -277,13 +277,13 @@ endif
check: $(DEF_FILES) # For check-symbols.sh
CLEANFILES += $(DEF_FILES)
harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
$(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
harfbuzz-subset.def: $(HB_SUBSET_headers)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
$(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
harfbuzz-icu.def: $(HB_ICU_headers)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
$(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
harfbuzz-gobject.def: $(HB_GOBJECT_headers)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py "$@"
$(AM_V_GEN) $(srcdir)/gen-def.py "$@" $^
GENERATORS = \
......
......@@ -4,8 +4,14 @@ from __future__ import print_function, division, absolute_import
import io, os, re, sys
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:]
headers_content = []
for h in os.environ["headers"].split (' '):
for h in header_paths:
if h.endswith (".h"):
with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ())
......@@ -13,7 +19,7 @@ result = """EXPORTS
%s
LIBRARY lib%s-0.dll""" % (
"\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))),
sys.argv[1].replace ('.def', '')
output_file.replace ('.def', '')
)
with open (sys.argv[1], "w") as f: f.write (result)
with open (output_file, "w") as f: f.write (result)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册