From 5bcd22452f5ee559b0c6b0a0c4ef195deec57a7b Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 2 Oct 2023 07:15:04 +0000 Subject: [PATCH] sys-libs/libnvme: Sync with Gentoo It's from Gentoo commit 48ce7ec21d023e0a4d7f068bf340f96c2ec19f4e. --- .../portage-stable/sys-libs/libnvme/Manifest | 1 + .../libnvme/files/libnvme-1.6-musl.patch | 90 +++++++++++++++++++ .../sys-libs/libnvme/libnvme-1.6.ebuild | 81 +++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 sdk_container/src/third_party/portage-stable/sys-libs/libnvme/files/libnvme-1.6-musl.patch create mode 100644 sdk_container/src/third_party/portage-stable/sys-libs/libnvme/libnvme-1.6.ebuild diff --git a/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/Manifest b/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/Manifest index cc7d25a235..f48655de85 100644 --- a/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/Manifest +++ b/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/Manifest @@ -2,3 +2,4 @@ DIST libnvme-1.2.tar.gz 484397 BLAKE2B ae6b1c3aa8f45594219470059cfc8982674433772 DIST libnvme-1.3.tar.gz 499870 BLAKE2B 5a019c12829890a0fe0b5e6aec5fbd009fc3bd6dfe7e81f61731292f4ea8b03044e7625491479350c399cc8cd5bc023e02cc9e93f1eba38f4c747667e84cfb24 SHA512 c874b29b73e55be842f71e74a226a76fcd50dfa72e2be100f0437bc83e740cd146b6d2f2cdaa940c11c3d8c48ff2c065ac0e8a83d4d0dde743edf4179f328670 DIST libnvme-1.4.tar.gz 506101 BLAKE2B c1496c6258bf20ed4109710b06671fa7f0e27c7649520ad8ccf4021df00fffc45f80fea248d62d2b85eecc8b15b6afaf4a113d96d6737ae6772346c9d0bc1002 SHA512 cc4a0a78083471e912736d76e4faaa5c285e1149029560f212ff06254863e8f21b48fcb1638599bd68efcf888312a248fb748d23776af03574b39fbd9b2a418d DIST libnvme-1.5.tar.gz 566715 BLAKE2B 2111a6929bc17949f03c39fdb247420bba371641b38e30cc7bc4b61a859471d1bfaa27d0dd3bb41379a3a59bb493ff9ce9006460aaf0b900c7ce40410701c03b SHA512 0a19eca2dd7c48c9da3123767c3c789dfb7528d6f5b2b2dfdc8af7cd64e1d724fb81c6002b9821ce916cc7adb6b5e5e28253f1d73131188b0559c6d276a7d07c +DIST libnvme-1.6.tar.gz 597676 BLAKE2B 8b47b268154574688a909d0664df55eda38d9f133373fabcffe987ede03e0c531f88126e0dc50204d74fb2fa665af6379aa5205757bfc5863926db8402fbab27 SHA512 ae6a95ed75bbdc6f8c5c5608eaad8bcaf60a08348ddff356bd47258da2bd2470bdaa45747cdb7ba24f10db093fc0ab95f8bda076a45cbb87e155e3158ef726f8 diff --git a/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/files/libnvme-1.6-musl.patch b/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/files/libnvme-1.6-musl.patch new file mode 100644 index 0000000000..bc10378203 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/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 +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 to avoid a conflict and conditionally +define the right one for the system. + +Bug: https://bugs.gentoo.org/914921 +Signed-off-by: Sam James +--- 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 ++ 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 +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 +--- 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/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/libnvme-1.6.ebuild b/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/libnvme-1.6.ebuild new file mode 100644 index 0000000000..e20cb3c1ea --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-libs/libnvme/libnvme-1.6.ebuild @@ -0,0 +1,81 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +inherit python-r1 meson + +DESCRIPTION="C Library for NVM Express on Linux" +HOMEPAGE="https://github.com/linux-nvme/libnvme" +SRC_URI="https://github.com/linux-nvme/libnvme/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="LGPL-2.1+" +SLOT="0/1" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" +IUSE="dbus +json keyutils python ssl test +uuid" +RESTRICT="!test? ( test )" + +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) +" + +DEPEND=" + json? ( dev-libs/json-c:= ) + keyutils? ( sys-apps/keyutils:= ) + dbus? ( sys-apps/dbus:= ) + python? ( ${PYTHON_DEPS} ) + ssl? ( >=dev-libs/openssl-1.1:= ) + uuid? ( sys-apps/util-linux:= ) +" +RDEPEND=" + ${DEPEND} +" +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) + $(meson_feature ssl openssl) + $(meson_feature python) + ) + meson_src_configure +} + +python_compile() { + local emesonargs=( + -Dpython=enabled + ) + meson_src_configure --reconfigure + meson_src_compile +} + +src_compile() { + meson_src_compile + + if use python; then + python_copy_sources + python_foreach_impl python_compile + fi +} + +python_install() { + meson_src_install + use python && python_optimize +} + +src_install() { + use python && python_foreach_impl python_install + + meson_src_install +}