[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Feb 23 21:50:12 UTC 2018


 CMakeLists.txt              |    3 --
 src/Makefile.am             |   33 ++++++++++++++++-----------
 src/Makefile.sources        |    9 +++++--
 src/check-defs.sh           |   52 --------------------------------------------
 src/check-symbols.sh        |   30 +++++++++++++++++++------
 src/hb-gobject-enums.h.tmpl |    3 +-
 src/hb-gobject-structs.h    |   45 +++++++++++++++++++++++++-------------
 7 files changed, 81 insertions(+), 94 deletions(-)

New commits:
commit e0939d811f1fdeda9c5763e7e53887b3d3cb21eb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Feb 23 13:19:34 2018 -0800

    Clean up check-defs and check-symbols (#821)
    
    Also, call c++filt on their results.
    
    Also build and fix and check harfbuzz-gobject.def
    
    Also changes harfbuzz-gobject to distribute generated enum sources.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c19a4b9..6b4e1089 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -836,10 +836,9 @@ if (UNIX OR MINGW)
     )
     add_test(NAME check-libstdc++.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-libstdc++.sh)
     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
+      check-static-inits.sh check-libstdc++.sh check-symbols.sh
       PROPERTIES
         ENVIRONMENT "libs=.;srcdir=${PROJECT_SOURCE_DIR}/src"
         SKIP_RETURN_CODE 77)
diff --git a/src/Makefile.am b/src/Makefile.am
index aba6803c..769a8252 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -125,10 +125,12 @@ 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
+export_symbols_icu = -export-symbols harfbuzz-icu.def
+harfbuzz_icu_def_dependency = harfbuzz-icu.def
+export_symbols_gobject = -export-symbols harfbuzz-gobject.def
+harfbuzz_gobject_def_dependency = harfbuzz-gobject.def
 chosen_linker = $(CXXLINK)
 else
 if WITH_LIBSTDCXX
@@ -210,13 +212,14 @@ EXTRA_DIST += harfbuzz-icu.pc.in
 if HAVE_GOBJECT
 lib_LTLIBRARIES += libharfbuzz-gobject.la
 libharfbuzz_gobject_la_LINK = $(chosen_linker) $(libharfbuzz_gobject_la_LDFLAGS)
-libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_sources)
-nodist_libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_ENUM_sources)
+libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_DIST_sources)
+nodist_libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_NODIST_sources)
 libharfbuzz_gobject_la_CPPFLAGS = $(HBCFLAGS) $(HBNOLIBCXXFLAGS) $(GOBJECT_CFLAGS)
 libharfbuzz_gobject_la_LDFLAGS = $(base_link_flags)
 libharfbuzz_gobject_la_LIBADD = $(GOBJECT_LIBS) libharfbuzz.la
-pkginclude_HEADERS += $(HB_GOBJECT_headers)
-nodist_pkginclude_HEADERS += $(HB_GOBJECT_ENUM_headers)
+EXTRA_libharfbuzz_gobject_la_DEPENDENCIES = $(harfbuzz_gobject_def_dependency)
+pkginclude_HEADERS += $(HB_GOBJECT_DIST_headers)
+nodist_pkginclude_HEADERS += $(HB_GOBJECT_NODIST_headers)
 pkgconfig_DATA += harfbuzz-gobject.pc
 
 BUILT_SOURCES += \
@@ -256,12 +259,19 @@ EXTRA_DIST += \
 CLEANFILES += $(pkgconfig_DATA)
 
 
-CLEANFILES += harfbuzz.def harfbuzz-icu.def harfbuzz-subset.def
+DEF_FILES = harfbuzz.def harfbuzz-subset.def harfbuzz-icu.def
+if HAVE_GOBJECT
+DEF_FILES += harfbuzz-gobject.def
+endif
+check: $(DEF_FILES) # For check-symbols.sh
+CLEANFILES += $(DEF_FILES)
 harfbuzz.def: $(HBHEADERS) $(HBNODISTHEADERS)
 	$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
+harfbuzz-subset.def: $(HB_SUBSET_headers)
+	$(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)
+harfbuzz-gobject.def: $(HB_GOBJECT_headers)
 	$(AM_V_GEN) headers="$^" $(srcdir)/gen-def.py $@
 
 
