2021-06-15 16:57:36 +00:00
|
|
|
# Global macros
|
2021-02-16 15:07:33 +00:00
|
|
|
%define debug_package %{nil}
|
|
|
|
|
|
|
|
%{!?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}
|
2021-06-15 17:04:38 +00:00
|
|
|
%{!?build_requirements:%define build_requirements 0}
|
2021-02-16 15:07:33 +00:00
|
|
|
%{!?shared:%define shared 0}
|
2022-06-08 12:43:12 +00:00
|
|
|
%{!?libdir:%define libdir /usr/local/lib}
|
2022-09-30 09:21:19 +00:00
|
|
|
%{!?vfio_user:%define vfio_user 0}
|
2021-02-16 15:07:33 +00:00
|
|
|
|
2021-06-15 16:57:36 +00:00
|
|
|
# Spec metadata
|
|
|
|
Name: spdk
|
|
|
|
Version: %{version}
|
|
|
|
Release: %{release}
|
|
|
|
Summary: Storage Performance Development Kit
|
|
|
|
|
2021-02-16 15:07:33 +00:00
|
|
|
# This is a minimal set of requirements needed for SPDK apps to run when built with
|
|
|
|
# default configuration. These are also predetermined by rpmbuild. Extra requirements
|
|
|
|
# can be defined through a comma-separated list passed via $requirements when building
|
|
|
|
# the spec.
|
|
|
|
Requires: glibc
|
|
|
|
Requires: libaio
|
|
|
|
Requires: libgcc
|
|
|
|
Requires: libstdc++
|
|
|
|
Requires: libuuid
|
|
|
|
Requires: ncurses-libs
|
|
|
|
Requires: numactl-libs
|
|
|
|
Requires: openssl-libs
|
|
|
|
Requires: zlib
|
|
|
|
|
|
|
|
%if %{requirements}
|
2021-06-15 16:57:36 +00:00
|
|
|
Requires: %(echo "%{requirements_list}")
|
2021-02-16 15:07:33 +00:00
|
|
|
%endif
|
|
|
|
|
2021-09-21 13:21:31 +00:00
|
|
|
BuildRequires: python3-devel
|
|
|
|
|
2021-06-15 17:04:38 +00:00
|
|
|
%if %{build_requirements}
|
|
|
|
BuildRequires: %(echo "%{build_requirements_list}")
|
|
|
|
%endif
|
|
|
|
|
2021-06-15 16:57:36 +00:00
|
|
|
License: BSD
|
|
|
|
URL: https://spdk.io
|
|
|
|
Source: spdk-%{version}.tar.gz
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
|
|
|
The Storage Performance Development Kit (SPDK) provides a set of tools and libraries for
|
|
|
|
writing high performance, scalable, user-mode storage applications. It achieves high
|
|
|
|
performance by moving all of the necessary drivers into userspace and operating in a
|
|
|
|
polled mode instead of relying on interrupts, which avoids kernel context switches and
|
|
|
|
eliminates interrupt handling overhead.
|
|
|
|
|
2021-02-16 15:07:33 +00:00
|
|
|
%prep
|
2022-09-30 08:46:57 +00:00
|
|
|
make clean %{make} &>/dev/null || :
|
2021-02-16 15:07:33 +00:00
|
|
|
%setup
|
|
|
|
|
|
|
|
%build
|
2022-09-30 09:10:09 +00:00
|
|
|
cfs() {
|
|
|
|
(($# > 1)) || return 0
|
|
|
|
|
|
|
|
local dst=$1 f
|
|
|
|
|
|
|
|
mkdir -p "$dst"
|
|
|
|
shift; for f; do [[ -e $f ]] && cp -a "$f" "$dst"; done
|
|
|
|
}
|
|
|
|
|
2022-09-30 09:25:45 +00:00
|
|
|
cl() {
|
|
|
|
[[ -e $2 ]] || return 0
|
|
|
|
|
|
|
|
cfs "$1" $(find "$2" -name '*.so*' -type f -o -type l | grep -v .symbols)
|
|
|
|
}
|
|
|
|
|
2021-02-16 15:07:33 +00:00
|
|
|
%if %{deps}
|
|
|
|
./scripts/pkgdep.sh --docs --pmem --rdma --uring
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# Rely mainly on CONFIG
|
|
|
|
./configure --disable-unit-tests --disable-tests %{configure}
|
|
|
|
make %{make}
|
2022-09-30 08:46:57 +00:00
|
|
|
make DESTDIR=%{buildroot} install %{make}
|
2021-02-16 15:07:33 +00:00
|
|
|
|
|
|
|
# Include DPDK libs in case --with-shared is in use.
|
|
|
|
%if %{dpdk}
|
2022-09-30 09:10:09 +00:00
|
|
|
cfs %{buildroot}/usr/local/lib/dpdk %{dpdk_build_path}/lib/*
|
2021-02-16 15:07:33 +00:00
|
|
|
# Special case for SPDK_RUN_EXTERNAL_DPDK setup
|
2022-09-30 09:25:45 +00:00
|
|
|
cl %{buildroot}/usr/local/lib/dpdk %{dpdk_path}/intel-ipsec-mb/
|
|
|
|
cl %{buildroot}/usr/local/lib/dpdk %{dpdk_path}/isa-l/
|
2021-02-16 15:07:33 +00:00
|
|
|
%endif
|
|
|
|
|
2022-09-30 09:21:19 +00:00
|
|
|
# Include libvfio-user libs in case --with-vfio-user is in use together with --with-shared
|
|
|
|
%if %{vfio_user} && %{shared}
|
2022-09-30 09:25:45 +00:00
|
|
|
cl %{buildroot}/usr/local/lib/libvfio-user build/libvfio-user/
|
2022-09-30 09:21:19 +00:00
|
|
|
%endif
|
2022-09-30 08:48:59 +00:00
|
|
|
# Try to include extra binaries that were potentially built
|
2022-09-30 09:10:09 +00:00
|
|
|
cfs %{buildroot}/usr/local/bin build/fio
|
2021-02-16 15:07:33 +00:00
|
|
|
|
|
|
|
# And some useful setup scripts SPDK uses
|
|
|
|
mkdir -p %{buildroot}/usr/libexec/spdk
|
|
|
|
mkdir -p %{buildroot}/etc/bash_completion.d
|
|
|
|
mkdir -p %{buildroot}/etc/profile.d
|
|
|
|
mkdir -p %{buildroot}/etc/ld.so.conf.d
|
2021-09-21 13:21:31 +00:00
|
|
|
mkdir -p %{buildroot}%{python3_sitelib}
|
2021-02-16 15:07:33 +00:00
|
|
|
|
|
|
|
cat <<-EOF > %{buildroot}/etc/ld.so.conf.d/spdk.conf
|
2022-06-08 12:43:12 +00:00
|
|
|
%{libdir}
|
2021-02-16 15:07:33 +00:00
|
|
|
/usr/local/lib/dpdk
|
2022-09-30 09:21:19 +00:00
|
|
|
/usr/local/lib/libvfio-user
|
2021-02-16 15:07:33 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<-'EOF' > %{buildroot}/etc/profile.d/spdk_path.sh
|
|
|
|
PATH=$PATH:/usr/libexec/spdk/scripts
|
|
|
|
PATH=$PATH:/usr/libexec/spdk/scripts/vagrant
|
|
|
|
PATH=$PATH:/usr/libexec/spdk/test/common/config
|
|
|
|
export PATH
|
|
|
|
EOF
|
|
|
|
|
2022-09-30 09:10:09 +00:00
|
|
|
cfs %{buildroot}/usr/libexec/spdk scripts
|
|
|
|
cfs %{buildroot}%{python3_sitelib} python/spdk
|
2021-02-16 15:07:33 +00:00
|
|
|
ln -s /usr/libexec/spdk/scripts/bash-completion/spdk %{buildroot}/etc/bash_completion.d/
|
|
|
|
|
|
|
|
# We need to take into the account the fact that most of the scripts depend on being
|
|
|
|
# run directly from the repo. To workaround it, create common root space under dir
|
|
|
|
# like /usr/libexec/spdk and link all potential relative paths the script may try
|
|
|
|
# to reference.
|
|
|
|
|
|
|
|
# setup.sh uses pci_ids.h
|
|
|
|
ln -s /usr/local/include %{buildroot}/usr/libexec/spdk
|
|
|
|
|
|
|
|
%files
|
|
|
|
/etc/profile.d/*
|
|
|
|
/etc/bash_completion.d/*
|
|
|
|
/usr/libexec/spdk/*
|
|
|
|
/usr/local/bin/*
|
2021-09-21 13:21:31 +00:00
|
|
|
%{python3_sitelib}/spdk/*
|
2021-02-16 15:07:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
%package devel
|
|
|
|
Summary: SPDK development libraries and headers
|
|
|
|
|
|
|
|
%description devel
|
|
|
|
SPDK development libraries and headers
|
|
|
|
|
|
|
|
%files devel
|
|
|
|
/usr/local/include/*
|
|
|
|
%if %{shared}
|
2022-06-08 12:43:12 +00:00
|
|
|
%{libdir}/lib*.so
|
2021-02-16 15:07:33 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%package libs
|
|
|
|
Summary: SPDK libraries
|
|
|
|
|
|
|
|
%description libs
|
|
|
|
SPDK libraries
|
|
|
|
|
|
|
|
%files libs
|
|
|
|
/etc/ld.so.conf.d/*
|
2022-06-08 12:43:12 +00:00
|
|
|
%{libdir}/lib*.a
|
|
|
|
%{libdir}/pkgconfig/*.pc
|
2021-02-16 15:07:33 +00:00
|
|
|
%if %{shared}
|
2022-06-08 12:43:12 +00:00
|
|
|
%{libdir}/lib*.so.*
|
2021-02-16 15:07:33 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%post libs
|
|
|
|
ldconfig
|
|
|
|
|
|
|
|
%if %{dpdk}
|
|
|
|
%package dpdk-libs
|
|
|
|
Summary: DPDK libraries
|
|
|
|
|
|
|
|
%description dpdk-libs
|
|
|
|
DPDK libraries
|
|
|
|
|
|
|
|
%files dpdk-libs
|
|
|
|
/usr/local/lib/dpdk
|
|
|
|
|
|
|
|
%post dpdk-libs
|
|
|
|
ldconfig
|
|
|
|
%endif
|
|
|
|
|
2022-09-30 09:21:19 +00:00
|
|
|
%if %{vfio_user} && %{shared}
|
|
|
|
%package libvfio-user
|
|
|
|
Summary: libvfio-user libraries
|
|
|
|
|
|
|
|
%description libvfio-user
|
|
|
|
libvfio-user libraries
|
|
|
|
|
|
|
|
%files libvfio-user
|
|
|
|
/usr/local/lib/libvfio-user
|
|
|
|
|
|
|
|
%post libvfio-user
|
|
|
|
ldconfig
|
|
|
|
%endif
|
|
|
|
|
2021-02-16 15:07:33 +00:00
|
|
|
%changelog
|
|
|
|
* Tue Feb 16 2021 Michal Berger <michalx.berger@intel.com>
|
|
|
|
- Initial RPM .spec for the SPDK
|