commit: d7fe66b67489c54ae8244dbbe7d801aed073952f Author: brahmajit das <brahmajit.xyz <AT> gmail <DOT> com> AuthorDate: Sat Jul 16 07:42:27 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Jul 18 00:26:12 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7fe66b6
dev-libs/libratbag-: Fix missing error.h error on musl Since musl doesn't provide error.h we need to check before adding it. If error.h is present in system only then we include it else we use err.h. Already there exists a bug report for this upstream [1]. The devs are open to a custom implementation of error but for now this patch for do it. [1]: https://github.com/libratbag/libratbag/issues/1253 Closes: https://bugs.gentoo.org/830557 Signed-off-by: brahmajit das <brahmajit.xyz <AT> gmail.com> Closes: https://github.com/gentoo/gentoo/pull/26437 Signed-off-by: Sam James <sam <AT> gentoo.org> .../files/libratbag-0.16-musl-error.h.patch | 69 ++++++++++++++++++++++ dev-libs/libratbag/libratbag-0.16.ebuild | 4 ++ 2 files changed, 73 insertions(+) diff --git a/dev-libs/libratbag/files/libratbag-0.16-musl-error.h.patch b/dev-libs/libratbag/files/libratbag-0.16-musl-error.h.patch new file mode 100644 index 000000000000..a3b0b187c154 --- /dev/null +++ b/dev-libs/libratbag/files/libratbag-0.16-musl-error.h.patch @@ -0,0 +1,69 @@ +# Since musl doesn't provide error.h we need to check before adding it. If +# error.h is present in system only then we include it else we use err.h. +# Already there exists a bug report for this upstream [1]. The devs are open to +# a custom implementation of error but for now this patch for do it. +# +# [1]: https://github.com/libratbag/libratbag/issues/1253 +# +# Closes: https://bugs.gentoo.org/830557 +--- a/meson.build ++++ b/meson.build +@@ -74,8 +74,13 @@ dep_libevdev = dependency('libevdev') + dep_glib = dependency('glib-2.0') + dep_json_glib = dependency('json-glib-1.0') + dep_lm = cc.find_library('m') ++error_exists = cc.has_header('error.h') + dep_unistring = cc.find_library('unistring') + ++if error_exists ++ add_global_arguments('-DHAVE_ERROR_H', language : 'c') ++endif ++ + if get_option('logind-provider') == 'elogind' + dep_logind = dependency('libelogind', version : '>=227') + else +--- a/tools/hidpp10-dump-page.c ++++ b/tools/hidpp10-dump-page.c +@@ -23,7 +23,12 @@ + + #include <config.h> + #include <errno.h> ++#ifdef HAVE_ERROR_H + #include <error.h> ++#else ++#include <err.h> ++#define error(status, errno, ...) err(status, __VA_ARGS__) ++#endif + #include <fcntl.h> + + #include <hidpp10.h> +--- a/tools/hidpp20-dump-page.c ++++ b/tools/hidpp20-dump-page.c +@@ -23,7 +23,12 @@ + + #include <config.h> + #include <errno.h> ++#ifdef HAVE_ERROR_H + #include <error.h> ++#else ++#include <err.h> ++#define error(status, errno, ...) err(status, __VA_ARGS__) ++#endif + #include <fcntl.h> + + #include <hidpp20.h> +--- a/tools/hidpp20-reset.c ++++ b/tools/hidpp20-reset.c +@@ -23,7 +23,12 @@ + + #include <config.h> + #include <errno.h> ++#ifdef HAVE_ERROR_H + #include <error.h> ++#else ++#include <err.h> ++#define error(status, errno, ...) err(status, __VA_ARGS__) ++#endif + #include <fcntl.h> + + #include <hidpp20.h> diff --git a/dev-libs/libratbag/libratbag-0.16.ebuild b/dev-libs/libratbag/libratbag-0.16.ebuild index 9b8dda025eb3..2a174abe96e8 100644 --- a/dev-libs/libratbag/libratbag-0.16.ebuild +++ b/dev-libs/libratbag/libratbag-0.16.ebuild @@ -61,6 +61,10 @@ DEPEND=" dev-libs/gobject-introspection " +PATCHES=( + "${FILESDIR}"/${PN}-0.16-musl-error.h.patch +) + src_prepare() { default
