Add weston 6.0.0 for WM and HS rewrite
[AGL/meta-agl.git] / meta-agl-bsp / recipes-graphics / wayland / weston / 0001-make-error-portable.patch
1 From ad1d2161c811cff25d1684c33611f300adb753bc Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Fri, 29 May 2015 20:56:00 -0700
4 Subject: [PATCH] make error() portable
5
6 error() is not posix but gnu extension so may not be available on all
7 kind of systemsi e.g. musl.
8
9 Upstream-Status: Submitted
10
11 Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13 ---
14  configure.ac              |  2 ++
15  libweston/weston-error.h  | 20 ++++++++++++++++++++
16  libweston/weston-launch.c |  2 +-
17  3 files changed, 23 insertions(+), 1 deletion(-)
18  create mode 100644 libweston/weston-error.h
19
20 diff --git a/configure.ac b/configure.ac
21 index 7aebbdb..dc9c802 100644
22 --- a/configure.ac
23 +++ b/configure.ac
24 @@ -109,6 +109,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
25               [[#include <time.h>]])
26  AC_CHECK_HEADERS([execinfo.h])
27  
28 +AC_CHECK_HEADERS([error.h])
29 +
30  AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
31  
32  # check for libdrm as a build-time dependency only
33 diff --git a/libweston/weston-error.h b/libweston/weston-error.h
34 new file mode 100644
35 index 0000000..2089d02
36 --- /dev/null
37 +++ b/libweston/weston-error.h
38 @@ -0,0 +1,20 @@
39 +#ifndef _WESTON_ERROR_H
40 +#define _WESTON_ERROR_H
41 +
42 +#if defined(HAVE_ERROR_H)
43 +#include <error.h>
44 +#else
45 +#include <err.h>
46 +#include <string.h>
47 +#define _weston_error(S, E, F, ...) do { \
48 +       if (E) \
49 +               err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
50 +       else \
51 +               err(S, F, ##__VA_ARGS__); \
52 +} while(0)
53 +
54 +#define error _weston_error
55 +#endif
56 +
57 +#endif
58 +
59 diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
60 index 1adcf21..166bf3b 100644
61 --- a/libweston/weston-launch.c
62 +++ b/libweston/weston-launch.c
63 @@ -33,7 +33,6 @@
64  #include <poll.h>
65  #include <errno.h>
66  
67 -#include <error.h>
68  #include <getopt.h>
69  
70  #include <sys/types.h>
71 @@ -59,6 +58,7 @@
72  #endif
73  
74  #include "weston-launch.h"
75 +#include "weston-error.h"
76  
77  #define DRM_MAJOR 226
78