Commit 6747380f authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

dpdk: When using the DPDK submodule, install it



If the user is using the DPDK submodule, if they run 'make install' then
install DPDK too. Otherwise none of the installed SPDK applications will
work.

For rpmbuild, if the user is building with the DPDK submodule then we
package DPDK libraries into spdk-devel. If they are using an external
DPDK, then we make spdk-devel depend on a suitable DPDK package.

Change-Id: I589e24891e0d13e1c674fae9c76be1df25d9f5aa
Signed-off-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21385


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 9cb9f241
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ MAKE_NUMJOBS := $(shell ps T | sed -nE 's/[[:space:]]*$(MAKE_PID)[[:space:]].* (

all: $(SPDK_ROOT_DIR)/dpdk/build-tmp
	$(Q)# DPDK doesn't handle nested make calls, so unset MAKEFLAGS
	$(Q)env -u MAKEFLAGS ninja -C $(SPDK_ROOT_DIR)/dpdk/build-tmp $(MAKE_NUMJOBS)
	$(Q)env -u MAKEFLAGS meson compile -C $(SPDK_ROOT_DIR)/dpdk/build-tmp $(MAKE_NUMJOBS)
	$(Q) \
	# Meson on FreeBSD sometimes appends --prefix value to the default DESTDIR (which is e.g. \
	# /usr/local) instead of replacing it. --prefix needs to be an absolute path, so we set \
@@ -223,7 +223,28 @@ clean:
	$(Q)rm -rf $(SPDK_ROOT_DIR)/dpdk/build $(SPDK_ROOT_DIR)/dpdk/build-tmp

install:
	@:
	$(Q)cd "$(SPDK_ROOT_DIR)/dpdk"; CC="$(SUB_CC)" meson setup --prefix="$(CONFIG_PREFIX)" --reconfigure build-tmp
	$(Q)env -u MAKEFLAGS meson install -C $(SPDK_ROOT_DIR)/dpdk/build-tmp --no-rebuild
	$(Q)cd "$(SPDK_ROOT_DIR)/dpdk"; CC="$(SUB_CC)" meson setup --prefix="$(MESON_PREFIX)" --reconfigure build-tmp


# meson has no uninstall target. We'll just do our best.
uninstall:
	@:
	$(Q)rm -rf $(DESTDIR)$(CONFIG_PREFIX)/share/dpdk
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/bin/dpdk-*.py
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/rte_*.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/generic/rte_*.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/lib/librte_*
	$(Q)rm -rf $(DESTDIR)$(CONFIG_PREFIX)/lib/dpdk
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/lib/pkgconfig/libdpdk*
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_parse_portlist.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_cirbuf.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_socket.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_vt100.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_rdline.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_parse_string.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_parse_etheraddr.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_parse_ipaddr.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_parse_num.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline_parse.h
	$(Q)rm -f $(DESTDIR)$(CONFIG_PREFIX)/include/cmdline.h
+13 −20
Original line number Diff line number Diff line
@@ -91,15 +91,12 @@ build_macros() {

	if get_config with-shared; then
		macros+=(-D "shared 1")
		macros+=(-D "dpdk 1")
	fi

	if get_config with-dpdk; then
		if ! get_config with-dpdk has-arg; then
		# spdk is requested to build against installed dpdk (i.e. provided by the dist).
		# Don't build dpdk rpm rather define proper requirements for the spdk.
		macros+=(-D "dpdk 0")
			macros+=(-D "shared 1")
		# This maps how Epoch is used inside dpdk packages across different distros. It's
		# mainly relevant when comparing version of required packages. Default maps to 0.
		local -A dpdk_rpm_epoch["fedora"]=2
@@ -109,11 +106,7 @@ build_macros() {
		requirements=${requirements:+$requirements, }"$dpdk_req"
		build_requirements=${build_requirements:+$build_requirements, }"$dpdk_req"
	else
			dpdk_build_path=$(get_config with-dpdk print)
			dpdk_path=$(dirname "$dpdk_build_path")
			macros+=(-D "dpdk_build_path $dpdk_build_path")
			macros+=(-D "dpdk_path $dpdk_path")
		fi
		macros+=(-D "dpdk 1")
	fi

	if get_config with-rbd; then
+36 −51
Original line number Diff line number Diff line
@@ -3,8 +3,6 @@

%{!?deps:%define deps 1}
%{!?dpdk:%define dpdk 0}
%{!?dpdk_build_path:%define dpdk_build_path "dpdk/build"}
%{!?dpdk_path:%define dpdk_path "dpdk"}
%{!?requirements:%define requirements 0}
%{!?build_requirements:%define build_requirements 0}
%{!?shared:%define shared 0}
@@ -89,13 +87,20 @@ git submodule update --init
./configure --disable-unit-tests --disable-tests %{configure}
make %{make}
make DESTDIR=%{buildroot} install %{make}

# Include DPDK libs in case --with-shared is in use.
# DPDK always builds both static and shared, so we need to remove one or the other
# SPDK always builds static, so remove it if we want shared.
%if %{shared}
	rm -f %{buildroot}/usr/local/lib/lib*.a
%endif
%if "%{shared}" != "1"
	rm -f %{buildroot}/usr/local/lib/lib*.so*
	rm -rf %{buildroot}/usr/local/lib/dpdk
%endif
%if %{dpdk}
cfs %{buildroot}/usr/local/lib/dpdk %{dpdk_build_path}/lib/*
# Special case for SPDK_RUN_EXTERNAL_DPDK setup
cl %{buildroot}/usr/local/lib/dpdk %{dpdk_path}/intel-ipsec-mb/
cl %{buildroot}/usr/local/lib/dpdk %{dpdk_path}/isa-l/
# DPDK also installs some python scripts to bin that we do not want to package here
rm -f %{buildroot}/usr/local/bin/dpdk-*.py
# DPDK examples do not need to be packaged in our RPMs
rm -rf %{buildroot}/usr/local/share/dpdk
%endif

# Include libvfio-user libs in case --with-vfio-user is in use together with --with-shared
@@ -111,11 +116,13 @@ mkdir -p %{buildroot}/etc/bash_completion.d
mkdir -p %{buildroot}/etc/profile.d
mkdir -p %{buildroot}/etc/ld.so.conf.d

%if %{shared}
cat <<-EOF > %{buildroot}/etc/ld.so.conf.d/spdk.conf
%{libdir}
/usr/local/lib/dpdk
/usr/local/lib/libvfio-user
EOF
%endif

cat <<-'EOF' > %{buildroot}/etc/profile.d/spdk_path.sh
PATH=$PATH:/usr/libexec/spdk/scripts
@@ -142,63 +149,41 @@ ln -s /usr/local/include %{buildroot}/usr/libexec/spdk
/usr/local/bin/*
/usr/local/lib/python%{python3_version}/site-packages/spdk*/*


%package devel
%if %{shared}
Summary: SPDK development libraries and headers
%endif
%if "%{shared}" != "1"
Summary: SPDK static development libraries and headers
%endif

%description devel
SPDK development libraries and headers

%files devel
/usr/local/include/*
%if %{shared}
%{libdir}/lib*.so
SPDK development libraries and header
%endif
%if "%{shared}" != "1"
SPDK static development libraries and header
%endif

%package libs
Summary:  SPDK libraries

%description libs
SPDK libraries

%files libs
/etc/ld.so.conf.d/*
%{libdir}/lib*.a
%files devel
/usr/local/include/*
%{libdir}/pkgconfig/*.pc
%if %{shared}
%{libdir}/lib*.so.*
%endif

%post libs
ldconfig

%{libdir}/*.so*
/etc/ld.so.conf.d/spdk.conf
%if %{dpdk}
%package dpdk-libs
Summary: DPDK libraries

%description dpdk-libs
DPDK libraries

%files dpdk-libs
/usr/local/lib/dpdk

%post dpdk-libs
ldconfig
%{libdir}/dpdk
%endif

%if %{vfio_user} && %{shared}
%package libvfio-user
Summary: libvfio-user libraries

%description libvfio-user
libvfio-user libraries

%files libvfio-user
%if %{vfio_user}
/usr/local/lib/libvfio-user
%endif
%endif
%if "%{shared}" != "1"
%{libdir}/*.a
%endif

%post libvfio-user
%post devel
ldconfig
%endif

%changelog
* Tue Feb 16 2021 Michal Berger <michalx.berger@intel.com>