spdk: enable crypto support (#455199)

This commit is contained in:
Jörg Thalheim
2025-10-31 16:15:28 +00:00
committed by GitHub
2 changed files with 49 additions and 0 deletions

View File

@@ -10,6 +10,10 @@
libaio, libaio,
libbsd, libbsd,
libuuid, libuuid,
nasm,
autoconf,
automake,
libtool,
numactl, numactl,
openssl, openssl,
pkg-config, pkg-config,
@@ -76,24 +80,46 @@ stdenv.mkDerivation rec {
ncurses ncurses
zlib zlib
zstd zstd
nasm
autoconf
automake
libtool
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [
python3.pkgs.configshell-fb python3.pkgs.configshell-fb
]; ];
patches = [
# Otherwise the DPDK version is not detected correctly
# Fix already upstream: https://github.com/spdk/spdk/commit/c3618c42ac3f6fdfcc9c04e29953fd6cf4f71c11
./patches/configure.patch
];
postPatch = '' postPatch = ''
patchShebangs . patchShebangs .
# Override pip install command to use hatchling directly without downloading dependencies # Override pip install command to use hatchling directly without downloading dependencies
substituteInPlace python/Makefile \ substituteInPlace python/Makefile \
--replace-fail "setup_cmd = pip install --prefix=\$(CONFIG_PREFIX)" \ --replace-fail "setup_cmd = pip install --prefix=\$(CONFIG_PREFIX)" \
"setup_cmd = python3 -m pip install --no-deps --no-build-isolation --prefix=\$(CONFIG_PREFIX)" "setup_cmd = python3 -m pip install --no-deps --no-build-isolation --prefix=\$(CONFIG_PREFIX)"
# The nasm detection in the vendored version of isa-l_crypto is broken
# Upstream fix: https://github.com/intel/isa-l_crypto/commit/0850c01cc03e45f77d5883372dd6be983ba163ce
substituteInPlace isa-l-crypto/configure.ac \
--replace-fail "AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0, k1, zmm1;]])])" \
"AC_LANG_CONFTEST([AC_LANG_SOURCE([[vpcompressb zmm0 {k1}, zmm1;]])])"
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;
# Required for the vendored isa-l version to find nasm
preConfigure = ''
export AS=nasm
'';
configureFlags = [ configureFlags = [
"--with-dpdk=${dpdk'}" "--with-dpdk=${dpdk'}"
"--with-crypto"
] ]
++ lib.optional (!stdenv.hostPlatform.isStatic) "--with-shared"; ++ lib.optional (!stdenv.hostPlatform.isStatic) "--with-shared";
@@ -106,6 +132,15 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
unset patchelf unset patchelf
# Clean up rpaths to remove /build references to the vendored isa-l and isa-l_crypto libs
for f in $(find $out/lib $out/bin -executable -type f 2>/dev/null); do
if patchelf --print-rpath "$f" 2>/dev/null | grep /build; then
echo "Stripping rpath of $f"
newrp=$(patchelf --print-rpath "$f" | sed -r "s|/build[^:]*:||g")
patchelf --set-rpath "$newrp" "$f"
fi
done
# SPDK scripts assume that they can read the includes also relative to the scripts. # SPDK scripts assume that they can read the includes also relative to the scripts.
# Therefore we are not copying them into $out/share. # Therefore we are not copying them into $out/share.
mkdir $out/scripts mkdir $out/scripts

View File

@@ -0,0 +1,14 @@
diff --git a/configure b/configure
index b0fdef9ec..413b7a968 100755
--- a/configure
+++ b/configure
@@ -959,6 +959,9 @@
dpdk_ver=$(< "$rootdir/dpdk/VERSION")
elif [[ -f "${CONFIG[DPDK_DIR]}"/../VERSION ]]; then
dpdk_ver=$(< "${CONFIG[DPDK_DIR]}"/../VERSION)
+ elif [[ "${CONFIG[DPDK_LIB_DIR]}" != "" && -e "${CONFIG[DPDK_LIB_DIR]}"/pkgconfig ]]; then
+ # Try pkg-config to figure out the module version
+ dpdk_ver=$(PKG_CONFIG_PATH="${CONFIG[DPDK_LIB_DIR]}"/pkgconfig pkg-config --modversion libdpdk)
fi
echo $dpdk_ver
}