From 044bb1752541d602d5ad487059aa80b6e51a7491 Mon Sep 17 00:00:00 2001 From: Denis Barakthanov Date: Thu, 15 Sep 2022 11:55:46 +0100 Subject: [PATCH] bdev/daos: support custom DAOS installation dir ./configure --with-daos=[DIR] now accepts DAOS installation directory. Signed-off-by: Denis Barakhtanov Change-Id: I16f4e0e41e6f73a32dec452c20aa7b558ca50f33 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14522 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- CONFIG | 1 + configure | 14 ++++++++++++-- mk/spdk.common.mk | 7 +++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CONFIG b/CONFIG index 3ee114863..542c87c74 100644 --- a/CONFIG +++ b/CONFIG @@ -107,6 +107,7 @@ CONFIG_RBD=n # Build DAOS support in bdev modules # Requires daos development libraries CONFIG_DAOS=n +CONFIG_DAOS_DIR= # Build vhost library. CONFIG_VHOST=y diff --git a/configure b/configure index 458802e8e..993427376 100755 --- a/configure +++ b/configure @@ -78,7 +78,7 @@ function usage() { echo " --without-fc If an argument is provided, it is considered a directory containing" echo " libufc.a and fc_lld.h. Otherwise the regular system paths will" echo " be searched." - echo " --with-daos Build DAOS bdev module." + echo " --with-daos[=DIR] Build DAOS bdev module." echo " --without-daos No path required." echo " --with-shared Build spdk shared libraries." echo " --without-shared No path required." @@ -488,6 +488,12 @@ for i in "$@"; do ;; --with-daos) CONFIG[DAOS]=y + CONFIG[DAOS_DIR]="" + ;; + --with-daos=*) + CONFIG[DAOS]=y + check_dir "$i" + CONFIG[DAOS_DIR]=$(readlink -f ${i#*=}) ;; --without-daos) CONFIG[DAOS]=n @@ -1049,9 +1055,13 @@ if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then fi if [[ "${CONFIG[DAOS]}" = "y" ]]; then + daos_build_cmd=("${BUILD_CMD[@]}") + if [[ -n "${CONFIG[DAOS_DIR]}" ]]; then + daos_build_cmd+=(-I"${CONFIG[DAOS_DIR]}"/include -L"${CONFIG[DAOS_DIR]}"/lib64) + fi if ! echo -e '#include \n#include \n' \ 'int main(void) { return 0; }\n' \ - | "${BUILD_CMD[@]}" -lgurt -ldaos -ldaos_common -ldfs - 2> /dev/null; then + | "${daos_build_cmd[@]}" -lgurt -ldaos -ldaos_common -ldfs - 2> /dev/null; then echo "--with-daos requires libdaos, libdaos_common, libdfs and libgurt" echo "Please install then re-run this script." exit 1 diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index cc02de1e5..b84ac222f 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -206,6 +206,13 @@ LDFLAGS += -L$(XNVME_INSTALL_DIR) SYS_LIBS += -lxnvme endif +ifeq ($(CONFIG_DAOS),y) +ifneq ($(CONFIG_DAOS_DIR),) +CFLAGS += -I$(CONFIG_DAOS_DIR)/include +LDFLAGS += -L$(CONFIG_DAOS_DIR)/lib64 +endif +endif + #Attach only if FreeBSD and RDMA is specified with configure ifeq ($(OS),FreeBSD) ifeq ($(CONFIG_RDMA),y)