[HarfBuzz] harfbuzz-ng: Branch 'master' - 5 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu May 5 18:31:35 PDT 2011


 configure.ac                 |   34 +++++++++++++++++++----
 src/Makefile.am              |    9 ++++++
 src/check-c-linkage-decls.sh |    2 -
 src/hb-common.cc             |   29 ++++++++++++++++++++
 src/hb-version.h.in          |   62 +++++++++++++++++++++++++++++++++++++++++++
 src/hb.h                     |    1 
 test/Makefile.am             |    2 +
 test/hb-test.h               |   55 ++++++++++++++++++++++----------------
 8 files changed, 165 insertions(+), 29 deletions(-)

New commits:
commit c78f4485587cc1dee07e772c164a13fde9d2859f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 5 21:31:04 2011 -0400

    [API] Add version macros and functions
    
    Step version up to 0.5.0.
    
    Also, fix to pass "make distcheck"

diff --git a/configure.ac b/configure.ac
index 761a213..bb25950 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.64])
 AC_INIT([harfbuzz],
-        [0.3],
+        [0.5.0],
         [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz],
         [harfbuzz],
         [http://freedesktop.org/wiki/Software/harfbuzz])
@@ -9,11 +9,8 @@ AC_CONFIG_SRCDIR([harfbuzz.pc.in])
 AC_CONFIG_HEADERS([config.h])
 
 AM_INIT_AUTOMAKE([1.11.1 gnu dist-bzip2 no-dist-gzip -Wall no-define])
-
 AM_SILENT_RULES([yes])
 
-AC_CANONICAL_HOST
-
 # Check for programs
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -23,11 +20,25 @@ AC_PROG_CXX
 LT_PREREQ([2.2])
 LT_INIT([disable-static])
 
+# Version
+m4_define(version_triplet,m4_split(AC_PACKAGE_VERSION,[[.]]))
+HB_VERSION_MAJOR=m4_argn(1,version_triplet)
+HB_VERSION_MINOR=m4_argn(2,version_triplet)
+HB_VERSION_MICRO=m4_argn(3,version_triplet)
+HB_VERSION=AC_PACKAGE_VERSION
+
+AC_SUBST(HB_VERSION_MAJOR)
+AC_SUBST(HB_VERSION_MINOR)
+AC_SUBST(HB_VERSION_MICRO)
+AC_SUBST(HB_VERSION)
+
+
 # Functions and headers
 AC_CHECK_FUNCS(mprotect sysconf getpagesize)
 AC_CHECK_HEADERS(unistd.h sys/mman.h)
 
 # Compiler flags
+AC_CANONICAL_HOST
 if test "x$GCC" = "xyes"; then
 
 	# Make sure we don't link to libstdc++
@@ -100,12 +111,13 @@ if $have_freetype; then
 fi
 AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
 
-dnl ==========================================================================
+dnl ===========================================================================
 
 AC_CONFIG_FILES([
-harfbuzz.pc
 Makefile
+harfbuzz.pc
 src/Makefile
+src/hb-version.h
 test/Makefile
 ])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 0a7edb3..73ac547 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,6 +2,9 @@
 
 NULL =
 EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
 
 # The following warning options are useful for debugging: -Wpadded -Wcast-align
 #AM_CXXFLAGS =
@@ -35,6 +38,7 @@ HBHEADERS = \
 	hb-font.h \
 	hb-shape.h \
 	hb-unicode.h \
+	hb-version.h \
 	$(NULL)
 
 HBSOURCES += \
@@ -61,6 +65,10 @@ HBHEADERS += \
 	hb-ot-tag.h \
 	$(NULL)
 
+MAINTAINERCLEANFILES = \
+	$(srcdir)/hb-version.h \
+	$(NULL)
+
 if HAVE_GLIB
 HBCFLAGS += $(GLIB_CFLAGS)
 HBLIBS   += $(GLIB_LIBS)
@@ -99,6 +107,7 @@ libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
 libharfbuzz_la_CPPFLAGS = $(HBCFLAGS)
 libharfbuzz_la_LIBADD = $(HBLIBS)
 pkginclude_HEADERS = $(HBHEADERS)
+nodist_pkginclude_HEADERS = hb-version.h
 
 
 GENERATORS = \
diff --git a/src/check-c-linkage-decls.sh b/src/check-c-linkage-decls.sh
index 711d089..ffdb9e3 100755
--- a/src/check-c-linkage-decls.sh
+++ b/src/check-c-linkage-decls.sh
@@ -8,7 +8,7 @@ stat=0
 
 cd "$srcdir"
 
-for x in hb-*.c hb-*.cc hb-*.h hb-*.hh ; do
+for x in hb-*.cc hb-*.h hb-*.hh ; do
 	if ! grep -q HB_BEGIN_DECLS "$x" || ! grep -q HB_END_DECLS "$x"; then
 		echo "Ouch, file $x does not HB_BEGIN_DECLS / HB_END_DECLS"
 		stat=1
diff --git a/src/hb-common.cc b/src/hb-common.cc
index b000340..49f3eb8 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -28,6 +28,8 @@
 
 #include "hb-private.hh"
 
+#include "hb-version.h"
+
 #include "hb-mutex-private.hh"
 #include "hb-object-private.hh"
 
@@ -308,4 +310,31 @@ hb_user_data_array_t::get (hb_user_data_key_t *key)
 }
 
 
+/* hb_version */
+
+void
+hb_version (unsigned int *major,
+	    unsigned int *minor,
+	    unsigned int *micro)
+{
+  *major = HB_VERSION_MAJOR;
+  *minor = HB_VERSION_MINOR;
+  *micro = HB_VERSION_MICRO;
+}
+
+const char *
+hb_version_string (void)
+{
+  return HB_VERSION_STRING;
+}
+
+hb_bool_t
+hb_version_check (unsigned int major,
+		  unsigned int minor,
+		  unsigned int micro)
+{
+  return HB_VERSION_CHECK (major, minor, micro);
+}
+
+
 HB_END_DECLS
diff --git a/src/hb-version.h.in b/src/hb-version.h.in
new file mode 100644
index 0000000..47a9b30
--- /dev/null
+++ b/src/hb-version.h.in
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2011  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_VERSION_H
+#define HB_VERSION_H
+
+#include "hb-common.h"
+
+HB_BEGIN_DECLS
+
+
+#define HB_VERSION_MAJOR @HB_VERSION_MAJOR@
+#define HB_VERSION_MINOR @HB_VERSION_MINOR@
+#define HB_VERSION_MICRO @HB_VERSION_MICRO@
+
+#define HB_VERSION_STRING "@HB_VERSION@"
+
+#define HB_VERSION_CHECK(major,minor,micro) \
+	((major)*10000+(minor)*100+(micro) >= \
+	 HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO)
+
+
+void
+hb_version (unsigned int *major,
+	    unsigned int *minor,
+	    unsigned int *micro);
+
+const char *
+hb_version_string (void);
+
+hb_bool_t
+hb_version_check (unsigned int major,
+		  unsigned int minor,
+		  unsigned int micro);
+
+
+HB_END_DECLS
+
+#endif /* HB_VERSION_H */
diff --git a/src/hb.h b/src/hb.h
index b75998e..0a2ebd9 100644
--- a/src/hb.h
+++ b/src/hb.h
@@ -33,6 +33,7 @@
 #include "hb-font.h"
 #include "hb-shape.h"
 #include "hb-unicode.h"
+#include "hb-version.h"
 
 HB_BEGIN_DECLS
 HB_END_DECLS
diff --git a/test/Makefile.am b/test/Makefile.am
index 56d6118..c744795 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -6,6 +6,8 @@ if HAVE_GLIB
 AM_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS)
 LDADD = $(top_builddir)/src/libharfbuzz.la $(GLIB_LIBS)
 
