Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37843833
en ru br
Репозитории ALT

Группа :: Development/Tools
Пакет: spdk

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: spdk-23.05-alpinelinux-use-system-isal.patch
Скачать


--- a/CONFIG
+++ b/CONFIG
@@ -164,6 +164,9 @@
 
 # Build ISA-L library
 CONFIG_ISAL=y
+CONFIG_ISAL_INC_DIR=
+CONFIG_ISAL_LIB_DIR=
+CONFIG_ISAL_PKG_CONFIG=n
 
 # Build ISA-L-crypto library
 CONFIG_ISAL_CRYPTO=y
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,9 @@
 DIRS-$(CONFIG_APPS) += app
 DIRS-y += test
 DIRS-$(CONFIG_IPSEC_MB) += ipsecbuild
+ifneq ($(CONFIG_ISAL_PKG_CONFIG),y)
 DIRS-$(CONFIG_ISAL) += isalbuild
+endif
 DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild
 DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild
 DIRS-$(CONFIG_SMA) += proto
@@ -60,10 +62,12 @@
 DPDK_DEPS += ipsecbuild
 endif
 
+ifneq ($(CONFIG_ISAL_PKG_CONFIG),y)
 ifeq ($(CONFIG_ISAL),y)
 ISALBUILD = isalbuild
 LIB += isalbuild
 DPDK_DEPS += isalbuild
+endif
 ifeq ($(CONFIG_ISAL_CRYPTO),y)
 ISALCRYPTOBUILD = isalcryptobuild
 LIB += isalcryptobuild
--- a/configure
+++ b/configure
@@ -60,6 +60,8 @@
 	echo "                           Implies --without-dpdk."
 	echo " --with-idxd               Build the IDXD library and accel framework plug-in module."
 	echo " --without-idxd            Disabled while experimental. Only built for x86 when enabled."
+	echo " --with-system-isal        Build against a system isa-l version. By default, the isa-l"
+	echo "                           submodule in spdk tree will be used."
 	echo " --with-crypto             Build isa-l-crypto and vbdev crypto module. No path required."
 	echo " --without-crypto          Disable isa-l-crypto and vbdev crypto module."
 	echo " --with-fio[=DIR]          Build fio_plugin."
@@ -428,6 +430,22 @@
 		--without-dpdk)
 			CONFIG[DPDK_DIR]=
 			;;
