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.
This commit is contained in:
Behdad Esfahbod 2018-02-23 13:19:34 -08:00 committed by Ebrahim Byagowi
parent b1ec821051
commit e0939d811f
7 changed files with 82 additions and 95 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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@.*/@@'`
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

View File

@ -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`"
prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
# On macOS, C symbols are prefixed with _
if test $suffix = dylib; then prefix="_$prefix"; fi
symprefix=
if test $suffix = dylib; then symprefix=_; fi
echo "Processing $so"
EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v " $symprefix\\($IGNORED_SYMBOLS\\>\\)" | cut -d' ' -f3 | c++filt`"
prefix=$symprefix`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
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

View File

@ -42,7 +42,8 @@ HB_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN value-header ***/
HB_EXTERN GType @enum_name@_get_type (void) G_GNUC_CONST;
HB_EXTERN GType
@enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/

View File

@ -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 ())