summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics
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-24 09:40:27 +0000
commit1d28cbc64705ae70845b221778d8e6da1c963c0d (patch)
tree3ae3952ba0d96a2dbc3ec7890ceb7a61d780e291 /meta/recipes-graphics
parent7b6b3124dbb8505fd59b066061dd272acf401247 (diff)
downloadpoky-1d28cbc64705ae70845b221778d8e6da1c963c0d.tar.gz
directfb: Fix build with musl
compar_fn_t, sigval_t and non-posix recursive mutexes are not available in musl (From OE-Core rev: 9c8af6b8dd40c98aca86d5b4858598e94ccaede5) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics')
-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
16 file://fusion.patch \ 16 file://fusion.patch \
17 file://bashism.patch \ 17 file://bashism.patch \
18 file://0001-gfx-direct-Aboid-usng-VLAs-and-printf-formats.patch \ 18 file://0001-gfx-direct-Aboid-usng-VLAs-and-printf-formats.patch \
19 file://compar_fn_t.patch \
20 file://union-sigval.patch \
21 file://use-PTHREAD_MUTEX_RECURSIVE.patch \
19 " 22 "
20 23
21S = "${WORKDIR}/DirectFB-${PV}" 24S = "${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 @@
1test for __compar_fn_t and if not defined by libc then define it
2help make directfb compile with musl
3
4Upstream-Status: Pending
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: DirectFB-1.7.7/configure.in
8===================================================================
9--- DirectFB-1.7.7.orig/configure.in
10+++ DirectFB-1.7.7/configure.in
11@@ -112,6 +112,17 @@ AC_CHECK_SIZEOF(long)
12 AC_CHECK_SIZEOF(long long)
13 AC_CHECK_FUNCS(fork)
14
15+AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [
16+ AC_TRY_COMPILE(
17+ [#include <stdlib.h>],
18+ [void test_fn(void) { qsort(NULL, 0, 0, (__compar_fn_t)NULL); }],
19+ ccache_cv_COMPAR_FN_T=yes,
20+ ccache_cv_COMPAR_FN_T=no)])
21+if test x"$ccache_cv_COMPAR_FN_T" = x"yes"; then
22+ AC_DEFINE(HAVE_COMPAR_FN_T, 1,
23+ Define to 1 if you have the `__compar_fn_t' typedef.)
24+fi
25+
26 AC_PATH_PROGS(PERL, perl5 perl)
27
28 AC_PATH_PROG(MAN2HTML, man2html, no)
29Index: DirectFB-1.7.7/inputdrivers/lirc/lirc.c
30===================================================================
31--- DirectFB-1.7.7.orig/inputdrivers/lirc/lirc.c
32+++ DirectFB-1.7.7/inputdrivers/lirc/lirc.c
33@@ -59,6 +59,11 @@
34
35 #include <core/input_driver.h>
36
37+#if HAVE_COMPAR_FN_T
38+#define COMPAR_FN_T __compar_fn_t
39+#else
40+typedef int (*COMPAR_FN_T)(const void *, const void *);
41+#endif
42
43 DFB_INPUT_DRIVER( lirc )
44
45@@ -97,7 +102,7 @@ static DFBInputDeviceKeySymbol lirc_pars
46 qsort ( keynames,
47 D_ARRAY_SIZE( keynames ),
48 sizeof(keynames[0]),
49- (__compar_fn_t) keynames_sort_compare );
50+ (COMPAR_FN_T) keynames_sort_compare );
51 keynames_sorted = true;
52 }
53
54@@ -124,7 +129,7 @@ static DFBInputDeviceKeySymbol lirc_pars
55 symbol_name = bsearch( name, keynames,
56 D_ARRAY_SIZE( keynames ),
57 sizeof(keynames[0]),
58- (__compar_fn_t) keynames_compare );
59+ (COMPAR_FN_T) keynames_compare );
60 if (symbol_name)
61 return symbol_name->symbol;
62 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 @@
1This patch is taken from gentoo musl overlay
2sigval_t is glibc only construct, we use a union of sigval
3which pretty much is same effect as sigval_t
4
5Upstream-Status: Pending
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8diff -Naur DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c
9--- DirectFB-1.7.6.orig/lib/direct/os/linux/glibc/system.c 2014-07-15 02:54:58.000000000 -0400
10+++ DirectFB-1.7.6/lib/direct/os/linux/glibc/system.c 2015-07-18 16:55:35.077989166 -0400
11@@ -111,7 +111,7 @@
12 void
13 direct_trap( const char *domain, int sig )
14 {
15- sigval_t val;
16+ union sigval val;
17
18 if (direct_config->delay_trap_ms) {
19 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 @@
1Remove use of DIRECT_RECURSIVE_MUTEX_INITIALIZER its not portable
2use portable way to initialize recursive mutex using pthread_once() and direct_recursive_mutex_init()
3
4Upstream-Status: Pending
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Index: DirectFB-1.7.7/lib/direct/os/linux/glibc/mutex.h
7===================================================================
8--- DirectFB-1.7.7.orig/lib/direct/os/linux/glibc/mutex.h
9+++ DirectFB-1.7.7/lib/direct/os/linux/glibc/mutex.h
10@@ -46,7 +46,6 @@ struct __D_DirectMutex {
11 /**********************************************************************************************************************/
12
13 #define DIRECT_MUTEX_INITIALIZER(name) { PTHREAD_MUTEX_INITIALIZER }
14-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name) { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
15
16 #endif
17
18Index: DirectFB-1.7.7/lib/direct/trace.c
19===================================================================
20--- DirectFB-1.7.7.orig/lib/direct/trace.c
21+++ DirectFB-1.7.7/lib/direct/trace.c
22@@ -89,8 +89,15 @@ struct __D_DirectTraceBuffer {
23 /**************************************************************************************************/
24
25 static DirectLink *buffers;
26-static DirectMutex buffers_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(buffers_lock);
27
28+static pthread_once_t buffers_lock_init_once = PTHREAD_ONCE_INIT;
29+static DirectMutex buffers_lock;
30+
31+static void
32+buffers_lock_init( void )
33+{
34+ direct_recursive_mutex_init(&buffers_lock);
35+}
36 /**************************************************************************************************/
37
38 __dfb_no_instrument_function__
39@@ -113,6 +120,7 @@ get_trace_buffer( void )
40
41 D_MAGIC_SET( buffer, DirectTraceBuffer );
42
43+ pthread_once(&buffers_lock_init_once, buffers_lock_init);
44 direct_mutex_lock( &buffers_lock );
45 direct_list_append( &buffers, &buffer->link );
46 direct_mutex_unlock( &buffers_lock );
47@@ -138,8 +146,14 @@ typedef struct {
48 } SymbolTable;
49
50 static DirectLink *tables = NULL;
51-static DirectMutex tables_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(tables_lock);
52+static pthread_once_t tables_lock_init_once = PTHREAD_ONCE_INIT;
53+static DirectMutex tables_lock;
54
55+static void
56+tables_lock_init( void )
57+{
58+ direct_recursive_mutex_init(&tabless_lock);
59+}
60
61 __dfb_no_instrument_function__
62 static void
63@@ -370,6 +384,7 @@ direct_trace_lookup_symbol( const char *
64 Symbol *symbol;
65 SymbolTable *table;
66
67+ pthread_once(&tables_lock_init_once, tables_lock_init);
68 direct_mutex_lock( &tables_lock );
69
70 table = find_table( filename );
71@@ -514,6 +529,7 @@ direct_trace_print_stacks()
72 DirectTraceBuffer *b;
73 DirectTraceBuffer *buffer = get_trace_buffer();
74
75+ pthread_once(&buffers_lock_init_once, buffers_lock_init);
76 direct_mutex_lock( &buffers_lock );
77
78 if (buffer && buffer->level)
79@@ -611,6 +627,7 @@ direct_trace_free_buffer( DirectTraceBuf
80 D_MAGIC_ASSERT( buffer, DirectTraceBuffer );
81
82 if (buffer->thread) {
83+ pthread_once(&buffers_lock_init_once, buffers_lock_init);
84 direct_mutex_lock( &buffers_lock );
85 direct_list_remove( &buffers, &buffer->link );
86 direct_mutex_unlock( &buffers_lock );
87Index: DirectFB-1.7.7/src/directfb.c
88===================================================================
89--- DirectFB-1.7.7.orig/src/directfb.c
90+++ DirectFB-1.7.7/src/directfb.c
91@@ -99,6 +99,15 @@ const unsigned int directfb_micro_versio
92 const unsigned int directfb_binary_age = DIRECTFB_BINARY_AGE;
93 const unsigned int directfb_interface_age = DIRECTFB_INTERFACE_AGE;
94
95+static pthread_once_t lock_init_once = PTHREAD_ONCE_INIT;
96+static DirectMutex lock;
97+
98+static void
99+lock_init( void )
100+{
101+ direct_recursive_mutex_init(&lock);
102+}
103+
104 const char *
105 DirectFBCheckVersion( unsigned int required_major,
106 unsigned int required_minor,
107@@ -215,8 +224,7 @@ DirectFBCreate( IDirectFB **interface_pt
108 if (dfb_config->remote.host)
109 return CreateRemote( dfb_config->remote.host, dfb_config->remote.port, interface_ptr );
110
111- static DirectMutex lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(lock);
112-
113+ pthread_once(&lock_init_once, lock_init);
114 direct_mutex_lock( &lock );
115
116 if (!dfb_config->no_singleton && idirectfb_singleton) {