+		--with-system-isal)
+			# Can we use pkg-config?
+			if command -v "pkg-config" > /dev/null 2>&1 && pkg-config --exists libisal; then
+				isal_libdir=$(pkg-config --variable=libdir libisal)
+				isal_libdir=$(readlink -f $isal_libdir)
+				isal_incdir=$(pkg-config --variable=includedir libisal)
+				echo "Using isa-l lib dir $isal_libdir"
+				CONFIG[ISAL_LIB_DIR]=$isal_libdir
+				CONFIG[ISAL_INC_DIR]=$isal_incdir
+				CONFIG[ISAL_PKG_CONFIG]=y
+				CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libisal)"
+			else
+				echo "libisal.pc not found, aborting"
+				exit 1
+			fi
+			;;
 		--with-wpdk=*)
 			check_dir "$i"
 			CONFIG[WPDK_DIR]=$(readlink -f ${i#*=})
@@ -1160,87 +1178,16 @@
 	exit 1
 fi
 
-if [[ $arch == x86_64* ]] || [[ $arch == aarch64* ]]; then
+if [[ "${CONFIG[ISAL_PKG_CONFIG]}" = "y" ]]; then
+	echo "Using system ISA-L"
 	CONFIG[ISAL]=y
-	# make sure the submodule is initialized
-	if [ ! -f "$rootdir"/isa-l/autogen.sh ]; then
-		echo "ISA-L is required but was not found, please init the submodule with:"
-		echo "  git submodule update --init"
-		echo "and then re-run this script."
-		exit 1
-	fi
-	# for x86 only, check the nasm version for ISA-L and IPSEC
-	if [[ $arch == x86_64* ]]; then
-		ver=$(nasm -v 2> /dev/null | awk '{print $3}' | awk -Fr '{print $1}')
-		if lt "$ver" 2.14; then
-			CONFIG[ISAL]=n
-			# IPSEC has nasm requirement and DPDK crypto relies on IPSEC
-			CONFIG[IPSEC_MB]=n
-			echo "WARNING: ISA-L & DPDK crypto cannot be used as nasm ver must be 2.14 or newer."
-		fi
-	fi
-	# check gas version on aarch64
-	if [[ $arch == aarch64* ]]; then
-		ver=$(as --version 2> /dev/null | awk 'NR==1{print $7}')
-		if lt "$ver" 2.24; then
-			# ISA-L, compression & crypto require gas version 2.24 or newer.
-			CONFIG[ISAL]=n
-			echo "Notice: ISA-L, compression & crypto require GAS version 2.24 or newer. Turning off default ISA-L and crypto features."
-		elif lt "$ver" 2.34; then
-			#For gas v2.24~v2.34, sve2 instructions are not supported. To workaround it, sve2 optimization should be disabled
-			ISAL_CRYPTO_OPTS+=("--disable-sve2")
-		fi
-	fi
 else
-	# for PPC
 	CONFIG[ISAL]=n
-	echo "WARNING: ISA-L cannot be used due to architecture incompatibility."
+	echo "WARNING: ISA-L not installed."
 fi
 
-# now either configure ISA-L or disable unavailable features
-if [[ "${CONFIG[ISAL]}" = "y" ]]; then
-	cd $rootdir/isa-l
-	ISAL_LOG=$rootdir/isa-l/spdk-isal.log
-	if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then
-		ISAL_OPTS=("--host=${CONFIG[CROSS_PREFIX]}")
-	else
-		ISAL_OPTS=()
-	fi
-	echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..."
-	./autogen.sh &> $ISAL_LOG
-	./configure CFLAGS="-fPIC -g -O2" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1
-	echo "done."
-	cd $rootdir
-else
-	echo "Without ISA-L, there is no software support for crypto or compression,"
-	echo "so these features will be disabled."
-	CONFIG[CRYPTO]=n
-	CONFIG[VBDEV_COMPRESS]=n
-	CONFIG[DPDK_COMPRESSDEV]=n
-fi
-
 # ISA-L-crypto complements ISA-L functionality, it is only enabled together with ISA-L
 if [[ "${CONFIG[ISAL]}" = "y" ]]; then
-	if [ ! -f "$rootdir"/isa-l-crypto/autogen.sh ]; then
-		echo "ISA-L-crypto is required but was not found, please init the submodule with:"
-		echo "  git submodule update --init"
-		echo "and then re-run this script."
-		exit 1
-	fi
-
-	cd $rootdir/isa-l-crypto
-	ISAL_CRYPTO_LOG=$rootdir/isa-l-crypto/spdk-isal-crypto.log
-	if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then
-		ISAL_CRYPTO_OPTS+=("--host=${CONFIG[CROSS_PREFIX]}")
-	fi
-	ISAL_CRYPTO_OPTS+=("--enable-shared=no")
-	echo -n "Configuring ISA-L-crypto (logfile: $ISAL_CRYPTO_LOG)..."
-	./autogen.sh &> $ISAL_CRYPTO_LOG
-	./configure CFLAGS="-fPIC -g -O2" "${ISAL_CRYPTO_OPTS[@]}" >> $ISAL_CRYPTO_LOG 2>&1
-	echo "done."
-	cd $rootdir
-	CONFIG[ISAL_CRYPTO]=y
-else
 	CONFIG[ISAL_CRYPTO]=n
 fi
 
--- a/lib/accel/accel_sw.c
+++ b/lib/accel/accel_sw.c
@@ -19,8 +19,8 @@
 #include "spdk/xor.h"
 
 #ifdef SPDK_CONFIG_ISAL
-#include "../isa-l/include/igzip_lib.h"
-#ifdef SPDK_CONFIG_ISAL_CRYPTO
+#include "isa-l/igzip_lib.h"
+#if defined(SPDK_CONFIG_ISAL_CRYPTO)
 #include "../isa-l-crypto/include/aes_xts.h"
 #endif
 #endif
--- a/lib/util/crc16.c
+++ b/lib/util/crc16.c
@@ -11,7 +11,7 @@
  */
 
 #ifdef SPDK_CONFIG_ISAL
-#include "isa-l/include/crc.h"
+#include "isa-l/crc.h"
 
 uint16_t
 spdk_crc16_t10dif(uint16_t init_crc, const void *buf, size_t len)
--- a/lib/util/crc_internal.h
+++ b/lib/util/crc_internal.h
@@ -10,7 +10,7 @@
 
 #ifdef SPDK_CONFIG_ISAL
 #define SPDK_HAVE_ISAL
-#include <isa-l/include/crc.h>
+#include <isa-l/crc.h>
 #elif defined(__aarch64__) && defined(__ARM_FEATURE_CRC32)
 #define SPDK_HAVE_ARM_CRC
 #include <arm_acle.h>
--- a/lib/util/xor.c
+++ b/lib/util/xor.c
@@ -85,7 +85,7 @@
 }
 
 #ifdef SPDK_CONFIG_ISAL
-#include "isa-l/include/raid.h"
+#include "isa-l/raid.h"
 
 #define SPDK_XOR_BUF_ALIGN 32
 
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin