[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Dec 18 07:37:38 UTC 2016


 configure.ac            |    2 +-
 src/hb-glib.cc          |    2 ++
 src/hb-glib.h           |    3 ++-
 test/api/test-ot-math.c |    4 ++++
 4 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 1c98ff87c76536553e53c131e75aba33033ee3a0
Author: Mike Hommey <mh at glandium.org>
Date:   Fri Sep 30 18:15:37 2016 +0900

    Support building with older glib versions
    
    It is desirable to be able to build against older versions of glib.
    
    fd7a245 changed the configure check to require glib > 2.38 for
    G_TEST_DIST. Before that, version 2.16 was required, but in fact,
    since aafe395, G_PASTE is being used, which was introduced in 2.19.1.
    And since 0ef179e2, hb-glib uses GBytes, which were introduced in
    2.31.10.
    
    2.19.1 is rather old, but 2.38 is rather new. For Firefox, building
    against 2.22 is still supported, although we could probably get away
    with bumping that to 2.28. Either way, GBytes is not available.
    
    Arguably, if you build against a glib that doesn't support GBytes,
    you're not going to use the hb_glib_blob_create function, so we hide
    the function when building against such a glib.
    
    As for G_TEST_DIST, when building against versions of glib that don't
    support it, we can fallback to the previous behavior, which, AIUI, was
    just making the test not work when building in a separate directory.

diff --git a/configure.ac b/configure.ac
index 6948aa6..f985e10 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,7 @@ AC_ARG_WITH(glib,
 			[Use glib @<:@default=auto@:>@])],,
 	[with_glib=auto])
 have_glib=false
-GLIB_DEPS="glib-2.0 >= 2.38"
+GLIB_DEPS="glib-2.0 >= 2.19.1"
 AC_SUBST(GLIB_DEPS)
 if test "x$with_glib" = "xyes" -o "x$with_glib" = "xauto"; then
 	PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)
diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index e203524..2b91b5b 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -382,6 +382,7 @@ hb_glib_get_unicode_funcs (void)
   return const_cast<hb_unicode_funcs_t *> (&_hb_glib_unicode_funcs);
 }
 
+#if GLIB_CHECK_VERSION(2,31,10)
 /**
  * hb_glib_blob_create:
  *
@@ -398,3 +399,4 @@ hb_glib_blob_create (GBytes *gbytes)
 			 g_bytes_ref (gbytes),
 			 (hb_destroy_func_t) g_bytes_unref);
 }
+#endif
diff --git a/src/hb-glib.h b/src/hb-glib.h
index 12c3e3b..5f04183 100644
--- a/src/hb-glib.h
+++ b/src/hb-glib.h
@@ -46,9 +46,10 @@ hb_glib_script_from_script (hb_script_t script);
 HB_EXTERN hb_unicode_funcs_t *
 hb_glib_get_unicode_funcs (void);
 
+#if GLIB_CHECK_VERSION(2,31,10)
 HB_EXTERN hb_blob_t *
 hb_glib_blob_create (GBytes *gbytes);
-
+#endif
 
 HB_END_DECLS
 
diff --git a/test/api/test-ot-math.c b/test/api/test-ot-math.c
index 5f4ccb7..049656a 100644
--- a/test/api/test-ot-math.c
+++ b/test/api/test-ot-math.c
@@ -54,7 +54,11 @@ cleanupFreeType (void)
 static void
 openFont(const char* fontFile)
 {
+#if GLIB_CHECK_VERSION(2,37,2)
   gchar* path = g_test_build_filename(G_TEST_DIST, fontFile, NULL);
+#else
+  gchar* path = g_strdup(fontFile);
+#endif
 
   FT_Error ft_error;
   if ((ft_error = FT_New_Face (ft_library, path, 0, &ft_face))) {


More information about the HarfBuzz mailing list