+EXTRA_DIST += hb-test.h
+
 check_PROGRAMS = $(TEST_PROGS)
 noinst_PROGRAMS = $(TEST_PROGS)
 
commit 9ff819f6571fd0d570f271162d7a30d97ee64148
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 5 19:47:59 2011 -0400

    Add disable-static libtool flag
    
    No one who builds harfbuzz static uses the autotools build system to do it.

diff --git a/configure.ac b/configure.ac
index 31b03d5..761a213 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ AC_PROG_CXX
 
 # Initialize libtool
 LT_PREREQ([2.2])
-LT_INIT([])
+LT_INIT([disable-static])
 
 # Functions and headers
 AC_CHECK_FUNCS(mprotect sysconf getpagesize)
commit 7ca7571ef91754274f6c84bbf988962d74a74098
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 5 19:47:12 2011 -0400

    Remove win32-dll libtool flag
    
    Since we're not win32-dll clean the way libtool docs define it.

diff --git a/configure.ac b/configure.ac
index c0ff166..31b03d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ AC_PROG_CXX
 
 # Initialize libtool
 LT_PREREQ([2.2])
-LT_INIT([win32-dll])
+LT_INIT([])
 
 # Functions and headers
 AC_CHECK_FUNCS(mprotect sysconf getpagesize)
