diff options
| -rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch | 143 |
2 files changed, 144 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc index d8b9f81771..e0d3e65187 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://0004-src-shared-util.c-include-linux-limits.h.patch \ | 72 | file://0004-src-shared-util.c-include-linux-limits.h.patch \ |
| 73 | file://0001-Provide-GNU-basename-compatible-implementation.patch \ | ||
| 73 | " | 74 | " |
| 74 | S = "${WORKDIR}/bluez-${PV}" | 75 | S = "${WORKDIR}/bluez-${PV}" |
| 75 | 76 | ||
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch new file mode 100644 index 0000000000..3a2a97ff02 --- /dev/null +++ b/meta/recipes-connectivity/bluez5/bluez5/0001-Provide-GNU-basename-compatible-implementation.patch | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | From 9000923c07a68857e8ea32a49bfca660b1d1001a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 26 Aug 2024 09:55:03 -0700 | ||
| 4 | Subject: [PATCH BlueZ] Provide GNU basename compatible implementation | ||
| 5 | |||
| 6 | Call to basename() relies on a GNU extension | ||
| 7 | to take a const char * vs a char *. Let's define | ||
| 8 | a trivial helper function to ensure compatibility | ||
| 9 | with musl. | ||
| 10 | |||
| 11 | Fixes Issue: https://github.com/bluez/bluez/issues/843 | ||
| 12 | |||
| 13 | Upstream-Status: Submitted [https://lore.kernel.org/linux-bluetooth/20240826173844.2918630-1-raj.khem@gmail.com/T/#u] | ||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | --- | ||
| 16 | Makefile.mesh | 2 ++ | ||
| 17 | Makefile.tools | 3 ++- | ||
| 18 | mesh/mesh-config-json.c | 6 ++++-- | ||
| 19 | mesh/rpl.c | 3 ++- | ||
| 20 | src/shared/util.h | 7 +++++++ | ||
| 21 | tools/hex2hcd.c | 3 ++- | ||
| 22 | 6 files changed, 19 insertions(+), 5 deletions(-) | ||
| 23 | |||
| 24 | Index: bluez-5.77/mesh/mesh-config-json.c | ||
| 25 | =================================================================== | ||
| 26 | --- bluez-5.77.orig/mesh/mesh-config-json.c | ||
| 27 | +++ bluez-5.77/mesh/mesh-config-json.c | ||
| 28 | @@ -28,6 +28,7 @@ | ||
| 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 | @@ -2694,7 +2695,8 @@ bool mesh_config_load_nodes(const char * | ||
| 37 | |||
| 38 | void mesh_config_destroy_nvm(struct mesh_config *cfg) | ||
| 39 | { | ||
| 40 | - char *node_dir, *node_name; | ||
| 41 | + char *node_dir; | ||
| 42 | + const char* node_name; | ||
| 43 | char uuid[33]; | ||
| 44 | |||
| 45 | if (!cfg) | ||
| 46 | Index: bluez-5.77/mesh/rpl.c | ||
| 47 | =================================================================== | ||
| 48 | --- bluez-5.77.orig/mesh/rpl.c | ||
| 49 | +++ bluez-5.77/mesh/rpl.c | ||
| 50 | @@ -24,6 +24,7 @@ | ||
| 51 | |||
| 52 | #include <ell/ell.h> | ||
| 53 | |||
| 54 | +#include "mesh/missing.h" | ||
| 55 | #include "mesh/mesh-defs.h" | ||
| 56 | |||
| 57 | #include "mesh/node.h" | ||
| 58 | Index: bluez-5.77/tools/hex2hcd.c | ||
| 59 | =================================================================== | ||
| 60 | --- bluez-5.77.orig/tools/hex2hcd.c | ||
| 61 | +++ bluez-5.77/tools/hex2hcd.c | ||
| 62 | @@ -24,6 +24,7 @@ | ||
| 63 | #include <stdlib.h> | ||
| 64 | #include <stdbool.h> | ||
| 65 | #include <sys/stat.h> | ||
| 66 | +#include "tools/missing.h" | ||
| 67 | |||
| 68 | static ssize_t process_record(int fd, const char *line, uint16_t *upper_addr) | ||
| 69 | { | ||
| 70 | Index: bluez-5.77/configure.ac | ||
| 71 | =================================================================== | ||
| 72 | --- bluez-5.77.orig/configure.ac | ||
| 73 | +++ bluez-5.77/configure.ac | ||
| 74 | @@ -70,7 +70,16 @@ AC_CHECK_LIB(pthread, pthread_create, du | ||
| 75 | AC_CHECK_LIB(dl, dlopen, dummy=yes, | ||
| 76 | AC_MSG_ERROR(dynamic linking loader is required)) | ||
| 77 | |||
| 78 | -AC_CHECK_HEADERS(linux/types.h linux/if_alg.h linux/uinput.h linux/uhid.h sys/random.h) | ||
| 79 | +AC_CHECK_HEADERS(string.h linux/types.h linux/if_alg.h linux/uinput.h linux/uhid.h sys/random.h) | ||
| 80 | + | ||
| 81 | +# basename may be only available in libgen.h with the POSIX behavior, | ||
| 82 | +# not desired here | ||
| 83 | +AC_CHECK_DECLS([basename], [], | ||
| 84 | + AC_MSG_WARN([GNU basename extension not found]), | ||
| 85 | + [#define _GNU_SOURCE 1 | ||
| 86 | + #include <string.h> | ||
| 87 | + ]) | ||
| 88 | + | ||
| 89 | |||
| 90 | PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28) | ||
| 91 | |||
| 92 | Index: bluez-5.77/tools/missing.h | ||
| 93 | =================================================================== | ||
| 94 | --- /dev/null | ||
| 95 | +++ bluez-5.77/tools/missing.h | ||
| 96 | @@ -0,0 +1,21 @@ | ||
| 97 | +// SPDX-License-Identifier: LGPL-2.1-or-later | ||
| 98 | +/* | ||
| 99 | + * | ||
| 100 | + * BlueZ - Bluetooth protocol stack for Linux | ||
| 101 | + * | ||
| 102 | + * Copyright (C) 2024 Khem Raj <raj.khem@gmail.com> | ||
| 103 | + * | ||
| 104 | + */ | ||
| 105 | + | ||
| 106 | +#ifdef HAVE_CONFIG_H | ||
| 107 | +#include <config.h> | ||
| 108 | +#endif | ||
| 109 | +#if !HAVE_DECL_BASENAME | ||
| 110 | +#include <string.h> | ||
| 111 | +static inline const char *basename(const char *path) | ||
| 112 | +{ | ||
| 113 | + const char *base = strrchr(path, '/'); | ||
| 114 | + | ||
| 115 | + return base ? base + 1 : path; | ||
| 116 | +} | ||
| 117 | +#endif | ||
| 118 | Index: bluez-5.77/mesh/missing.h | ||
| 119 | =================================================================== | ||
| 120 | --- /dev/null | ||
| 121 | +++ bluez-5.77/mesh/missing.h | ||
| 122 | @@ -0,0 +1,21 @@ | ||
| 123 | +// SPDX-License-Identifier: LGPL-2.1-or-later | ||
| 124 | +/* | ||
| 125 | + * | ||
| 126 | + * BlueZ - Bluetooth protocol stack for Linux | ||
| 127 | + * | ||
| 128 | + * Copyright (C) 2024 Khem Raj <raj.khem@gmail.com> | ||
| 129 | + * | ||
| 130 | + */ | ||
| 131 | + | ||
| 132 | +#ifdef HAVE_CONFIG_H | ||
| 133 | +#include <config.h> | ||
| 134 | +#endif | ||
| 135 | +#if !HAVE_DECL_BASENAME | ||
| 136 | +#include <string.h> | ||
| 137 | +static inline const char *basename(const char *path) | ||
| 138 | +{ | ||
| 139 | + const char *base = strrchr(path, '/'); | ||
| 140 | + | ||
| 141 | + return base ? base + 1 : path; | ||
| 142 | +} | ||
| 143 | +#endif | ||
