summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/directfb
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-12-29 23:25:47 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-22 23:42:47 +0000
commit9c8af6b8dd40c98aca86d5b4858598e94ccaede5 (patch)
tree6203c7bdbb2f4d409b776d0d7b22fc49410dddbd /meta/recipes-graphics/directfb
parent1eaa3e101d04fd9e73b3c680f305b35f9bb16add (diff)
downloadopenembedded-core-9c8af6b8dd40c98aca86d5b4858598e94ccaede5.tar.gz
directfb: Fix build with musl
compar_fn_t, sigval_t and non-posix recursive mutexes are not available in musl Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta/recipes-graphics/directfb')
-rw-r--r--meta/recipes-graphics/directfb/directfb.inc3
-rw-r--r--meta/recipes-graphics/directfb/directfb/compar_fn_t.patch62
-rw-r--r--meta/recipes-graphics/directfb/directfb/union-sigval.patch19
-rw-r--r--meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch116
4 files changed, 200 insertions, 0 deletions
diff --git a/meta/recipes-graphics/directfb/directfb.inc b/meta/recipes-graphics/directfb/directfb.inc
index 603aba3f6e..be39b83dd8 100644
--- a/meta/recipes-graphics/directfb/directfb.inc
+++ b/meta/recipes-graphics/directfb/directfb.inc
@@ -16,6 +16,9 @@ SRC_URI = "http://www.directfb.org/downloads/Core/DirectFB-1.7/DirectFB-${PV}.ta
file://fusion.patch \
file://bashism.patch \
file://0001-gfx-direct-Aboid-usng-VLAs-and-printf-formats.patch \
+ file://compar_fn_t.patch \
+ file://union-sigval.patch \
+ file://use-PTHREAD_MUTEX_RECURSIVE.patch \
"
S = "${WORKDIR}/DirectFB-${PV}"
diff --git a/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
new file mode 100644
index 0000000000..ee4d900ba8
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/compar_fn_t.patch
@@ -0,0 +1,62 @@
+test for __compar_fn_t and if not defined by libc then define it
+help make directfb compile with musl
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: DirectFB-1.7.7/configure.in
+===================================================================
+--- DirectFB-1.7.7.orig/configure.in
++++ DirectFB-1.7.7/configure.in
+@@ -112,6 +112,17 @@ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+ AC_CHECK_FUNCS(fork)
+
++AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
++ AC_TRY_COMPILE(
++ [#include <stdlib.h>],
++ [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }],
++ ccache_cv_COMPAR_FN_T=yes,
++ ccache_cv_COMPAR_FN_T=no)])
++if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
++ AC_DEFINE(HAVE_COMPAR_FN_T, 1,
++ Define to 1 if you have the `__compar_fn_t' typedef.)
++fi
++
+ AC_PATH_PROGS(PERL, perl5 perl)
+
+ AC_PATH_PROG(MAN2HTML, man2html, no)
+Index: DirectFB-1.7.7/inputdrivers/lirc/lirc.c
+===================================================================
+--- DirectFB-1.7.7.orig/inputdrivers/lirc/lirc.c
++++ DirectFB-1.7.7/inputdrivers/lirc/lirc.c
+@@ -59,6 +59,11 @@
+
+ #include <core/input_driver.h>
+
++#if HAVE_COMPAR_FN_T
++#define COMPAR_FN_T __compar_fn_t
++#else
++typedef int (*COMPAR_FN_T)(const void *, const void *);
++#endif
+
+ DFB_INPUT_DRIVER( lirc )
+
+@@ -97,7 +102,7 @@ static DFBInputDeviceKeySymbol lirc_pars
+ qsort ( keynames,
+ D_ARRAY_SIZE( keynames ),
+ sizeof(keynames[0]),
+- (__compar_fn_t) keynames_sort_compare );
++ (COMPAR_FN_T) keynames_sort_compare );
+ keynames_sorted = true;
+ }
+
+@@ -124,7 +129,7 @@ static DFBInputDeviceKeySymbol lirc_pars
+ symbol_name = bsearch( name, keynames,
+ D_ARRAY_SIZE( keynames ),
+ sizeof(keynames[0]),
+- (__compar_fn_t) keynames_compare );
++ (COMPAR_FN_T) keynames_compare );
+ if (symbol_name)
+ return symbol_name->symbol;
+ break;
diff --git a/meta/recipes-graphics/directfb/directfb/union-sigval.patch b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
new file mode 100644
index 0000000000..29f45c7977
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/union-sigval.patch
@@ -0,0 +1,19 @@
+This patch is taken from gentoo musl overlay
+sigval_t is glibc only construct, we use a union of sigval
+which pretty much is same effect as sigval_t
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c
+--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c 2014-07-15 02:54:58.000000000 -0400
++++ DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c 2015-07-18 16:55:35.077989166 -0400
+@@ -111,7 +111,7 @@
+ void
+ direct_trap( const char *domain, int sig )
+ {
+- sigval_t val;
++ union sigval val;
+
+ if (direct_config->delay_trap_ms) {
+ D_LOG( Direct_Trap, VERBOSE, "NOT RAISING signal %d from %s, waiting for %dms... attach gdb --pid=%d\n", sig, domain, direct_config->delay_trap_ms, getpid() );
diff --git a/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
new file mode 100644
index 0000000000..ac48f68db7
--- /dev/null
+++ b/meta/recipes-graphics/directfb/directfb/use-PTHREAD_MUTEX_RECURSIVE.patch
@@ -0,0 +1,116 @@
+Remove use of DIRECT_RECURSIVE_MUTEX_INITIALIZER its not portable
+use portable way to initialize recursive mutex using pthread_once() and direct_recursive_mutex_init()
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Index: DirectFB-1.7.7/lib/direct/os/linux/glibc/mutex.h
+===================================================================
+--- DirectFB-1.7.7.orig/lib/direct/os/linux/glibc/mutex.h
++++ DirectFB-1.7.7/lib/direct/os/linux/glibc/mutex.h
+@@ -46,7 +46,6 @@ struct __D_DirectMutex {
+ /**********************************************************************************************************************/
+
+ #define DIRECT_MUTEX_INITIALIZER(name) { PTHREAD_MUTEX_INITIALIZER }
+-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name) { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
+
+ #endif
+
+Index: DirectFB-1.7.7/lib/direct/trace.c
+===================================================================
+--- DirectFB-1.7.7.orig/lib/direct/trace.c
++++ DirectFB-1.7.7/lib/direct/trace.c
+@@ -89,8 +89,15 @@ struct __D_DirectTraceBuffer {
+ /**************************************************************************************************/
+
+ static DirectLink *buffers;
+-static DirectMutex buffers_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(buffers_lock);
+
++static pthread_once_t buffers_lock_init_once = PTHREAD_ONCE_INIT;
++static DirectMutex buffers_lock;
++
++static void
++buffers_lock_init( void )
++{
++ direct_recursive_mutex_init(&buffers_lock);
++}
+ /**************************************************************************************************/
+
+ __dfb_no_instrument_function__
+@@ -113,6 +120,7 @@ get_trace_buffer( void )
+
+ D_MAGIC_SET( buffer, DirectTraceBuffer );
+
++ pthread_once(&buffers_lock_init_once, buffers_lock_init);
+ direct_mutex_lock( &buffers_lock );
+ direct_list_append( &buffers, &buffer->link );
+ direct_mutex_unlock( &buffers_lock );
+@@ -138,8 +146,14 @@ typedef struct {
+ } SymbolTable;
+
+ static DirectLink *tables = NULL;
+-static DirectMutex tables_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(tables_lock);
++static pthread_once_t tables_lock_init_once = PTHREAD_ONCE_INIT;
++static DirectMutex tables_lock;
+
++static void
++tables_lock_init( void )
++{
++ direct_recursive_mutex_init(&tabless_lock);
++}
+
+ __dfb_no_instrument_function__
+ static void
+@@ -370,6 +384,7 @@ direct_trace_lookup_symbol( const char *
+ Symbol *symbol;
+ SymbolTable *table;
+
++ pthread_once(&tables_lock_init_once, tables_lock_init);
+ direct_mutex_lock( &tables_lock );
+
+ table = find_table( filename );
+@@ -514,6 +529,7 @@ direct_trace_print_stacks()
+ DirectTraceBuffer *b;
+ DirectTraceBuffer *buffer = get_trace_buffer();
+
++ pthread_once(&buffers_lock_init_once, buffers_lock_init);
+ direct_mutex_lock( &buffers_lock );
+
+ if (buffer && buffer->level)
+@@ -611,6 +627,7 @@ direct_trace_free_buffer( DirectTraceBuf
+ D_MAGIC_ASSERT( buffer, DirectTraceBuffer );
+
+ if (buffer->thread) {
++ pthread_once(&buffers_lock_init_once, buffers_lock_init);
+ direct_mutex_lock( &buffers_lock );
+ direct_list_remove( &buffers, &buffer->link );
+ direct_mutex_unlock( &buffers_lock );
+Index: DirectFB-1.7.7/src/directfb.c
+===================================================================
+--- DirectFB-1.7.7.orig/src/directfb.c
++++ DirectFB-1.7.7/src/directfb.c
+@@ -99,6 +99,15 @@ const unsigned int directfb_micro_versio
+ const unsigned int directfb_binary_age = DIRECTFB_BINARY_AGE;
+ const unsigned int directfb_interface_age = DIRECTFB_INTERFACE_AGE;
+
++static pthread_once_t lock_init_once = PTHREAD_ONCE_INIT;
++static DirectMutex lock;
++
++static void
++lock_init( void )
++{
++ direct_recursive_mutex_init(&lock);
++}
++
+ const char *
+ DirectFBCheckVersion( unsigned int required_major,
+ unsigned int required_minor,
+@@ -215,8 +224,7 @@ DirectFBCreate( IDirectFB **interface_pt
+ if (dfb_config->remote.host)
+ return CreateRemote( dfb_config->remote.host, dfb_config->remote.port, interface_ptr );
+
+- static DirectMutex lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(lock);
+-
++ pthread_once(&lock_init_once, lock_init);
+ direct_mutex_lock( &lock );
+
+ if (!dfb_config->no_singleton && idirectfb_singleton) {