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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jan 4 16:00:48 UTC 2018


 .circleci/config.yml      |    9 ++++-----
 CMakeLists.txt            |   45 ++++++++++++++++++++++++++++++++++++++++++---
 src/Makefile.am           |    1 +
 src/check-defs.sh         |    3 ++-
 src/check-libstdc++.sh    |    3 ++-
 src/check-static-inits.sh |    3 ++-
 src/check-symbols.sh      |    3 ++-
 src/hb-atomic-private.hh  |   46 +++++++++++++++++++++++-----------------------
 8 files changed, 78 insertions(+), 35 deletions(-)

New commits:
commit 8a0952db7e521320cd4d8b67b287f7d33c21b6e0
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date:   Thu Jan 4 18:40:10 2018 +0700

    atomics: Favor compiler primitives over macOS APIs. (#676)
    
    In macOS 10.12, the `OSMemoryBarrier` and related APIs were deprecated
    in favor of using `std::atomic`. On the way to supporting `std::atomic`,
    we can favor using the "Intel primitives" which are also available on
    macOS.

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 93438401..a7e9b11a 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -70,6 +70,29 @@ typedef LONG hb_atomic_int_impl_t;
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)	(InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O))
 
 
+#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
+
+typedef int hb_atomic_int_impl_t;
+#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
+#define hb_atomic_int_impl_add(AI, V)		__sync_fetch_and_add (&(AI), (V))
+
+#define hb_atomic_ptr_impl_get(P)		(void *) (__sync_synchronize (), *(P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)	__sync_bool_compare_and_swap ((P), (O), (N))
+
+
+#elif !defined(HB_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS)
+
+#include <atomic.h>
+#include <mbarrier.h>
+
+typedef unsigned int hb_atomic_int_impl_t;
+#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
+#define hb_atomic_int_impl_add(AI, V)		( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
+
+#define hb_atomic_ptr_impl_get(P)		( ({__machine_rw_barrier ();}), (void *) *(P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)	( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false)
+
+
 #elif !defined(HB_NO_MT) && defined(__APPLE__)
 
 #include <libkern/OSAtomic.h>
@@ -96,29 +119,6 @@ typedef int32_t hb_atomic_int_impl_t;
 #endif
 
 
-#elif !defined(HB_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
-
-typedef int hb_atomic_int_impl_t;
-#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
-#define hb_atomic_int_impl_add(AI, V)		__sync_fetch_and_add (&(AI), (V))
-
-#define hb_atomic_ptr_impl_get(P)		(void *) (__sync_synchronize (), *(P))
-#define hb_atomic_ptr_impl_cmpexch(P,O,N)	__sync_bool_compare_and_swap ((P), (O), (N))
-
-
-#elif !defined(HB_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS)
-
-#include <atomic.h>
-#include <mbarrier.h>
-
-typedef unsigned int hb_atomic_int_impl_t;
-#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
-#define hb_atomic_int_impl_add(AI, V)		( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
-
-#define hb_atomic_ptr_impl_get(P)		( ({__machine_rw_barrier ();}), (void *) *(P))
-#define hb_atomic_ptr_impl_cmpexch(P,O,N)	( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false)
-
-
 #elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
 
 #include <builtins.h>
