diff options
-rw-r--r-- | meta/recipes-graphics/piglit/piglit/0001-utils-Include-libgen.h-on-musl-linux-systems.patch | 83 |
1 files changed, 69 insertions, 14 deletions
diff --git a/meta/recipes-graphics/piglit/piglit/0001-utils-Include-libgen.h-on-musl-linux-systems.patch b/meta/recipes-graphics/piglit/piglit/0001-utils-Include-libgen.h-on-musl-linux-systems.patch index e180664d6e..2875dd52ec 100644 --- a/meta/recipes-graphics/piglit/piglit/0001-utils-Include-libgen.h-on-musl-linux-systems.patch +++ b/meta/recipes-graphics/piglit/piglit/0001-utils-Include-libgen.h-on-musl-linux-systems.patch | |||
@@ -1,28 +1,83 @@ | |||
1 | From 608cdeddc8e8a679b195927c4d34dc8d93142a91 Mon Sep 17 00:00:00 2001 | 1 | From 6c852e6ac292008137a6f3a8aa908090bb5b4b11 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Erik Faye-Lund <erik.faye-lund@collabora.com> |
3 | Date: Tue, 13 Feb 2024 08:53:37 -0800 | 3 | Date: Tue, 19 Mar 2024 16:34:02 +0100 |
4 | Subject: [PATCH] utils: Include libgen.h on musl/linux systems | 4 | Subject: [PATCH] properly check for libgen.h |
5 | 5 | ||
6 | musl does not provide GNU basename like string.h on glibc based systems | 6 | Some users are reporting that basename is not available when building on |
7 | does, it does provide the POSIX compliant basename function therefore | 7 | Linux with musl libc. And since the POSIX spec[1] says that basename is |
8 | allow to include libgen.h on non-glibc based linux systems | 8 | defined in libgen.h, we should include that when available. |
9 | 9 | ||
10 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/877] | 10 | So let's properly detect the header, and include it if it exists. This |
11 | should hopefully make things a bit more robust. | ||
12 | |||
13 | Since we're also including this from the CL program-tester, let's | ||
14 | rearrange the includes a bit so we know that config.h has been included. | ||
15 | |||
16 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/888] | ||
17 | Reviewed-by: David Heidelberg <david.heidelberg@collabora.com> | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
12 | --- | 19 | --- |
13 | tests/util/piglit-util.h | 2 +- | 20 | CMakeLists.txt | 1 + |
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | 21 | tests/cl/program/program-tester.c | 5 ++++- |
22 | tests/util/config.h.in | 1 + | ||
23 | tests/util/piglit-util.h | 4 ++-- | ||
24 | 4 files changed, 8 insertions(+), 3 deletions(-) | ||
15 | 25 | ||
26 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
27 | index dd2bf67125..5563fe0e20 100644 | ||
28 | --- a/CMakeLists.txt | ||
29 | +++ b/CMakeLists.txt | ||
30 | @@ -492,6 +492,7 @@ check_include_file(unistd.h HAVE_UNISTD_H) | ||
31 | check_include_file(fcntl.h HAVE_FCNTL_H) | ||
32 | check_include_file(linux/sync_file.h HAVE_LINUX_SYNC_FILE_H) | ||
33 | check_include_file(endian.h HAVE_ENDIAN_H) | ||
34 | +check_include_file(libgen.h HAVE_LIBGEN_H) | ||
35 | |||
36 | if(DEFINED PIGLIT_INSTALL_VERSION) | ||
37 | set(PIGLIT_INSTALL_VERSION_SUFFIX | ||
38 | diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c | ||
39 | index 97fe64906d..e47fb5aacc 100644 | ||
40 | --- a/tests/cl/program/program-tester.c | ||
41 | +++ b/tests/cl/program/program-tester.c | ||
42 | @@ -31,10 +31,13 @@ | ||
43 | #include <inttypes.h> | ||
44 | #include <math.h> | ||
45 | #include <regex.h> | ||
46 | -#include <libgen.h> | ||
47 | |||
48 | #include "piglit-framework-cl-program.h" | ||
49 | |||
50 | +#ifdef HAVE_LIBGEN_H | ||
51 | +#include <libgen.h> | ||
52 | +#endif | ||
53 | + | ||
54 | /* Regexes */ | ||
55 | |||
56 | /* | ||
57 | diff --git a/tests/util/config.h.in b/tests/util/config.h.in | ||
58 | index 8ed5af1709..437eb91418 100644 | ||
59 | --- a/tests/util/config.h.in | ||
60 | +++ b/tests/util/config.h.in | ||
61 | @@ -16,3 +16,4 @@ | ||
62 | #cmakedefine HAVE_SYS_RESOURCE_H 1 | ||
63 | #cmakedefine HAVE_UNISTD_H 1 | ||
64 | #cmakedefine HAVE_ENDIAN_H 1 | ||
65 | +#cmakedefine HAVE_LIBGEN_H 1 | ||
16 | diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h | 66 | diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h |
17 | index 4d3606c70..fdfd903b3 100644 | 67 | index 4d3606c708..de999980b6 100644 |
18 | --- a/tests/util/piglit-util.h | 68 | --- a/tests/util/piglit-util.h |
19 | +++ b/tests/util/piglit-util.h | 69 | +++ b/tests/util/piglit-util.h |
20 | @@ -52,7 +52,7 @@ extern "C" { | 70 | @@ -52,8 +52,8 @@ extern "C" { |
21 | #include <math.h> | 71 | #include <math.h> |
22 | #include <float.h> | 72 | #include <float.h> |
23 | 73 | ||
24 | -#if defined(__APPLE__) || defined(__MINGW32__) | 74 | -#if defined(__APPLE__) || defined(__MINGW32__) |
25 | +#if defined(__APPLE__) || defined(__MINGW32__) || (defined(__linux__) && !defined(__GLIBC__)) | 75 | -# include "libgen.h" // for basename |
26 | # include "libgen.h" // for basename | 76 | +#ifdef HAVE_LIBGEN_H |
77 | +# include <libgen.h> // for basename | ||
27 | #elif defined(_MSC_VER) | 78 | #elif defined(_MSC_VER) |
28 | 79 | ||
80 | static inline char * | ||
81 | -- | ||
82 | GitLab | ||
83 | |||