diff options
| author | Khem Raj <raj.khem@gmail.com> | 2024-09-18 07:12:29 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-09-20 10:45:45 +0100 |
| commit | e7f4fbcfa4942d90105b534859b5cc4d5a91d3a4 (patch) | |
| tree | 8939969375fe1a32f1376aba5c600d6ca4b0286b /meta/recipes-connectivity/bluez5 | |
| parent | 1f55d5c0a4ee6822a5f97e24808e3fe5981bf891 (diff) | |
| download | poky-e7f4fbcfa4942d90105b534859b5cc4d5a91d3a4.tar.gz | |
bluez: Fix mesh builds on musl
When mesh is enabled on musl the build fails with conflicting basename
calls.
(From OE-Core rev: 2db90c6508e350d35782db973291bbf5ffdfd3a5)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/bluez5')
| -rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5/0001-mesh-Move-local-basename-into-utility-file.patch | 114 |
2 files changed, 115 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc index eda0f8d6c7..b3bcd278e6 100644 --- a/meta/recipes-connectivity/bluez5/bluez5.inc +++ b/meta/recipes-connectivity/bluez5/bluez5.inc | |||
| @@ -70,6 +70,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \ | |||
| 70 | file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ | 70 | file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ |
| 71 | file://0001-test-gatt-Fix-hung-issue.patch \ | 71 | file://0001-test-gatt-Fix-hung-issue.patch \ |
| 72 | file://0001-Provide-GNU-basename-compatible-implementation.patch \ | 72 | file://0001-Provide-GNU-basename-compatible-implementation.patch \ |
| 73 | file://0001-mesh-Move-local-basename-into-utility-file.patch \ | ||
| 73 | " | 74 | " |
| 74 | S = "${WORKDIR}/bluez-${PV}" | 75 | S = "${WORKDIR}/bluez-${PV}" |
| 75 | 76 | ||
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-mesh-Move-local-basename-into-utility-file.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-mesh-Move-local-basename-into-utility-file.patch new file mode 100644 index 0000000000..33c12fc3a8 --- /dev/null +++ b/meta/recipes-connectivity/bluez5/bluez5/0001-mesh-Move-local-basename-into-utility-file.patch | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | From e64c2e70a74da452b0ee147350c4ce93e1db8d2f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 16 Sep 2024 15:11:01 -0700 | ||
| 4 | Subject: [PATCH v2] mesh: Move local basename into utility file | ||
| 5 | |||
| 6 | Defining an override via a missing.h can prove difficult when a file | ||
| 7 | needs to use basename and dirname both the APIs and needs to include | ||
| 8 | libgen.h for them, in such situations there will be signature clash | ||
| 9 | for basename function. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://lore.kernel.org/linux-bluetooth/20240917031745.1641153-1-raj.khem@gmail.com/T/#u] | ||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | |||
| 14 | --- | ||
| 15 | v2: Remove reference to missing.h in Makefile.mesh | ||
| 16 | |||
| 17 | Makefile.mesh | 2 +- | ||
| 18 | mesh/mesh-config-json.c | 3 +-- | ||
| 19 | mesh/missing.h | 21 --------------------- | ||
| 20 | mesh/rpl.c | 3 +-- | ||
| 21 | mesh/util.c | 10 ++++++++++ | ||
| 22 | mesh/util.h | 5 +++++ | ||
| 23 | 6 files changed, 18 insertions(+), 26 deletions(-) | ||
| 24 | delete mode 100644 mesh/missing.h | ||
| 25 | |||
| 26 | --- a/mesh/mesh-config-json.c | ||
| 27 | +++ b/mesh/mesh-config-json.c | ||
| 28 | @@ -28,7 +28,6 @@ | ||
| 29 | #include <ell/ell.h> | ||
| 30 | #include <json-c/json.h> | ||
| 31 | |||
| 32 | -#include "mesh/missing.h" | ||
| 33 | #include "mesh/mesh-defs.h" | ||
| 34 | #include "mesh/util.h" | ||
| 35 | #include "mesh/mesh-config.h" | ||
| 36 | @@ -2708,7 +2707,7 @@ void mesh_config_destroy_nvm(struct mesh | ||
| 37 | if (!hex2str(cfg->uuid, 16, uuid, sizeof(uuid))) | ||
| 38 | return; | ||
| 39 | |||
| 40 | - node_name = basename(node_dir); | ||
| 41 | + node_name = mesh_basename(node_dir); | ||
| 42 | |||
| 43 | /* Make sure path name of node follows expected guidelines */ | ||
| 44 | if (strcmp(node_name, uuid)) | ||
| 45 | --- a/mesh/missing.h | ||
| 46 | +++ /dev/null | ||
| 47 | @@ -1,21 +0,0 @@ | ||
| 48 | -// SPDX-License-Identifier: LGPL-2.1-or-later | ||
| 49 | -/* | ||
| 50 | - * | ||
| 51 | - * BlueZ - Bluetooth protocol stack for Linux | ||
| 52 | - * | ||
| 53 | - * Copyright (C) 2024 Khem Raj <raj.khem@gmail.com> | ||
| 54 | - * | ||
| 55 | - */ | ||
| 56 | - | ||
| 57 | -#ifdef HAVE_CONFIG_H | ||
| 58 | -#include <config.h> | ||
| 59 | -#endif | ||
| 60 | -#if !HAVE_DECL_BASENAME | ||
| 61 | -#include <string.h> | ||
| 62 | -static inline const char *basename(const char *path) | ||
| 63 | -{ | ||
| 64 | - const char *base = strrchr(path, '/'); | ||
| 65 | - | ||
| 66 | - return base ? base + 1 : path; | ||
| 67 | -} | ||
| 68 | -#endif | ||
| 69 | --- a/mesh/rpl.c | ||
| 70 | +++ b/mesh/rpl.c | ||
| 71 | @@ -24,7 +24,6 @@ | ||
| 72 | |||
| 73 | #include <ell/ell.h> | ||
| 74 | |||
| 75 | -#include "mesh/missing.h" | ||
| 76 | #include "mesh/mesh-defs.h" | ||
| 77 | |||
| 78 | #include "mesh/node.h" | ||
| 79 | @@ -147,7 +146,7 @@ static void get_entries(const char *iv_p | ||
| 80 | if (!dir) | ||
| 81 | return; | ||
| 82 | |||
| 83 | - iv_txt = basename(iv_path); | ||
| 84 | + iv_txt = mesh_basename(iv_path); | ||
| 85 | if (sscanf(iv_txt, "%08x", &iv_index) != 1) { | ||
| 86 | closedir(dir); | ||
| 87 | return; | ||
| 88 | --- a/mesh/util.c | ||
| 89 | +++ b/mesh/util.c | ||
| 90 | @@ -161,3 +161,13 @@ void enable_debug(void) | ||
| 91 | debug_enabled = true; | ||
| 92 | l_debug_enable("*"); | ||
| 93 | } | ||
| 94 | + | ||
| 95 | +#if !HAVE_DECL_BASENAME | ||
| 96 | +#include <string.h> | ||
| 97 | +const char *mesh_basename(const char *path) | ||
| 98 | +{ | ||
| 99 | + const char *base = strrchr(path, '/'); | ||
| 100 | + | ||
| 101 | + return base ? base + 1 : path; | ||
| 102 | +} | ||
| 103 | +#endif | ||
| 104 | --- a/mesh/util.h | ||
| 105 | +++ b/mesh/util.h | ||
| 106 | @@ -16,3 +16,8 @@ void print_packet(const char *label, con | ||
| 107 | int create_dir(const char *dir_name); | ||
| 108 | void del_path(const char *path); | ||
| 109 | void enable_debug(void); | ||
| 110 | +#if !HAVE_DECL_BASENAME | ||
| 111 | +const char *mesh_basename(const char *path); | ||
| 112 | +#else | ||
| 113 | +#define mesh_basename basename | ||
| 114 | +#endif | ||
