[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Feb 10 20:07:00 UTC 2018


 CMakeLists.txt          |    6 ++----
 src/Makefile.am         |    3 +++
 src/check-defs.sh       |    2 +-
 src/check-libstdc++.sh  |   20 +++++++++++---------
 src/check-symbols.sh    |   28 +++++++++++++++-------------
 src/hb-subset-glyf.cc   |    8 ++++----
 src/hb-subset-glyf.hh   |    4 ++--
 src/hb-subset-plan.cc   |    4 ++--
 src/hb-subset-plan.hh   |   10 +++++-----
 src/hb-subset.cc        |    5 ++---
 src/hb-subset.h         |    2 +-
 src/hb-ucdn/Makefile.am |   11 +++++++++++
 12 files changed, 59 insertions(+), 44 deletions(-)

New commits:
commit bfa871634ce9ef9f4ed18348d898686952d6cbe3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Feb 10 13:37:28 2018 -0600

    Minor

diff --git a/src/hb-subset-glyf.hh b/src/hb-subset-glyf.hh
index 8855f8d0..491bf82b 100644
--- a/src/hb-subset-glyf.hh
+++ b/src/hb-subset-glyf.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2018  Google
+ * Copyright © 2018  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh
index 0a156fcc..3943e65b 100644
--- a/src/hb-subset-plan.hh
+++ b/src/hb-subset-plan.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2018  Google
+ * Copyright © 2018  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 9742be4b..977de47d 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -1,6 +1,5 @@
 /*
- * Copyright © 2009  Red Hat, Inc.
- * Copyright © 2012  Google, Inc.
+ * Copyright © 2018  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
diff --git a/src/hb-subset.h b/src/hb-subset.h
index 2b8d55a2..3eb41de8 100644
--- a/src/hb-subset.h
+++ b/src/hb-subset.h
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2018  Google
+ * Copyright © 2018  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
commit 844f48ea9a72d28e2c088497f6c403c54e1751a8
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Sat Feb 10 23:13:12 2018 +0330

    Fix symbol exporting and libstdc++ linkage of hb-subset (#769)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c21a4291..d1f2e087 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -544,17 +544,15 @@ if (UNIX OR MINGW)
   # Make symbols link locally
   link_libraries(-Bsymbolic-functions)
 
-  # Make sure we don't link to libstdc++
   if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+    # Make sure we don't link to libstdc++
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
     set (CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "m") # libm
     set (CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
     set_target_properties(harfbuzz PROPERTIES LINKER_LANGUAGE C)
     set_target_properties(harfbuzz-subset PROPERTIES LINKER_LANGUAGE C)
-  endif ()
 
-  # No threadsafe statics as we do it ourselves
-  if (BUILD_SHARED_LIBS)
+    # No threadsafe statics as we do it ourselves
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics")
   endif ()
 endif ()
diff --git a/src/Makefile.am b/src/Makefile.am
index 500730d4..88862832 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -136,6 +136,7 @@ pkgconfig_DATA = harfbuzz.pc
 EXTRA_DIST += harfbuzz.pc.in
 
 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)
@@ -172,6 +173,7 @@ HBSOURCES += $(HB_ICU_sources)
 HBHEADERS += $(HB_ICU_headers)
 else
 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)
@@ -184,6 +186,7 @@ EXTRA_DIST += harfbuzz-icu.pc.in
 
 if HAVE_GOBJECT
 lib_LTLIBRARIES += libharfbuzz-gobject.la
+libharfbuzz_gobject_la_LINK = $(libharfbuzz_la_LINK)
 libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_sources)
 nodist_libharfbuzz_gobject_la_SOURCES = $(HB_GOBJECT_ENUM_sources)
 libharfbuzz_gobject_la_CPPFLAGS = $(libharfbuzz_la_CPPFLAGS) $(GOBJECT_CFLAGS)
diff --git a/src/check-defs.sh b/src/check-defs.sh
index c6697831..adb90a72 100755
--- a/src/check-defs.sh
+++ b/src/check-defs.sh
@@ -27,7 +27,7 @@ for def in $defs; do
 		so=$libs/lib${lib}.$suffix
 		if ! test -f "$so"; then continue; fi
 
-		# On mac, C symbols are prefixed with _
+		# 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`"
diff --git a/src/check-libstdc++.sh b/src/check-libstdc++.sh
index e4aaeb2b..653a5660 100755
--- a/src/check-libstdc++.sh
+++ b/src/check-libstdc++.sh
@@ -21,16 +21,18 @@ else
 fi
 
 tested=false
-for suffix in so dylib; do
-	so=$libs/libharfbuzz.$suffix
-	if ! test -f "$so"; then continue; fi
+for soname in harfbuzz harfbuzz-icu harfbuzz-subset; do
+	for suffix in so dylib; do
+		so=$libs/lib$soname.$suffix
+		if ! test -f "$so"; then continue; fi
 
-	echo "Checking that we are not linking to libstdc++ or libc++"
-	if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then
-		echo "Ouch, linked to libstdc++ or libc++"
-		stat=1
-	fi
-	tested=true
+		echo "Checking that we are not linking to libstdc++ or libc++"
+		if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then
+			echo "Ouch, linked to libstdc++ or libc++"
+			stat=1
+		fi
+		tested=true
+	done
 done
 if ! $tested; then
 	echo "check-libstdc++.sh: libharfbuzz shared library not found; skipping test"
diff --git a/src/check-symbols.sh b/src/check-symbols.sh
index 3adf65f8..59b7439a 100755
--- a/src/check-symbols.sh
+++ b/src/check-symbols.sh
@@ -17,24 +17,26 @@ fi
 
 echo "Checking that we are not exposing internal symbols"
 tested=false
-for suffix in so dylib; do
-	so=$libs/libharfbuzz.$suffix
-	if ! test -f "$so"; then continue; fi
+for soname in harfbuzz harfbuzz-icu harfbuzz-subset; 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`"
+		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/[.].*//'`
+		prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
 
-	# On mac, C symbols are prefixed with _
-	if test $suffix = dylib; then prefix="_$prefix"; fi
+		# On macOS, C symbols are prefixed with _
+		if test $suffix = dylib; then prefix="_$prefix"; fi
 
-	echo "Processing $so"
-	if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}_"; then
-		echo "Ouch, internal symbols exposed"
-		stat=1
-	fi
+		echo "Processing $so"
+		if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}\(_\|$\)"; then
+			echo "Ouch, internal symbols exposed"
+			stat=1
+		fi
 