commit 174e3fe89b72729c9c34c647544a2dc1bf63cd84
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 5 19:37:53 2011 -0400

    Add AC_CANONICAL_HOST

diff --git a/configure.ac b/configure.ac
index e5147ca..c0ff166 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,8 @@ AM_INIT_AUTOMAKE([1.11.1 gnu dist-bzip2 no-dist-gzip -Wall no-define])
 
 AM_SILENT_RULES([yes])
 
+AC_CANONICAL_HOST
+
 # Check for programs
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -21,9 +23,11 @@ AC_PROG_CXX
 LT_PREREQ([2.2])
 LT_INIT([win32-dll])
 
+# Functions and headers
 AC_CHECK_FUNCS(mprotect sysconf getpagesize)
 AC_CHECK_HEADERS(unistd.h sys/mman.h)
 
+# Compiler flags
 if test "x$GCC" = "xyes"; then
 
 	# Make sure we don't link to libstdc++
@@ -45,6 +49,8 @@ if $have_glib; then
 fi
 AM_CONDITIONAL(HAVE_GLIB, $have_glib)
 
+dnl ==========================================================================
+
 PKG_CHECK_MODULES(CAIRO, cairo >= 1.8.0, have_cairo=true, have_cairo=false)
 if $have_cairo; then
 	AC_DEFINE(HAVE_CAIRO, 1, [Have cairo graphics library])
@@ -63,6 +69,8 @@ if $have_cairo_ft; then
 fi
 AM_CONDITIONAL(HAVE_CAIRO_FT, $have_cairo_ft)
 
+dnl ==========================================================================
+
 PKG_CHECK_MODULES(ICU, icu, have_icu=true, [
 	AC_CHECK_PROG([have_icu], [icu-config], [true], [false])
 	if $have_icu; then
@@ -77,6 +85,8 @@ if $have_icu; then
 fi
 AM_CONDITIONAL(HAVE_ICU, $have_icu)
 
+dnl ==========================================================================
+
 PKG_CHECK_MODULES(FREETYPE, freetype2, have_freetype=true, have_freetype=false)
 if $have_freetype; then
 	AC_DEFINE(HAVE_FREETYPE, 1, [Have FreeType 2 library])
commit e6a5b88c01420366a70e0c9ae1775fb3c930cb8b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu May 5 16:24:42 2011 -0400

    Fix build with older glib

diff --git a/configure.ac b/configure.ac
index ad2d2be..e5147ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ fi
 
 dnl ==========================================================================
 
-PKG_CHECK_MODULES(GLIB, glib-2.0, have_glib=true, have_glib=false)
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, have_glib=true, have_glib=false)
 if $have_glib; then
 	AC_DEFINE(HAVE_GLIB, 1, [Have glib2 library])
 fi
diff --git a/test/hb-test.h b/test/hb-test.h
index 73f8735..5f72a05 100644
--- a/test/hb-test.h
+++ b/test/hb-test.h
@@ -123,9 +123,20 @@ hb_test_normalize_path (const char *path)
 }
 
 
