From a9b650d38407f6f2a26d8386e801600b1004d5d6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Mon, 12 Feb 2018 15:10:13 +0330 Subject: [PATCH] Apply check-defs.sh to -icu and -subset, toward mingw fix (#780) --- CMakeLists.txt | 11 ++++++++--- src/Makefile.am | 21 ++++++++++++++++----- src/check-defs.sh | 12 +++++------- src/gen-def.py | 9 ++++++--- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1f2e087f..d23fc2dff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 44df74653..48e633200 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/check-defs.sh b/src/check-defs.sh index adb90a72b..71c909714 100755 --- a/src/check-defs.sh +++ b/src/check-defs.sh @@ -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 diff --git a/src/gen-def.py b/src/gen-def.py index ad1606ec3..1673537c9 100755 --- a/src/gen-def.py +++ b/src/gen-def.py @@ -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)