diff options
Diffstat (limited to 'meta/recipes-support/argp-standalone')
3 files changed, 163 insertions, 0 deletions
diff --git a/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb new file mode 100644 index 0000000000..a5d20d30a4 --- /dev/null +++ b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb | |||
@@ -0,0 +1,28 @@ | |||
1 | # Copyright (C) 2015 Khem Raj <raj.khem@gmail.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "Glibc hierarchical argument parsing standalone library" | ||
5 | HOMEPAGE = "http://www.lysator.liu.se/~nisse/misc/" | ||
6 | LICENSE = "LGPL-2.1" | ||
7 | LIC_FILES_CHKSUM = "file://argp.h;beginline=1;endline=20;md5=008b7e53dea6f9e1d9fdef0d9cf3184a" | ||
8 | SECTION = "libs" | ||
9 | |||
10 | SRC_URI = "http://www.lysator.liu.se/~nisse/misc/argp-standalone-${PV}.tar.gz \ | ||
11 | file://0001-throw-in-funcdef.patch \ | ||
12 | file://0002-isprint.patch \ | ||
13 | " | ||
14 | SRC_URI[md5sum] = "720704bac078d067111b32444e24ba69" | ||
15 | SRC_URI[sha256sum] = "dec79694da1319acd2238ce95df57f3680fea2482096e483323fddf3d818d8be" | ||
16 | |||
17 | inherit autotools | ||
18 | |||
19 | CFLAGS += "-fPIC -U__OPTIMIZE__" | ||
20 | |||
21 | do_install() { | ||
22 | install -D -m 0644 ${B}/libargp.a ${D}${libdir}/libargp.a | ||
23 | install -D -m 0644 ${S}/argp.h ${D}${includedir}/argp.h | ||
24 | } | ||
25 | # | ||
26 | # We will skip parsing for non-musl systems | ||
27 | # | ||
28 | COMPATIBLE_HOST = ".*-musl.*" | ||
diff --git a/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch b/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch new file mode 100644 index 0000000000..a6e2759c5d --- /dev/null +++ b/meta/recipes-support/argp-standalone/files/0001-throw-in-funcdef.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | # --- T2-COPYRIGHT-NOTE-BEGIN --- | ||
2 | # This copyright note is auto-generated by ./scripts/Create-CopyPatch. | ||
3 | # | ||
4 | # T2 SDE: package/.../rng-tools/throw-in-funcdef.patch.argp-standalone | ||
5 | # Copyright (C) 2006 The T2 SDE Project | ||
6 | # | ||
7 | # More information can be found in the files COPYING and README. | ||
8 | # | ||
9 | # This patch file is dual-licensed. It is available under the license the | ||
10 | # patched project is licensed under, as long as it is an OpenSource license | ||
11 | # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms | ||
12 | # of the GNU General Public License as published by the Free Software | ||
13 | # Foundation; either version 2 of the License, or (at your option) any later | ||
14 | # version. | ||
15 | # --- T2-COPYRIGHT-NOTE-END --- | ||
16 | |||
17 | |||
18 | No __THROW in function implementation. | ||
19 | --jsaw | ||
20 | |||
21 | Taken from buildroot | ||
22 | |||
23 | Upstream-Status: Pending | ||
24 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
25 | |||
26 | --- argp-standalone-1.4-test2/argp.h.orig 2006-01-06 02:29:59.000000000 +0100 | ||
27 | +++ argp-standalone-1.4-test2/argp.h 2006-01-06 02:41:10.000000000 +0100 | ||
28 | @@ -560,17 +560,17 @@ | ||
29 | # endif | ||
30 | |||
31 | # ifndef ARGP_EI | ||
32 | -# define ARGP_EI extern __inline__ | ||
33 | +# define ARGP_EI extern inline | ||
34 | # endif | ||
35 | |||
36 | ARGP_EI void | ||
37 | -__argp_usage (__const struct argp_state *__state) __THROW | ||
38 | +__argp_usage (__const struct argp_state *__state) | ||
39 | { | ||
40 | __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); | ||
41 | } | ||
42 | |||
43 | ARGP_EI int | ||
44 | -__option_is_short (__const struct argp_option *__opt) __THROW | ||
45 | +__option_is_short (__const struct argp_option *__opt) | ||
46 | { | ||
47 | if (__opt->flags & OPTION_DOC) | ||
48 | return 0; | ||
49 | @@ -582,7 +582,7 @@ | ||
50 | } | ||
51 | |||
52 | ARGP_EI int | ||
53 | -__option_is_end (__const struct argp_option *__opt) __THROW | ||
54 | +__option_is_end (__const struct argp_option *__opt) | ||
55 | { | ||
56 | return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; | ||
57 | } | ||
58 | --- argp-standalone-1.4-test2/argp-parse.c.orig 2006-01-06 02:47:48.000000000 +0100 | ||
59 | +++ argp-standalone-1.4-test2/argp-parse.c 2006-01-06 02:48:16.000000000 +0100 | ||
60 | @@ -1290,13 +1290,13 @@ | ||
61 | /* Defined here, in case a user is not inlining the definitions in | ||
62 | * argp.h */ | ||
63 | void | ||
64 | -__argp_usage (__const struct argp_state *__state) __THROW | ||
65 | +__argp_usage (__const struct argp_state *__state) | ||
66 | { | ||
67 | __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); | ||
68 | } | ||
69 | |||
70 | int | ||
71 | -__option_is_short (__const struct argp_option *__opt) __THROW | ||
72 | +__option_is_short (__const struct argp_option *__opt) | ||
73 | { | ||
74 | if (__opt->flags & OPTION_DOC) | ||
75 | return 0; | ||
76 | @@ -1310,7 +1310,7 @@ | ||
77 | } | ||
78 | |||
79 | int | ||
80 | -__option_is_end (__const struct argp_option *__opt) __THROW | ||
81 | +__option_is_end (__const struct argp_option *__opt) | ||
82 | { | ||
83 | return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; | ||
84 | } | ||
diff --git a/meta/recipes-support/argp-standalone/files/0002-isprint.patch b/meta/recipes-support/argp-standalone/files/0002-isprint.patch new file mode 100644 index 0000000000..1c07eea3c1 --- /dev/null +++ b/meta/recipes-support/argp-standalone/files/0002-isprint.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | Subject: restrict value range passed to isprint function | ||
2 | |||
3 | According to C standards isprint argument shall be representable as an | ||
4 | unsigned char or be equal to EOF, otherwise the behaviour is undefined. | ||
5 | |||
6 | Passing arbitrary ints leads to segfault in nm program from elfutils. | ||
7 | |||
8 | Restrict isprint argument range to values representable by unsigned char. | ||
9 | |||
10 | Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> | ||
11 | |||
12 | Taken from buildroot | ||
13 | |||
14 | Upstream-Status: Pending | ||
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
16 | |||
17 | --- | ||
18 | Index: b/argp.h | ||
19 | =================================================================== | ||
20 | --- a/argp.h | ||
21 | +++ b/argp.h | ||
22 | @@ -23,6 +23,7 @@ | ||
23 | |||
24 | #include <stdio.h> | ||
25 | #include <ctype.h> | ||
26 | +#include <limits.h> | ||
27 | |||
28 | #define __need_error_t | ||
29 | #include <errno.h> | ||
30 | @@ -577,7 +578,7 @@ | ||
31 | else | ||
32 | { | ||
33 | int __key = __opt->key; | ||
34 | - return __key > 0 && isprint (__key); | ||
35 | + return __key > 0 && __key <= UCHAR_MAX && isprint (__key); | ||
36 | } | ||
37 | } | ||
38 | |||
39 | Index: b/argp-parse.c | ||
40 | =================================================================== | ||
41 | --- a/argp-parse.c | ||
42 | +++ b/argp-parse.c | ||
43 | @@ -1292,7 +1292,7 @@ | ||
44 | int __key = __opt->key; | ||
45 | /* FIXME: whether or not a particular key implies a short option | ||
46 | * ought not to be locale dependent. */ | ||
47 | - return __key > 0 && isprint (__key); | ||
48 | + return __key > 0 && __key <= UCHAR_MAX && isprint (__key); | ||
49 | } | ||
50 | } | ||
51 | |||