@@ -335,11 +345,8 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
 test_buffer_serialize_CPPFLAGS = $(HBCFLAGS)
 test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS)
 
-check: harfbuzz.def harfbuzz-icu.def harfbuzz-subset.def # For check-defs.sh
-
 dist_check_SCRIPTS = \
 	check-c-linkage-decls.sh \
-	check-defs.sh \
 	check-externs.sh \
 	check-header-guards.sh \
 	check-includes.sh \
@@ -415,10 +422,8 @@ HarfBuzz_0_0_gir_FILES = \
 	$(HBHEADERS) \
 	$(HBNODISTHEADERS) \
 	$(HBSOURCES) \
-	$(HB_GOBJECT_ENUM_sources) \
-	$(HB_GOBJECT_ENUM_headers) \
 	$(HB_GOBJECT_sources) \
-	$(HB_GOBJECT_STRUCTS_headers) \
+	$(HB_GOBJECT_headers) \
 	$(NULL)
 
 girdir = $(datadir)/gir-1.0
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 416ee44f..2bb56b4f 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -201,8 +201,11 @@ HB_SUBSET_headers = \
 	hb-subset-private.hh \
 	$(NULL)
 
-HB_GOBJECT_sources = hb-gobject-structs.cc
-HB_GOBJECT_STRUCTS_headers = hb-gobject-structs.h
-HB_GOBJECT_headers = hb-gobject.h $(HB_GOBJECT_STRUCTS_headers)
+HB_GOBJECT_DIST_sources = hb-gobject-structs.cc
+HB_GOBJECT_DIST_headers = hb-gobject.h hb-gobject-structs.h
 HB_GOBJECT_ENUM_sources = hb-gobject-enums.cc
 HB_GOBJECT_ENUM_headers = hb-gobject-enums.h
+HB_GOBJECT_NODIST_sources = $(HB_GOBJECT_ENUM_sources)
+HB_GOBJECT_NODIST_headers = $(HB_GOBJECT_ENUM_headers)
+HB_GOBJECT_sources = $(HB_GOBJECT_DIST_sources) $(HB_GOBJECT_NODIST_sources)
+HB_GOBJECT_headers = $(HB_GOBJECT_DIST_headers) $(HB_GOBJECT_NODIST_headers)
diff --git a/src/check-defs.sh b/src/check-defs.sh
deleted file mode 100755
index ade59357..00000000
--- a/src/check-defs.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-
-LC_ALL=C
-export LC_ALL
-
-test -z "$srcdir" && srcdir=.
-test -z "$libs" && libs=.libs
-stat=0
-
-if which nm 2>/dev/null >/dev/null; then
-	:
-else
-	echo "check-defs.sh: 'nm' not found; skipping test"
-	exit 77
-fi
-
-tested=false
-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 it"
-		continue
-	fi
-	lib=`echo "$def" | sed 's/[.]def$//;s at .*/@@'`
-	for suffix in so dylib; do
-		so=$libs/lib${lib}.$suffix
-		if ! test -f "$so"; then continue; fi
-
-		# On macOS, C symbols are prefixed with _
-		if test $suffix = dylib; then prefix="_"; fi
-
-		EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v " $prefix"'\(_fini\>\|_init\>\|_fdata\>\|_ftext\>\|_fbss\>\|__bss_start\>\|__bss_start__\>\|__bss_end__\>\|_edata\>\|_end\>\|_bss_end__\>\|__end__\>\|__gcov_flush\>\|llvm_\)' | cut -d' ' -f3`"
-
-		if test -f "$so"; then
-
-			echo "Checking that $so has the same symbol list as $def"
-			{
-				echo EXPORTS
-				echo "$EXPORTED_SYMBOLS" | sed -e "s/^${prefix}hb/hb/g"
-				# cheat: copy the last line from the def file!
-				tail -n1 "$def"
-			} | diff "$def" - >&2 || stat=1
-
-			tested=true
-		fi
-	done
-done
-if ! $tested; then
-	echo "check-defs.sh: libharfbuzz shared library not found; skipping test"
-	exit 77
-fi
-
-exit $stat
diff --git a/src/check-symbols.sh b/src/check-symbols.sh
index af8af441..bfc93b34 100755
--- a/src/check-symbols.sh
+++ b/src/check-symbols.sh
@@ -7,6 +7,7 @@ test -z "$srcdir" && srcdir=.
 test -z "$libs" && libs=.libs
 stat=0
 
+IGNORED_SYMBOLS='_fini\|_init\|_fdata\|_ftext\|_fbss\|__bss_start\|__bss_start__\|__bss_end__\|_edata\|_end\|_bss_end__\|__end__\|__gcov_flush\|llvm_.*'
 
 if which nm 2>/dev/null >/dev/null; then
 	:
@@ -15,31 +16,46 @@ else
 	exit 77
 fi
 
-echo "Checking that we are not exposing internal symbols"
 tested=false
 for soname in harfbuzz harfbuzz-subset harfbuzz-icu harfbuzz-gobject; do
 	for suffix in so dylib; do
 		so=$libs/lib$soname.$suffix
 		if ! test -f "$so"; then continue; fi
 
-		EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| ___gcov_flush\>\| llvm_\| _llvm_' | cut -d' ' -f3`"
+		# On macOS, C symbols are prefixed with _
+		symprefix=
+		if test $suffix = dylib; then symprefix=_; fi
 
