diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-05-23 07:59:18 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-28 09:38:24 +0100 |
| commit | 71f3468f80101c772dd9427ca72a998b98b71e84 (patch) | |
| tree | 5e1c7ea17fd34452621cfff5752bbe74e66c6ae7 /meta/recipes-devtools | |
| parent | d79dfb75799c7c370a42582104895b527ab945f1 (diff) | |
| download | poky-71f3468f80101c772dd9427ca72a998b98b71e84.tar.gz | |
systemd-bootchart: Fix build on musl
(From OE-Core rev: 8243183f807d0f50d2cbd2add41d32ffc47857b3)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/systemd-bootchart/systemd-bootchart/0001-Define-portable-basename-function.patch | 59 | ||||
| -rw-r--r-- | meta/recipes-devtools/systemd-bootchart/systemd-bootchart_235.bb | 1 |
2 files changed, 60 insertions, 0 deletions
diff --git a/meta/recipes-devtools/systemd-bootchart/systemd-bootchart/0001-Define-portable-basename-function.patch b/meta/recipes-devtools/systemd-bootchart/systemd-bootchart/0001-Define-portable-basename-function.patch new file mode 100644 index 0000000000..dc4c44c6af --- /dev/null +++ b/meta/recipes-devtools/systemd-bootchart/systemd-bootchart/0001-Define-portable-basename-function.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | From 4b19c32791fb8a8663b3335f8a3675a2bbabe688 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 20 May 2024 18:40:36 -0700 | ||
| 4 | Subject: [PATCH] Define portable basename function | ||
| 5 | |||
| 6 | Newer version of musl have removed prototype for basename in string.h [1] | ||
| 7 | which now makes it fail to compile with GCC14+ compiler therefore | ||
| 8 | define local basename utility function. | ||
| 9 | |||
| 10 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 | ||
| 11 | |||
| 12 | Upstream-Status: Submitted [https://github.com/systemd/systemd-bootchart/pull/53] | ||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | --- | ||
| 15 | src/conf-files.c | 14 ++++++++++++-- | ||
| 16 | 1 file changed, 12 insertions(+), 2 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/src/conf-files.c b/src/conf-files.c | ||
| 19 | index 5dd2d7d..b932bb2 100644 | ||
| 20 | --- a/src/conf-files.c | ||
| 21 | +++ b/src/conf-files.c | ||
| 22 | @@ -35,6 +35,16 @@ | ||
| 23 | #include "strv.h" | ||
| 24 | #include "util.h" | ||
| 25 | |||
| 26 | +/*** | ||
| 27 | + * basename is implemented differently across different C libraries. This | ||
| 28 | + * implementation matches the one provided by the GNU libc, and does not | ||
| 29 | + * modify its input parameter. | ||
| 30 | +***/ | ||
| 31 | +static const char *sbc_basename(const char *path) { | ||
| 32 | + const char *base = strrchr(path, '/'); | ||
| 33 | + return base ? base + 1 : path; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) { | ||
| 37 | _cleanup_closedir_ DIR *dir = NULL; | ||
| 38 | const char *dirpath; | ||
| 39 | @@ -63,7 +73,7 @@ static int files_add(Hashmap *h, const char *root, const char *path, const char | ||
| 40 | if (!p) | ||
| 41 | return -ENOMEM; | ||
| 42 | |||
| 43 | - r = hashmap_put(h, basename(p), p); | ||
| 44 | + r = hashmap_put(h, sbc_basename(p), p); | ||
| 45 | if (r == -EEXIST) { | ||
| 46 | log_debug("Skipping overridden file: %s.", p); | ||
| 47 | free(p); | ||
| 48 | @@ -84,7 +94,7 @@ static int base_cmp(const void *a, const void *b) { | ||
| 49 | |||
| 50 | s1 = *(char * const *)a; | ||
| 51 | s2 = *(char * const *)b; | ||
| 52 | - return strcmp(basename(s1), basename(s2)); | ||
| 53 | + return strcmp(sbc_basename(s1), sbc_basename(s2)); | ||
| 54 | } | ||
| 55 | |||
| 56 | static int conf_files_list_strv_internal(char ***strv, const char *suffix, const char *root, char **dirs) { | ||
| 57 | -- | ||
| 58 | 2.45.1 | ||
| 59 | |||
diff --git a/meta/recipes-devtools/systemd-bootchart/systemd-bootchart_235.bb b/meta/recipes-devtools/systemd-bootchart/systemd-bootchart_235.bb index 25544029d5..3c3c84ff4a 100644 --- a/meta/recipes-devtools/systemd-bootchart/systemd-bootchart_235.bb +++ b/meta/recipes-devtools/systemd-bootchart/systemd-bootchart_235.bb | |||
| @@ -17,6 +17,7 @@ SRC_URI:append:libc-musl = " \ | |||
| 17 | file://0001-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ | 17 | file://0001-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch \ |
| 18 | file://0002-musl-does-not-provide-printf-h.patch \ | 18 | file://0002-musl-does-not-provide-printf-h.patch \ |
| 19 | file://0003-musl-does-not-provide-canonicalize_file_name.patch \ | 19 | file://0003-musl-does-not-provide-canonicalize_file_name.patch \ |
| 20 | file://0001-Define-portable-basename-function.patch \ | ||
| 20 | " | 21 | " |
| 21 | 22 | ||
| 22 | 23 | ||
