Apply check-defs.sh to -icu and -subset, toward mingw fix (#780)

This commit is contained in:
Ebrahim Byagowi 2018-02-12 15:10:13 +03:30 committed by GitHub
parent 2efc896550
commit a9b650d384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 18 deletions

View File

@ -836,8 +836,11 @@ if (UNIX OR MINGW)
add_test(NAME check-symbols.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-symbols.sh)
add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.sh)
set_tests_properties(check-static-inits.sh check-libstdc++.sh check-symbols.sh check-defs.sh
PROPERTIES ENVIRONMENT "libs=.;srcdir=${PROJECT_SOURCE_DIR}/src")
set_tests_properties(
check-static-inits.sh check-libstdc++.sh check-symbols.sh check-defs.sh
PROPERTIES
ENVIRONMENT "libs=.;srcdir=${PROJECT_SOURCE_DIR}/src"
SKIP_RETURN_CODE 77)
endif ()
add_test(NAME check-c-linkage-decls.sh COMMAND ./check-c-linkage-decls.sh)
@ -846,7 +849,9 @@ if (UNIX OR MINGW)
add_test(NAME check-includes.sh COMMAND ./check-includes.sh)
set_tests_properties(
check-c-linkage-decls.sh check-header-guards.sh check-externs.sh check-includes.sh
PROPERTIES WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
PROPERTIES
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
SKIP_RETURN_CODE 77)
endif ()
# Needs to come last so that variables defined above are passed to

View File

@ -122,6 +122,10 @@ HBLIBS += $(HBNONPCLIBS)
if OS_WIN32
export_symbols = -export-symbols harfbuzz.def
harfbuzz_def_dependency = harfbuzz.def
export_symbols_icu = -export-symbols harfbuzz-icu.def
harfbuzz_icu_def_dependency = harfbuzz-icu.def
export_symbols_subset = -export-symbols harfbuzz-subset.def
harfbuzz_subset_def_dependency = harfbuzz-subset.def
libharfbuzz_la_LINK = $(CXXLINK) $(libharfbuzz_la_LDFLAGS)
else
if WITHSTDCPP
@ -136,9 +140,10 @@ endif
endif
endif
base_link_flags = $(AM_LDFLAGS) -lm -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined
libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS) $(HBNODISTHEADERS)
libharfbuzz_la_CPPFLAGS = $(HBCFLAGS)
libharfbuzz_la_LDFLAGS = $(AM_LDFLAGS) -lm -version-info $(HB_LIBTOOL_VERSION_INFO) $(export_symbols) -no-undefined
libharfbuzz_la_LDFLAGS = $(base_link_flags) $(export_symbols)
libharfbuzz_la_LIBADD = $(HBLIBS)
EXTRA_libharfbuzz_la_DEPENDENCIES = $(harfbuzz_def_dependency)
pkginclude_HEADERS = $(HBHEADERS)
@ -151,8 +156,9 @@ lib_LTLIBRARIES += libharfbuzz-subset.la
libharfbuzz_subset_la_LINK = $(libharfbuzz_la_LINK)
libharfbuzz_subset_la_SOURCES = $(HB_SUBSET_sources)
libharfbuzz_subset_la_CPPFLAGS = $(libharfbuzz_la_CPPFLAGS)
libharfbuzz_subset_la_LDFLAGS = $(libharfbuzz_la_LDFLAGS)
libharfbuzz_subset_la_LDFLAGS = $(base_link_flags) $(export_symbols_subset)
libharfbuzz_subset_la_LIBADD = libharfbuzz.la
EXTRA_libharfbuzz_subset_la_DEPENDENCIES = $(harfbuzz_subset_def_dependency)
pkginclude_HEADERS += $(HB_SUBSET_headers)
pkgconfig_DATA += harfbuzz-subset.pc
EXTRA_DIST += harfbuzz-subset.pc.in
@ -188,8 +194,9 @@ lib_LTLIBRARIES += libharfbuzz-icu.la
libharfbuzz_icu_la_LINK = $(libharfbuzz_la_LINK)
libharfbuzz_icu_la_SOURCES = $(HB_ICU_sources)
libharfbuzz_icu_la_CPPFLAGS = $(libharfbuzz_la_CPPFLAGS) $(ICU_CFLAGS)
libharfbuzz_icu_la_LDFLAGS = $(libharfbuzz_la_LDFLAGS)
libharfbuzz_icu_la_LDFLAGS = $(base_link_flags) $(export_symbols_icu)
libharfbuzz_icu_la_LIBADD = $(ICU_LIBS) libharfbuzz.la
EXTRA_libharfbuzz_icu_la_DEPENDENCIES = $(harfbuzz_icu_def_dependency)
pkginclude_HEADERS += $(HB_ICU_headers)
pkgconfig_DATA += harfbuzz-icu.pc
endif
@ -245,9 +252,13 @@ EXTRA_DIST += \
CLEANFILES += $(pkgconfig_DATA)
CLEANFILES += harfbuzz.def
CLEANFILES += harfbuzz.def harfbuzz-icu.def harfbuzz-subset.def
harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
harfbuzz-icu.def: $(HB_ICU_headers)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
harfbuzz-subset.def: $(HB_SUBSET_headers)
$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
GENERATORS = \
@ -319,7 +330,7 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
test_buffer_serialize_CPPFLAGS = $(HBCFLAGS)
test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS)
check: harfbuzz.def # For check-defs.sh
check: harfbuzz.def harfbuzz-icu.def harfbuzz-subset.def # For check-defs.sh
dist_check_SCRIPTS = \
check-c-linkage-decls.sh \

View File

@ -14,14 +14,12 @@ else
exit 77
fi
defs="harfbuzz.def"
if ! test -f "$defs"; then
echo "check-defs.sh: '$defs' not found; skipping test"
exit 77
fi
tested=false
for def in $defs; do
for def in harfbuzz.def harfbuzz-icu.def harfbuzz-subset.def; do
if ! test -f "$def"; then
echo "check-defs.sh: '$def' not found; skipping test"
exit 77
fi
lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'`
for suffix in so dylib; do
so=$libs/lib${lib}.$suffix

View File

@ -9,8 +9,11 @@ for h in os.environ["headers"].split (' '):
if h.endswith (".h"):
with io.open(h, encoding='utf8') as f: headers_content.append (f.read ())
result = ("EXPORTS\n" +
"\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))) +
"\nLIBRARY libharfbuzz-0.dll")
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', '')
)
with open (sys.argv[1], "w") as f: f.write (result)