commit 4f80078eb035054db0f6e33cf4f7345c6c85cb12
Author: Bruce Mitchener <bruce.mitchener at gmail.com>
Date:   Thu Jan 4 18:37:35 2018 +0700

    [cmake] Colorize output when using cmake + ninja. (#674)
    
    Due to how ninja runs clang and gcc, it doesn't colorize the output
    like make does. This forces color output in this situation.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fdcebda..4b713b63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -699,6 +699,16 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
   endif ()
 endif ()
 
+if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
+  if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    set (CMAKE_CXX_FLAGS "-fcolor-diagnostics ${CMAKE_CXX_FLAGS}")
+    set (CMAKE_C_FLAGS "-fcolor-diagnostics ${CMAKE_C_FLAGS}")
+  endif ()
+  if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+    set (CMAKE_CXX_FLAGS "-fdiagnostics-color ${CMAKE_CXX_FLAGS}")
+    set (CMAKE_C_FLAGS "-fdiagnostics-color ${CMAKE_C_FLAGS}")
+  endif ()
+endif ()
 
 ## Tests
 if (UNIX)
commit 5ed26fc5bdfdab0ff41a8861b54395c0bbbad248
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Jan 4 10:11:34 2018 +0330

    [cmake] Run src/ tests (#675)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3ddc693b..93913a82 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -52,15 +52,14 @@ jobs:
       - run: ninja -Cbuild test
       - run: ninja -Cbuild install
 
-  distdir:
+  distcheck:
     docker:
       - image: dockcross/base
     steps:
       - checkout
       - run: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
-      - run: ./autogen.sh && make distdir
-      - run: cd harfbuzz-* && ./configure && make && make check && make install && make clean
-      - run: cd harfbuzz-* && cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GLIB=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja && ninja -Cbuild && ninja -Cbuild test && ninja -Cbuild install
+      - run: ./autogen.sh && make distcheck
+      - run: make distdir && cd harfbuzz-* && cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GLIB=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install
 
   psvita:
     docker:
@@ -144,7 +143,7 @@ workflows:
       - archlinux
       - freebsd9
       - base
-      - distdir
+      - distcheck
       - psvita
       - android-arm
       - browser-asmjs
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a24b136b..6fdcebda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,7 @@ endif ()
 include_directories(AFTER
   ${PROJECT_SOURCE_DIR}/src
   ${PROJECT_BINARY_DIR}/src
-  )
+)
 
 add_definitions(-DHAVE_OT)
 add_definitions(-DHAVE_FALLBACK)
@@ -427,6 +427,7 @@ if (HB_HAVE_GOBJECT)
   )
 endif ()
 
+
 ## Atomic ops availability detection
 file(WRITE "${PROJECT_BINARY_DIR}/try_compile_intel_atomic_primitives.c"
 "		void memory_barrier (void) { __sync_synchronize (); }
@@ -463,6 +464,7 @@ endif ()
 add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers})
 target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
 
+
 ## Define harfbuzz-gobject library
 if (HB_HAVE_GOBJECT)
   add_library(harfbuzz-gobject
@@ -535,7 +537,7 @@ if (HB_HAVE_INTROSPECTION)
     ${hb_gobject_gen_headers}
     ${hb_gobject_sources}
     ${hb_gobject_headers}
-    )
+  )
     if (WIN32)
       # Nasty issue: We need to make drive letters lower case,
       # otherwise g-ir-scanner won't like it and give us a bunch
@@ -599,6 +601,7 @@ if (HB_HAVE_INTROSPECTION)
   )
 endif ()
 
+
 ## Additional framework build configs
 if (BUILD_FRAMEWORK)
   set (CMAKE_MACOSX_RPATH ON)