-	tested=true
+		tested=true
+	done
 done
 if ! $tested; then
 	echo "check-symbols.sh: no shared library found; skipping test"
diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc
index b0f44e2c..e4f55728 100644
--- a/src/hb-subset-glyf.cc
+++ b/src/hb-subset-glyf.cc
@@ -29,7 +29,7 @@
 #include "hb-set.h"
 #include "hb-subset-glyf.hh"
 
-bool
+HB_INTERNAL bool
 _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf,
                                      hb_auto_array_t<unsigned int> &glyph_ids,
                                      bool *use_short_loca, /* OUT */
@@ -63,7 +63,7 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf,
   return true;
 }
 
-void
+HB_INTERNAL void
 _write_loca_entry (unsigned int id, unsigned int offset, bool is_short, void *loca_prime) {
   if (is_short) {
     ((OT::HBUINT16*) loca_prime) [id].set (offset / 2);
@@ -72,7 +72,7 @@ _write_loca_entry (unsigned int id, unsigned int offset, bool is_short, void *lo
   }
 }
 
-bool
+HB_INTERNAL bool
 _write_glyf_and_loca_prime (const OT::glyf::accelerator_t &glyf,
                             const char                    *glyf_data,
                             hb_auto_array_t<unsigned int> &glyph_ids,
@@ -110,7 +110,7 @@ _write_glyf_and_loca_prime (const OT::glyf::accelerator_t &glyf,
   return true;
 }
 
-bool
+HB_INTERNAL bool
 _hb_subset_glyf_and_loca (const OT::glyf::accelerator_t  &glyf,
                           const char                     *glyf_data,
                           hb_auto_array_t<unsigned int>  &glyphs_to_retain,
diff --git a/src/hb-subset-glyf.hh b/src/hb-subset-glyf.hh
index dbdd3410..8855f8d0 100644
--- a/src/hb-subset-glyf.hh
+++ b/src/hb-subset-glyf.hh
@@ -31,7 +31,7 @@
 
 #include "hb-subset-plan.hh"
 
-bool
+HB_INTERNAL bool
 hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
                          hb_face_t        *face,
                          bool             *use_short_loca, /* OUT */
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index fb8913e8..247df5c6 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -49,7 +49,7 @@ hb_subset_plan_new_gid_for_old_id (hb_subset_plan_t *plan,
   return false;
 }
 
-void
+HB_INTERNAL void
 _populate_codepoints (hb_set_t *input_codepoints,
                       hb_auto_array_t<hb_codepoint_t>& plan_codepoints)
 {
@@ -62,7 +62,7 @@ _populate_codepoints (hb_set_t *input_codepoints,
   plan_codepoints.qsort (_hb_codepoint_t_cmp);
 }
 
-void
+HB_INTERNAL void
 _populate_gids_to_retain (hb_face_t *face,
                           hb_auto_array_t<hb_codepoint_t>& codepoints,
                           hb_auto_array_t<hb_codepoint_t>& old_gids,
diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh
index e1c3bd3e..0a156fcc 100644
--- a/src/hb-subset-plan.hh
+++ b/src/hb-subset-plan.hh
@@ -45,20 +45,20 @@ struct hb_subset_plan_t {
 
 typedef struct hb_subset_plan_t hb_subset_plan_t;
 
-hb_subset_plan_t *
+HB_INTERNAL hb_subset_plan_t *
 hb_subset_plan_create (hb_face_t           *face,
                        hb_subset_profile_t *profile,
                        hb_subset_input_t   *input);
 
-hb_bool_t
+HB_INTERNAL hb_bool_t
 hb_subset_plan_new_gid_for_old_id(hb_subset_plan_t *plan,
                                   hb_codepoint_t old_gid,
                                   hb_codepoint_t *new_gid /* OUT */);
 
-hb_subset_plan_t *
+HB_INTERNAL hb_subset_plan_t *
 hb_subset_plan_get_empty ();
 
-void
+HB_INTERNAL void
 hb_subset_plan_destroy (hb_subset_plan_t *plan);
 
 #endif /* HB_SUBSET_PLAN_HH */
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 8e1f8198..9742be4b 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -108,7 +108,7 @@ hb_subset_input_destroy(hb_subset_input_t *subset_input)
 }
 
 template<typename TableType>
-hb_blob_t *
+HB_INTERNAL hb_blob_t *
 _subset (hb_subset_plan_t *plan, hb_face_t *source)
 {
     OT::Sanitizer<TableType> sanitizer;
diff --git a/src/hb-ucdn/Makefile.am b/src/hb-ucdn/Makefile.am
index 73b55025..7283ca05 100644
--- a/src/hb-ucdn/Makefile.am
+++ b/src/hb-ucdn/Makefile.am
@@ -4,6 +4,17 @@ noinst_LTLIBRARIES = libhb-ucdn.la
 
 include Makefile.sources
 
+if OS_WIN32
+libhb_ucdn_la_LINK = $(CXXLINK)
+else
+# Use a C linker for GCC, not C++; Don't link to libstdc++
+if HAVE_GCC
+libhb_ucdn_la_LINK = $(LINK)
+else
+libhb_ucdn_la_LINK = $(CXXLINK)
+endif
+endif
+
 libhb_ucdn_la_SOURCES = $(LIBHB_UCDN_sources)
 libhb_ucdn_la_CPPFLAGS = \
 	-I$(top_srcdir) \


More information about the HarfBuzz mailing list