rpmbuild: Handle bare --with-dpdk argument
This is done in order to detect if user wants to build spdk RPMs against DPDK RPMs that might have been installed on the system. This boils down to the following: - if --with-dpdk, with no argument, is detected don't build separate RPM holding DPDK libs since user in this case is most likely interested only in packaging the SPDK so it can coexist with separate DPDK packaging workflow - define install and build requirements for the SPDK RPMs to depend on dpdk-devel RPM Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: I4dd587009da282a114524c74d833fd35ebc5b985 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8349 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
68b6d0ef54
commit
6317642ce6
@ -13,6 +13,20 @@ if [[ $ID != fedora && $ID != centos && $ID != rhel ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_config() {
|
||||
# Intercept part of the ./configure's cmdline we are interested in
|
||||
configure_opts=($(getopt -l "$1::" -o "" -- $configure 2> /dev/null))
|
||||
# Drop "--"
|
||||
configure_opts=("${configure_opts[@]::${#configure_opts[@]}-1}")
|
||||
((${#configure_opts[@]} > 0)) || return 1
|
||||
|
||||
if [[ $2 == has-arg ]]; then
|
||||
[[ -n ${configure_opts[1]} && ${configure_opts[1]} != "''" ]]
|
||||
elif [[ $2 == print ]]; then
|
||||
echo "${configure_opts[1]//\'/}"
|
||||
fi
|
||||
}
|
||||
|
||||
fedora_python_sys_path_workaround() {
|
||||
[[ -z $NO_WORKAROUND ]] || return 0
|
||||
|
||||
@ -59,17 +73,25 @@ build_rpm() (
|
||||
macros+=(-D "_${dir}dir $rpmbuild_dir/$dir")
|
||||
done
|
||||
|
||||
if [[ $configure == *"with-shared"* || $configure == *"with-dpdk"* ]]; then
|
||||
macros+=(-D "dpdk 1")
|
||||
if get_config with-shared; then
|
||||
macros+=(-D "shared 1")
|
||||
macros+=(-D "dpdk 1")
|
||||
fi
|
||||
|
||||
if [[ $configure == *"with-dpdk"* ]]; then
|
||||
dpdk_build_path=${configure#*with-dpdk=}
|
||||
dpdk_build_path=${dpdk_build_path%% *}
|
||||
dpdk_path=${dpdk_build_path%/*}
|
||||
macros+=(-D "dpdk_build_path $dpdk_build_path")
|
||||
macros+=(-D "dpdk_path $dpdk_path")
|
||||
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")
|
||||
requirements=${requirements:+$requirements, }"dpdk-devel >= 19.11"
|
||||
build_requirements=${build_requirements:+$build_requirements, }"dpdk-devel >= 19.11"
|
||||
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
|
||||
fi
|
||||
|
||||
if [[ $deps == no ]]; then
|
||||
@ -81,6 +103,11 @@ build_rpm() (
|
||||
macros+=(-D "requirements_list $requirements")
|
||||
fi
|
||||
|
||||
if [[ -n $build_requirements ]]; then
|
||||
macros+=(-D "build_requirements 1")
|
||||
macros+=(-D "build_requirements_list $build_requirements")
|
||||
fi
|
||||
|
||||
cd "$rootdir"
|
||||
|
||||
fedora_python_sys_path_workaround
|
||||
@ -100,6 +127,7 @@ deps=${DEPS:-yes}
|
||||
make="${MAKEFLAGS:--j $(nproc)}"
|
||||
release=${RPM_RELEASE:-1}
|
||||
requirements=${REQUIREMENTS:-}
|
||||
build_requirements=${BUILD_REQUIREMENTS:-}
|
||||
version=${SPDK_VERSION:-$(get_version)}
|
||||
|
||||
rpmbuild_dir=${BUILDDIR:-"$HOME/rpmbuild"}
|
||||
|
@ -6,6 +6,7 @@
|
||||
%{!?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}
|
||||
|
||||
# Spec metadata
|
||||
@ -32,6 +33,10 @@ Requires: zlib
|
||||
Requires: %(echo "%{requirements_list}")
|
||||
%endif
|
||||
|
||||
%if %{build_requirements}
|
||||
BuildRequires: %(echo "%{build_requirements_list}")
|
||||
%endif
|
||||
|
||||
License: BSD
|
||||
URL: https://spdk.io
|
||||
Source: spdk-%{version}.tar.gz
|
||||
|
Loading…
Reference in New Issue
Block a user