commit: 48ce7ec21d023e0a4d7f068bf340f96c2ec19f4e Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Sep 30 05:48:55 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Sep 30 05:49:04 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48ce7ec2
sys-libs/libnvme: fix musl build, conditionally build tests Closes: https://bugs.gentoo.org/914921 Signed-off-by: Sam James <sam <AT> gentoo.org> sys-libs/libnvme/files/libnvme-1.6-musl.patch | 90 +++++++++++++++++++++++++++ sys-libs/libnvme/libnvme-1.6.ebuild | 8 ++- 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/sys-libs/libnvme/files/libnvme-1.6-musl.patch b/sys-libs/libnvme/files/libnvme-1.6-musl.patch new file mode 100644 index 000000000000..bc1037820311 --- /dev/null +++ b/sys-libs/libnvme/files/libnvme-1.6-musl.patch @@ -0,0 +1,90 @@ +https://github.com/linux-nvme/libnvme/pull/724 + +From f78a97acf9cdec1031d81f0e8a3956fc8f28c33c Mon Sep 17 00:00:00 2001 +From: Sam James <s...@gentoo.org> +Date: Sat, 30 Sep 2023 06:38:53 +0100 +Subject: [PATCH 1/2] test: handle POSIX ioctl prototype + +glibc has the following prototype for ioctl: int ioctl(int fd, unsigned long request, ...) +POSIX (inc. musl) has the following for ioctl: int ioctl(int fd, int request, ...) + +Check which prototype is used in <sys/ioctl.h> to avoid a conflict and conditionally +define the right one for the system. + +Bug: https://bugs.gentoo.org/914921 +Signed-off-by: Sam James <s...@gentoo.org> +--- a/meson.build ++++ b/meson.build +@@ -230,6 +230,16 @@ conf.set( + ), + description: 'Is network address and service translation available' + ) ++conf.set( ++ 'HAVE_GLIBC_IOCTL', ++ cc.compiles( ++ '''#include <sys/ioctl.h> ++ int ioctl(int fd, unsigned long request, ...); ++ ''', ++ name: 'ioctl has glibc-style prototype' ++ ), ++ description: 'Is ioctl the glibc interface (rather than POSIX)' ++) + + if cc.has_function_attribute('fallthrough') + conf.set('fallthrough', '__attribute__((__fallthrough__))') +--- a/test/ioctl/mock.c ++++ b/test/ioctl/mock.c +@@ -114,7 +114,11 @@ void end_mock_cmds(void) + } \ + }) + ++#ifdef HAVE_GLIBC_IOCTL + int ioctl(int fd, unsigned long request, ...) ++#else ++int ioctl(int fd, int request, ...) ++#endif + { + struct mock_cmds *mock_cmds; + bool result64; +@@ -141,7 +145,7 @@ int ioctl(int fd, unsigned long request, ...) + result64 = true; + break; + default: +- fail("unexpected %s %lu", __func__, request); ++ fail("unexpected %s %lu", __func__, (unsigned long) request); + } + check(mock_cmds->remaining_cmds, + "unexpected %s command", mock_cmds->name); + +From 149c006d23da60e168485ede722730dc2b725e6b Mon Sep 17 00:00:00 2001 +From: Sam James <s...@gentoo.org> +Date: Sat, 30 Sep 2023 06:43:39 +0100 +Subject: [PATCH 2/2] meson: make building tests conditional + +Just like we do for docs. + +Signed-off-by: Sam James <s...@gentoo.org> +--- a/meson.build ++++ b/meson.build +@@ -273,7 +273,9 @@ subdir('internal') + subdir('ccan') + subdir('src') + subdir('libnvme') +-subdir('test') ++if get_option('tests') ++ subdir('test') ++endif + subdir('examples') + subdir('doc') + +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -6,6 +6,7 @@ option('rstdir', type : 'string', value : '', description : 'directory for ReST + + option('docs', type : 'combo', choices : ['false', 'html', 'man', 'rst', 'all'], description : 'install documentation') + option('docs-build', type : 'boolean', value : false, description : 'build documentation') ++option('tests', type : 'boolean', value : true, description : 'build tests') + + option('python', type : 'feature', value: 'auto', description : 'Generate libnvme python bindings') + option('openssl', type : 'feature', value: 'auto', description : 'OpenSSL support') + diff --git a/sys-libs/libnvme/libnvme-1.6.ebuild b/sys-libs/libnvme/libnvme-1.6.ebuild index 2ecf469e67da..e20cb3c1eac4 100644 --- a/sys-libs/libnvme/libnvme-1.6.ebuild +++ b/sys-libs/libnvme/libnvme-1.6.ebuild @@ -13,7 +13,8 @@ SRC_URI="https://github.com/linux-nvme/libnvme/archive/refs/tags/v${PV}.tar.gz - LICENSE="LGPL-2.1+" SLOT="0/1" KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" -IUSE="dbus +json keyutils python ssl +uuid" +IUSE="dbus +json keyutils python ssl test +uuid" +RESTRICT="!test? ( test )" REQUIRED_USE=" python? ( ${PYTHON_REQUIRED_USE} ) @@ -34,9 +35,14 @@ BDEPEND=" dev-lang/swig " +PATCHES=( + "${FILESDIR}"/${PN}-1.6-musl.patch +) + src_configure() { local emesonargs=( -Dpython=false + $(meson_use test tests) $(meson_feature json json-c) $(meson_feature dbus libdbus) $(meson_feature keyutils)