-		prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
+		EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v " $symprefix\\($IGNORED_SYMBOLS\\>\\)" | cut -d' ' -f3 | c++filt`"
 
-		# On macOS, C symbols are prefixed with _
-		if test $suffix = dylib; then prefix="_$prefix"; fi
+		prefix=$symprefix`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
 
-		echo "Processing $so"
+		echo
+		echo "Checking that $so does not expose internal symbols"
 		if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}\(_\|$\)"; then
 			echo "Ouch, internal symbols exposed"
 			stat=1
 		fi
 
+		def=$soname.def
+		if ! test -f "$def"; then
+			echo "'$def' not found; skipping"
+		else
+			echo
+			echo "Checking that $so has the same symbol list as $def"
+			{
+				echo EXPORTS
+				echo "$EXPORTED_SYMBOLS" | sed -e "s/^${symprefix}hb/hb/g"
+				# cheat: copy the last line from the def file!
+				tail -n1 "$def"
+			} | c++filt | diff "$def" - >&2 || stat=1
+		fi
+
 		tested=true
 	done
 done
 if ! $tested; then
-	echo "check-symbols.sh: no shared library found; skipping test"
+	echo "check-symbols.sh: no shared libraries found; skipping test"
 	exit 77
 fi
 
diff --git a/src/hb-gobject-enums.h.tmpl b/src/hb-gobject-enums.h.tmpl
index e28510c2..606727cd 100644
--- a/src/hb-gobject-enums.h.tmpl
+++ b/src/hb-gobject-enums.h.tmpl
@@ -42,7 +42,8 @@ HB_BEGIN_DECLS
 /*** END file-header ***/
 
 /*** BEGIN value-header ***/
-HB_EXTERN GType @enum_name at _get_type (void) G_GNUC_CONST;
+HB_EXTERN GType
+ at enum_name@_get_type (void) G_GNUC_CONST;
 #define @ENUMPREFIX at _TYPE_@ENUMSHORT@ (@enum_name at _get_type ())
 
 /*** END value-header ***/
diff --git a/src/hb-gobject-structs.h b/src/hb-gobject-structs.h
index a34b06ab..302dc958 100644
--- a/src/hb-gobject-structs.h
+++ b/src/hb-gobject-structs.h
@@ -45,7 +45,8 @@ HB_BEGIN_DECLS
  *
  * Since: 0.9.2
  **/
-HB_EXTERN GType hb_gobject_blob_get_type (void);
+HB_EXTERN GType
+hb_gobject_blob_get_type (void);
 #define HB_GOBJECT_TYPE_BLOB (hb_gobject_blob_get_type ())
 
 /**
@@ -53,7 +54,8 @@ HB_EXTERN GType hb_gobject_blob_get_type (void);
  *
  * Since: 0.9.2
  **/
-HB_EXTERN GType hb_gobject_buffer_get_type (void);
+HB_EXTERN GType
+hb_gobject_buffer_get_type (void);
 #define HB_GOBJECT_TYPE_BUFFER (hb_gobject_buffer_get_type ())
 
 /**
@@ -61,7 +63,8 @@ HB_EXTERN GType hb_gobject_buffer_get_type (void);
  *
  * Since: 0.9.2
  **/