@@ -687,7 +690,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
 
       install(FILES "${hb_libpath}/HarfBuzz-0.0.gir"
         DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gir-1.0
-        )
+      )
 
       install(FILES "${hb_libpath}/HarfBuzz-0.0.typelib"
         DESTINATION ${CMAKE_INSTALL_LIBDIR}/girepository-1.0
@@ -696,6 +699,32 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
   endif ()
 endif ()
 
+
+## Tests
+if (UNIX)
+  if (BUILD_SHARED_LIBS)
+    add_test(NAME check-static-inits.sh
+      COMMAND ${PROJECT_SOURCE_DIR}/src/check-static-inits.sh
+      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/harfbuzz.dir/src # hack
+    )
+    # does some "make" stuff inside
+    # add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.sh)
+    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)
+  else ()
+    message(WARN "You can enable BUILD_SHARED_LIBS for more tests.")
+  endif ()
+
+  # disabled as it doesn't work anyway
+  if (OFF AND IN_HB_DIST)
+    add_test(NAME check-c-linkage-decls.sh COMMAND ./check-c-linkage-decls.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
+    add_test(NAME check-header-guards.sh COMMAND ./check-header-guards.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
+  endif ()
+
+  add_test(NAME check-externs.sh COMMAND ./check-externs.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
+  add_test(NAME check-includes.sh COMMAND ./check-includes.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
+endif ()
+
 # Needs to come last so that variables defined above are passed to
 # subdirectories.
 add_subdirectory(test)
diff --git a/src/Makefile.am b/src/Makefile.am
index 68571822..b34d9421 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -324,6 +324,7 @@ test_ot_tag_LDADD = libharfbuzz.la $(HBLIBS)
 TESTS = $(dist_check_SCRIPTS) $(check_PROGRAMS)
 TESTS_ENVIRONMENT = \
 	srcdir="$(srcdir)" \
+	libs=".libs" \
 	MAKE="$(MAKE) $(AM_MAKEFLAGS)" \
 	HBSOURCES="$(HBSOURCES)" \
 	HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \
diff --git a/src/check-defs.sh b/src/check-defs.sh
index 480d4999..ee2cafed 100755
--- a/src/check-defs.sh
+++ b/src/check-defs.sh
@@ -4,6 +4,7 @@ LC_ALL=C
 export LC_ALL
 
 test -z "$srcdir" && srcdir=.
+test -z "$libs" && libs=.
 test -z "$MAKE" && MAKE=make
 stat=0
 
@@ -19,7 +20,7 @@ $MAKE $defs > /dev/null
 tested=false
 for def in $defs; do
 	lib=`echo "$def" | sed 's/[.]def$//;s at .*/@@'`
-	so=.libs/lib${lib}.so
+	so=$libs/lib${lib}.so
 
 	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\>\| llvm_' | cut -d' ' -f3`"
 
diff --git a/src/check-libstdc++.sh b/src/check-libstdc++.sh
index b541828b..9d73814e 100755
--- a/src/check-libstdc++.sh
+++ b/src/check-libstdc++.sh
@@ -4,6 +4,7 @@ LC_ALL=C
 export LC_ALL
 
 test -z "$srcdir" && srcdir=.
+test -z "$libs" && libs=.
 stat=0
 
 
@@ -16,7 +17,7 @@ fi
 
 tested=false
 for suffix in so dylib; do
-	so=.libs/libharfbuzz.$suffix
+	so=$libs/libharfbuzz.$suffix
 	if ! test -f "$so"; then continue; fi
 
 	echo "Checking that we are not linking to libstdc++ or libc++"
diff --git a/src/check-static-inits.sh b/src/check-static-inits.sh
index 1446fa73..aa1b129d 100755
--- a/src/check-static-inits.sh
+++ b/src/check-static-inits.sh
@@ -4,6 +4,7 @@ LC_ALL=C
 export LC_ALL
 
 test -z "$srcdir" && srcdir=.
+test -z "$libs" && libs=.
 stat=0
 
 
@@ -14,7 +15,7 @@ else
 	exit 77
 fi
 
-OBJS=.libs/*.o
+OBJS=$libs/*.o
 if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then
 	echo "check-static-inits.sh: object files not found; skipping test"
 	exit 77
diff --git a/src/check-symbols.sh b/src/check-symbols.sh
index d4d655d2..f1bba470 100755
--- a/src/check-symbols.sh
+++ b/src/check-symbols.sh
@@ -4,6 +4,7 @@ LC_ALL=C
 export LC_ALL
 
 test -z "$srcdir" && srcdir=.
+test -z "$libs" && libs=.
 stat=0
 
 
@@ -17,7 +18,7 @@ fi
 echo "Checking that we are not exposing internal symbols"
 tested=false
 for suffix in so dylib; do
-	so=.libs/libharfbuzz.$suffix
+	so=$libs/libharfbuzz.$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`"


More information about the HarfBuzz mailing list