+#if GLIB_CHECK_VERSION(2,25,12)
+typedef GTestFunc        hb_test_func_t;
+typedef GTestDataFunc    hb_test_data_func_t;
+typedef GTestFixtureFunc hb_test_fixture_func_t;
+#else
+typedef void (*hb_test_func_t)         (void);
+typedef void (*hb_test_data_func_t)    (gconstpointer user_data);
+typedef void (*hb_test_fixture_func_t) (gpointer      fixture,
+                                        gconstpointer user_data);
+#endif
+
 static inline void
 hb_test_add_func (const char *test_path,
-		  GTestFunc   test_func)
+		  hb_test_func_t   test_func)
 {
   char *normal_path = hb_test_normalize_path (test_path);
   g_test_add_func (normal_path, test_func);
@@ -136,7 +147,7 @@ hb_test_add_func (const char *test_path,
 static inline void
 hb_test_add_func_flavor (const char *test_path,
 			 const char *flavor,
-			 GTestFunc   test_func)
+			 hb_test_func_t   test_func)
 {
   char *path = g_strdup_printf ("%s/%s", test_path, flavor);
   hb_test_add_func (path, test_func);
@@ -145,9 +156,9 @@ hb_test_add_func_flavor (const char *test_path,
 #define hb_test_add_flavor(Flavor, Func) hb_test_add_func (#Func, Flavor, Func)
 
 static inline void
-hb_test_add_data_func (const char    *test_path,
-		       gconstpointer  test_data,
-		       GTestDataFunc  test_func)
+hb_test_add_data_func (const char          *test_path,
+		       gconstpointer        test_data,
+		       hb_test_data_func_t  test_func)
 {
   char *normal_path = hb_test_normalize_path (test_path);
   g_test_add_data_func (normal_path, test_data, test_func);
@@ -156,10 +167,10 @@ hb_test_add_data_func (const char    *test_path,
 #define hb_test_add_data(UserData, Func) hb_test_add_data_func (#Func, UserData, Func)
 
 static inline void
-hb_test_add_data_func_flavor (const char    *test_path,
-			      const char    *flavor,
-			      gconstpointer  test_data,
-			      GTestDataFunc  test_func)
+hb_test_add_data_func_flavor (const char          *test_path,
+			      const char          *flavor,
+			      gconstpointer        test_data,
+			      hb_test_data_func_t  test_func)
 {
   char *path = g_strdup_printf ("%s/%s", test_path, flavor);
   hb_test_add_data_func (path, test_data, test_func);
@@ -169,12 +180,12 @@ hb_test_add_data_func_flavor (const char    *test_path,
 
 
 static inline void
-hb_test_add_vtable (const char       *test_path,
-		    gsize             data_size,
-		    gconstpointer     test_data,
-		    GTestFixtureFunc  data_setup,
-		    GTestFixtureFunc  data_test,
-		    GTestFixtureFunc  data_teardown)
+hb_test_add_vtable (const char             *test_path,
+		    gsize                   data_size,
+		    gconstpointer           test_data,
+		    hb_test_fixture_func_t  data_setup,
+		    hb_test_fixture_func_t  data_test,
+		    hb_test_fixture_func_t  data_teardown)
 {
   char *normal_path = hb_test_normalize_path (test_path);
   g_test_add_vtable (normal_path, data_size, test_data, data_setup, data_test, data_teardown);
@@ -196,13 +207,13 @@ G_STMT_START { \
 } G_STMT_END
 
 static inline void
-hb_test_add_vtable_flavor (const char       *test_path,
-			   const char       *flavor,
-			   gsize             data_size,
-			   gconstpointer     test_data,
-			   GTestFixtureFunc  data_setup,
-			   GTestFixtureFunc  data_test,
-			   GTestFixtureFunc  data_teardown)
+hb_test_add_vtable_flavor (const char             *test_path,
+			   const char             *flavor,
+			   gsize                   data_size,
+			   gconstpointer           test_data,
+			   hb_test_fixture_func_t  data_setup,
+			   hb_test_fixture_func_t  data_test,
+			   hb_test_fixture_func_t  data_teardown)
 {
   char *path = g_strdup_printf ("%s/%s", test_path, flavor);
   hb_test_add_vtable (path, data_size, test_data, data_setup, data_test, data_teardown);



More information about the HarfBuzz mailing list