-HB_EXTERN GType hb_gobject_face_get_type (void);
+HB_EXTERN GType
+hb_gobject_face_get_type (void);
 #define HB_GOBJECT_TYPE_FACE (hb_gobject_face_get_type ())
 
 /**
@@ -69,7 +72,8 @@ HB_EXTERN GType hb_gobject_face_get_type (void);
  *
  * Since: 0.9.2
  **/
-HB_EXTERN GType hb_gobject_font_get_type (void);
+HB_EXTERN GType
+hb_gobject_font_get_type (void);
 #define HB_GOBJECT_TYPE_FONT (hb_gobject_font_get_type ())
 
 /**
@@ -77,13 +81,16 @@ HB_EXTERN GType hb_gobject_font_get_type (void);
  *
  * Since: 0.9.2
  **/
-HB_EXTERN GType hb_gobject_font_funcs_get_type (void);
+HB_EXTERN GType
+hb_gobject_font_funcs_get_type (void);
 #define HB_GOBJECT_TYPE_FONT_FUNCS (hb_gobject_font_funcs_get_type ())
 
-HB_EXTERN GType hb_gobject_set_get_type (void);
+HB_EXTERN GType
+hb_gobject_set_get_type (void);
 #define HB_GOBJECT_TYPE_SET (hb_gobject_set_get_type ())
 
-HB_EXTERN GType hb_gobject_shape_plan_get_type (void);
+HB_EXTERN GType
+hb_gobject_shape_plan_get_type (void);
 #define HB_GOBJECT_TYPE_SHAPE_PLAN (hb_gobject_shape_plan_get_type ())
 
 /**
@@ -91,30 +98,38 @@ HB_EXTERN GType hb_gobject_shape_plan_get_type (void);
  *
  * Since: 0.9.2
  **/
-HB_EXTERN GType hb_gobject_unicode_funcs_get_type (void);
+HB_EXTERN GType
+hb_gobject_unicode_funcs_get_type (void);
 #define HB_GOBJECT_TYPE_UNICODE_FUNCS (hb_gobject_unicode_funcs_get_type ())
 
 /* Value types */
 
-HB_EXTERN GType hb_gobject_feature_get_type (void);
+HB_EXTERN GType
+hb_gobject_feature_get_type (void);
 #define HB_GOBJECT_TYPE_FEATURE (hb_gobject_feature_get_type ())
 
-HB_EXTERN GType hb_gobject_glyph_info_get_type (void);
+HB_EXTERN GType
+hb_gobject_glyph_info_get_type (void);
 #define HB_GOBJECT_TYPE_GLYPH_INFO (hb_gobject_glyph_info_get_type ())
 
-HB_EXTERN GType hb_gobject_glyph_position_get_type (void);
+HB_EXTERN GType
+hb_gobject_glyph_position_get_type (void);
 #define HB_GOBJECT_TYPE_GLYPH_POSITION (hb_gobject_glyph_position_get_type ())
 
-HB_EXTERN GType hb_gobject_segment_properties_get_type (void);
+HB_EXTERN GType
+hb_gobject_segment_properties_get_type (void);
 #define HB_GOBJECT_TYPE_SEGMENT_PROPERTIES (hb_gobject_segment_properties_get_type ())
 
-HB_EXTERN GType hb_gobject_user_data_key_get_type (void);
+HB_EXTERN GType
+hb_gobject_user_data_key_get_type (void);
 #define HB_GOBJECT_TYPE_USER_DATA_KEY (hb_gobject_user_data_key_get_type ())
 
-HB_EXTERN GType hb_gobject_ot_math_glyph_variant_get_type (void);
+HB_EXTERN GType
+hb_gobject_ot_math_glyph_variant_get_type (void);
 #define HB_GOBJECT_TYPE_OT_MATH_GLYPH_VARIANT (hb_gobject_ot_math_glyph_variant_get_type ())
 
-HB_EXTERN GType hb_gobject_ot_math_glyph_part_get_type (void);
+HB_EXTERN GType
+hb_gobject_ot_math_glyph_part_get_type (void);
 #define HB_GOBJECT_TYPE_OT_MATH_GLYPH_PART (hb_gobject_ot_math_glyph_part_get_type ())
 
 


More information about the HarfBuzz mailing list