configure: Build against installed DPDK instance
Interpret bare --with-dpdk opt as user's request to find installed (provided by the distro) DPDK's libs|include files and use them during the build. Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: I9da99671b95af0121194b3a6d53636b0ded71f1b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8348 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Tom Nabarro <tom.nabarro@intel.com> Reviewed-by: <tomasz.rochumski@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
52652c30cb
commit
7232c450f9
4
CONFIG
4
CONFIG
@ -89,6 +89,10 @@ CONFIG_ENV=
|
||||
# This directory should contain 'include' and 'lib' directories for your DPDK
|
||||
# installation.
|
||||
CONFIG_DPDK_DIR=
|
||||
# Automatically set via pkg-config when bare --with-dpdk is set
|
||||
CONFIG_DPDK_LIB_DIR=
|
||||
CONFIG_DPDK_INC_DIR=
|
||||
CONFIG_DPDK_PKG_CONFIG=n
|
||||
|
||||
# This directory should contain 'include' and 'lib' directories for WPDK.
|
||||
CONFIG_WPDK_DIR=
|
||||
|
2
Makefile
2
Makefile
@ -58,11 +58,13 @@ export MAKE_PID := $(shell echo $$PPID)
|
||||
ifeq ($(SPDK_ROOT_DIR)/lib/env_dpdk,$(CONFIG_ENV))
|
||||
ifeq ($(CURDIR)/dpdk/build,$(CONFIG_DPDK_DIR))
|
||||
ifneq ($(SKIP_DPDK_BUILD),1)
|
||||
ifneq ($(CONFIG_DPDK_PKG_CONFIG),y)
|
||||
DPDKBUILD = dpdkbuild
|
||||
DIRS-y += dpdkbuild
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows)
|
||||
ifeq ($(CURDIR)/wpdk/build,$(CONFIG_WPDK_DIR))
|
||||
|
23
configure
vendored
23
configure
vendored
@ -284,6 +284,17 @@ for i in "$@"; do
|
||||
--disable-cet)
|
||||
CONFIG[CET]=n
|
||||
;;
|
||||
--with-dpdk)
|
||||
if pkg-config --exists libdpdk; then
|
||||
CONFIG[DPDK_LIB_DIR]=$(pkg-config --variable=libdir libdpdk)
|
||||
CONFIG[DPDK_INC_DIR]=$(pkg-config --variable=includedir libdpdk)
|
||||
CONFIG[DPDK_PKG_CONFIG]=y
|
||||
CFLAGS="${CFLAGS:+$CFLAGS }$(pkg-config --cflags libdpdk)"
|
||||
else
|
||||
echo "libdpdk.pc not found, aborting"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--with-dpdk=*)
|
||||
check_dir "$i"
|
||||
CONFIG[DPDK_DIR]=$(readlink -f ${i#*=})
|
||||
@ -535,7 +546,7 @@ fi
|
||||
if [ -z "${CONFIG[ENV]}" ]; then
|
||||
CONFIG[ENV]=$rootdir/lib/env_dpdk
|
||||
echo "Using default SPDK env in ${CONFIG[ENV]}"
|
||||
if [ -z "${CONFIG[DPDK_DIR]}" ]; then
|
||||
if [[ -z "${CONFIG[DPDK_DIR]}" && "${CONFIG[DPDK_PKG_CONFIG]}" == n ]]; then
|
||||
if [ ! -f "$rootdir"/dpdk/config/meson.build ]; then
|
||||
echo "DPDK not found; please specify --with-dpdk=<path> or run:"
|
||||
echo
|
||||
@ -547,7 +558,7 @@ if [ -z "${CONFIG[ENV]}" ]; then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -n "${CONFIG[DPDK_DIR]}" ]; then
|
||||
if [[ -n "${CONFIG[DPDK_DIR]}" || "${CONFIG[DPDK_PKG_CONFIG]}" == y ]]; then
|
||||
echo "--with-env and --with-dpdk are mutually exclusive."
|
||||
exit 1
|
||||
fi
|
||||
@ -564,6 +575,14 @@ else
|
||||
CONFIG[VIRTIO]="n"
|
||||
fi
|
||||
|
||||
if [[ "${CONFIG[DPDK_PKG_CONFIG]}" == y ]]; then
|
||||
if [[ "${CONFIG[SHARED]}" == n ]]; then
|
||||
# dpdk-devel doesn't provide static libs
|
||||
echo "Build against packaged DPDK requested, enabling shared libraries"
|
||||
CONFIG[SHARED]=y
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $sys_name == "Windows" ]]; then
|
||||
if [ -z "${CONFIG[WPDK_DIR]}" ]; then
|
||||
if [ ! -f "$rootdir"/wpdk/Makefile ]; then
|
||||
|
@ -51,7 +51,7 @@ LIBDPDK_PKGCONFIG = $(call pkgconfig_filename,spdk_dpdklibs)
|
||||
|
||||
$(LIBDPDK_PKGCONFIG): $(PKGCONFIG) $(PKGCONFIG_INST)
|
||||
$(Q)$(SPDK_ROOT_DIR)/scripts/pc_libs.sh \
|
||||
"-L$(DPDK_ABS_DIR)/lib $(DPDK_LIB_LIST:%=-l%)" "" DPDK spdk_dpdklibs > $@
|
||||
"-L$(DPDK_LIB_DIR) $(DPDK_LIB_LIST:%=-l%)" "" DPDK spdk_dpdklibs > $@
|
||||
$(Q)sed -i.bak '5s,.*,Requires: $(DEPDIRS-$(LIBNAME):%=spdk_%) spdk_dpdklibs,' $(PKGCONFIG) ; rm $(PKGCONFIG).bak
|
||||
$(Q)sed -i.bak '5s,.*,Requires: $(DEPDIRS-$(LIBNAME):%=spdk_%) spdk_dpdklibs,' $(PKGCONFIG_INST) ; rm $(PKGCONFIG_INST).bak
|
||||
|
||||
|
@ -41,11 +41,22 @@ DPDK_DIR = $(CONFIG_DPDK_DIR)
|
||||
|
||||
export DPDK_ABS_DIR = $(abspath $(DPDK_DIR))
|
||||
|
||||
ifneq ($(CONFIG_DPDK_LIB_DIR),)
|
||||
DPDK_LIB_DIR = $(CONFIG_DPDK_LIB_DIR)
|
||||
else
|
||||
DPDK_LIB_DIR = $(DPDK_ABS_DIR)/lib
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DPDK_INC_DIR),)
|
||||
DPDK_INC_DIR = $(CONFIG_DPDK_INC_DIR)
|
||||
else
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/include/rte_config.h))
|
||||
DPDK_INC_DIR := $(DPDK_ABS_DIR)/include
|
||||
else
|
||||
DPDK_INC_DIR := $(DPDK_ABS_DIR)/include/dpdk
|
||||
endif
|
||||
endif
|
||||
|
||||
DPDK_INC := -I$(DPDK_INC_DIR)
|
||||
|
||||
DPDK_LIB_LIST = rte_eal rte_mempool rte_ring rte_mbuf rte_bus_pci rte_pci rte_mempool_ring
|
||||
@ -55,7 +66,7 @@ DPDK_LIB_LIST += rte_power rte_ethdev rte_net
|
||||
endif
|
||||
|
||||
# DPDK 20.05 eal dependency
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_telemetry.*))
|
||||
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_telemetry.*))
|
||||
DPDK_LIB_LIST += rte_telemetry
|
||||
endif
|
||||
|
||||
@ -66,7 +77,7 @@ DPDK_FRAMEWORK=n
|
||||
ifeq ($(CONFIG_CRYPTO),y)
|
||||
DPDK_FRAMEWORK=y
|
||||
DPDK_LIB_LIST += rte_reorder
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_crypto_aesni_mb.*))
|
||||
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_crypto_aesni_mb.*))
|
||||
DPDK_LIB_LIST += rte_crypto_aesni_mb
|
||||
else
|
||||
# PMD name for DPDK 20.08 and earlier
|
||||
@ -76,7 +87,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_REDUCE),y)
|
||||
DPDK_FRAMEWORK=y
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_compress_isal.*))
|
||||
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_compress_isal.*))
|
||||
DPDK_LIB_LIST += rte_compress_isal
|
||||
else
|
||||
# PMD name for DPDK 20.08 and earlier
|
||||
@ -86,7 +97,7 @@ endif
|
||||
|
||||
ifeq ($(DPDK_FRAMEWORK),y)
|
||||
DPDK_LIB_LIST += rte_cryptodev rte_compressdev rte_bus_vdev
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_common_qat.*))
|
||||
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_common_qat.*))
|
||||
DPDK_LIB_LIST += rte_common_qat
|
||||
else
|
||||
# PMD name for DPDK 20.08 and earlier
|
||||
@ -94,7 +105,7 @@ DPDK_LIB_LIST += rte_pmd_qat
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_kvargs.*))
|
||||
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_kvargs.*))
|
||||
DPDK_LIB_LIST += rte_kvargs
|
||||
endif
|
||||
|
||||
@ -114,13 +125,13 @@ endif
|
||||
|
||||
ifeq ($(LINK_HASH),y)
|
||||
DPDK_LIB_LIST += rte_hash
|
||||
ifneq (, $(wildcard $(DPDK_ABS_DIR)/lib/librte_rcu.*))
|
||||
ifneq (, $(wildcard $(DPDK_LIB_DIR)/librte_rcu.*))
|
||||
DPDK_LIB_LIST += rte_rcu
|
||||
endif
|
||||
endif
|
||||
|
||||
DPDK_SHARED_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%.so)
|
||||
DPDK_STATIC_LIB = $(DPDK_LIB_LIST:%=$(DPDK_ABS_DIR)/lib/lib%.a)
|
||||
DPDK_SHARED_LIB = $(DPDK_LIB_LIST:%=$(DPDK_LIB_DIR)/lib%.so)
|
||||
DPDK_STATIC_LIB = $(DPDK_LIB_LIST:%=$(DPDK_LIB_DIR)/lib%.a)
|
||||
DPDK_SHARED_LIB_LINKER_ARGS = $(call add_no_as_needed,$(DPDK_SHARED_LIB))
|
||||
DPDK_STATIC_LIB_LINKER_ARGS = $(call add_whole_archive,$(DPDK_STATIC_LIB))
|
||||
|
||||
@ -160,12 +171,12 @@ endif
|
||||
ifeq ($(CONFIG_SHARED),y)
|
||||
ENV_DPDK_FILE = $(call spdk_lib_list_to_shared_libs,env_dpdk)
|
||||
ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_SHARED_LIB)
|
||||
DPDK_LINKER_ARGS = -Wl,-rpath-link $(DPDK_ABS_DIR)/lib $(DPDK_SHARED_LIB_LINKER_ARGS)
|
||||
DPDK_LINKER_ARGS = -Wl,-rpath-link $(DPDK_LIB_DIR) $(DPDK_SHARED_LIB_LINKER_ARGS)
|
||||
ENV_LINKER_ARGS = $(ENV_DPDK_FILE) $(DPDK_LINKER_ARGS)
|
||||
else
|
||||
ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk)
|
||||
ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_STATIC_LIB)
|
||||
DPDK_LINKER_ARGS = -Wl,-rpath-link $(DPDK_ABS_DIR)/lib $(DPDK_STATIC_LIB_LINKER_ARGS)
|
||||
DPDK_LINKER_ARGS = -Wl,-rpath-link $(DPDK_LIB_DIR) $(DPDK_STATIC_LIB_LINKER_ARGS)
|
||||
ENV_LINKER_ARGS = $(ENV_DPDK_FILE) $(DPDK_LINKER_ARGS)
|
||||
ENV_LINKER_ARGS += $(DPDK_PRIVATE_LINKER_ARGS)
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user