diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-07-14 18:55:35 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-07-24 18:57:37 +0200 |
commit | 0f55207ad2be1ce6cd3577afa6d1ce869665743b (patch) | |
tree | 50fa5920f227db4863ca35618340261ee7221b91 /meta-oe/recipes-multimedia/v4l2apps/v4l-utils | |
parent | 85d4fe73352886b4d22a77d8ab5163d267d21fa2 (diff) | |
download | meta-openembedded-0f55207ad2be1ce6cd3577afa6d1ce869665743b.tar.gz |
v4l-utils: Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-multimedia/v4l2apps/v4l-utils')
3 files changed, 132 insertions, 0 deletions
diff --git a/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch new file mode 100644 index 000000000..f1e11da3f --- /dev/null +++ b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0001-ir-ctl-Define-TEMP_FAILURE_RETRY-if-undefined.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | From e60aea50e41ae8a17672beb5859beecb66e7a305 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 14 Jul 2017 13:11:25 -0700 | ||
4 | Subject: [PATCH 1/3] ir-ctl: Define TEMP_FAILURE_RETRY if undefined | ||
5 | |||
6 | use strndup() instead of strndupa() which is not | ||
7 | universally available in C libraries | ||
8 | |||
9 | Taken from AlpineLinux | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | utils/ir-ctl/ir-ctl.c | 14 +++++++++++++- | ||
14 | 1 file changed, 13 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c | ||
17 | index bc58cee..1a44011 100644 | ||
18 | --- a/utils/ir-ctl/ir-ctl.c | ||
19 | +++ b/utils/ir-ctl/ir-ctl.c | ||
20 | @@ -42,6 +42,16 @@ | ||
21 | # define _(string) string | ||
22 | #endif | ||
23 | |||
24 | +/* taken from glibc unistd.h */ | ||
25 | +#ifndef TEMP_FAILURE_RETRY | ||
26 | +#define TEMP_FAILURE_RETRY(expression) \ | ||
27 | + (__extension__ \ | ||
28 | + ({ long int __result; \ | ||
29 | + do __result = (long int) (expression); \ | ||
30 | + while (__result == -1L && errno == EINTR); \ | ||
31 | + __result; })) | ||
32 | +#endif | ||
33 | + | ||
34 | # define N_(string) string | ||
35 | |||
36 | |||
37 | @@ -344,12 +354,14 @@ static struct file *read_scancode(const char *name) | ||
38 | return NULL; | ||
39 | } | ||
40 | |||
41 | - pstr = strndupa(name, p - name); | ||
42 | + pstr = strndup(name, p - name); | ||
43 | |||
44 | if (!protocol_match(pstr, &proto)) { | ||
45 | fprintf(stderr, _("error: protocol '%s' not found\n"), pstr); | ||
46 | + free(pstr); | ||
47 | return NULL; | ||
48 | } | ||
49 | + free(pstr); | ||
50 | |||
51 | if (!strtoscancode(p + 1, &scancode)) { | ||
52 | fprintf(stderr, _("error: invalid scancode '%s'\n"), p + 1); | ||
53 | -- | ||
54 | 2.13.3 | ||
55 | |||
diff --git a/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch new file mode 100644 index 000000000..2fb4057ec --- /dev/null +++ b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0002-contrib-test-Link-mc_nextgen_test-with-libargp-if-ne.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From b3acc4c6407f9553f32582a9aee6a11b5fcd1d8a Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 14 Jul 2017 13:17:19 -0700 | ||
4 | Subject: [PATCH 2/3] contrib/test: Link mc_nextgen_test with libargp if needed | ||
5 | |||
6 | musl depends on external argp implementation e.g. | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | contrib/test/Makefile.am | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am | ||
14 | index 4641e21..e47b948 100644 | ||
15 | --- a/contrib/test/Makefile.am | ||
16 | +++ b/contrib/test/Makefile.am | ||
17 | @@ -32,7 +32,7 @@ v4l2gl_LDFLAGS = $(X11_LIBS) $(GL_LIBS) $(GLU_LIBS) $(ARGP_LIBS) | ||
18 | v4l2gl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la | ||
19 | |||
20 | mc_nextgen_test_CFLAGS = $(LIBUDEV_CFLAGS) | ||
21 | -mc_nextgen_test_LDFLAGS = $(LIBUDEV_LIBS) | ||
22 | +mc_nextgen_test_LDFLAGS = $(ARGP_LIBS) $(LIBUDEV_LIBS) | ||
23 | |||
24 | |||
25 | ioctl_test_SOURCES = ioctl-test.c ioctl-test.h ioctl_32.h ioctl_64.h | ||
26 | -- | ||
27 | 2.13.3 | ||
28 | |||
diff --git a/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch new file mode 100644 index 000000000..0a986ae5d --- /dev/null +++ b/meta-oe/recipes-multimedia/v4l2apps/v4l-utils/0003-v4l2-ctl-Do-not-use-getsubopt.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From d04aa6866cbea57c4a81b033cd60586a9436ac6b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 14 Jul 2017 13:20:05 -0700 | ||
4 | Subject: [PATCH 3/3] v4l2-ctl: Do not use getsubopt | ||
5 | |||
6 | POSIX says that behavior when subopts list is empty is undefined. | ||
7 | musl libs will set value to NULL which leads to crash. | ||
8 | |||
9 | Taken from AlpineLinux | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | utils/v4l2-ctl/v4l2-ctl-common.cpp | 19 ++++++++++--------- | ||
14 | 1 file changed, 10 insertions(+), 9 deletions(-) | ||
15 | |||
16 | diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp | ||
17 | index 3ea6cd3..291fb3e 100644 | ||
18 | --- a/utils/v4l2-ctl/v4l2-ctl-common.cpp | ||
19 | +++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp | ||
20 | @@ -692,16 +692,17 @@ static bool parse_subset(char *optarg) | ||
21 | |||
22 | static bool parse_next_subopt(char **subs, char **value) | ||
23 | { | ||
24 | - static char *const subopts[] = { | ||
25 | - NULL | ||
26 | - }; | ||
27 | - int opt = getsubopt(subs, subopts, value); | ||
28 | + char *p = *subs; | ||
29 | + *value = *subs; | ||
30 | |||
31 | - if (opt < 0 || *value) | ||
32 | - return false; | ||
33 | - fprintf(stderr, "No value given to suboption <%s>\n", | ||
34 | - subopts[opt]); | ||
35 | - return true; | ||
36 | + while (*p && *p != ',') | ||
37 | + p++; | ||
38 | + | ||
39 | + if (*p) | ||
40 | + *p++ = '\0'; | ||
41 | + | ||
42 | + *subs = p; | ||
43 | + return false; | ||
44 | } | ||
45 | |||
46 | void common_cmd(int ch, char *optarg) | ||
47 | -- | ||
48 | 2.13.3 | ||
49 | |||