Spdk/rpmbuild/spdk.spec

166 lines
4.3 KiB
RPMSpec
Raw Normal View History

# Global macros
%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}
%{!?build_requirements:%define build_requirements 0}
%{!?shared:%define shared 0}
%{!?libdir:%define libdir /usr/local/lib}
# Spec metadata
Name: spdk
Version: %{version}
Release: %{release}
Summary: Storage Performance Development Kit
# 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}
Requires: %(echo "%{requirements_list}")
%endif
BuildRequires: python3-devel
%if %{build_requirements}
BuildRequires: %(echo "%{build_requirements_list}")
%endif
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.
%prep
make clean %{make} &>/dev/null || :
%setup
%build
%if %{deps}
./scripts/pkgdep.sh --docs --pmem --rdma --uring
%endif
# Rely mainly on CONFIG
./configure --disable-unit-tests --disable-tests %{configure}
make %{make}
make DESTDIR=%{buildroot} install %{make}
# Include DPDK libs in case --with-shared is in use.
%if %{dpdk}
mkdir -p %{buildroot}/usr/local/lib/dpdk
cp -a %{dpdk_build_path}/lib/* %{buildroot}/usr/local/lib/dpdk/
# Special case for SPDK_RUN_EXTERNAL_DPDK setup
[[ -e %{dpdk_path}/intel-ipsec-mb ]] && find %{dpdk_path}/intel-ipsec-mb/ -name '*.so*' -exec cp -a {} %{buildroot}/usr/local/lib/dpdk/ ';'
[[ -e %{dpdk_path}/isa-l/build/lib ]] && cp -a %{dpdk_path}/isa-l/build/lib/*.so* %{buildroot}/usr/local/lib/dpdk/
%endif
# Try to include extra binaries that were potentially built
docker: Add docker-compose for building basic SPDK containers This suite can be used to deploy containers with the following functionality (more details in README.md): - storage-target - proxy-container - traffic-generator This will run simple fio test as per fio.conf against nvmf controller provided by initiator-container. Similar task can be performed directly from initiator-container as well. Each container includes SPDK installation with most common tools, e.g. rpc.py, available under $PATH. This allows for something like: docker-compose exec storage-target rpc.py nvmf_get_subsystems Note that SPDK environment heavily depends on a running kernel hence all the containers need to be privileged. That said, to make sure containers are not affecting the host too much, some tasks must be done prior running them. This includes: - loading proper kernel modules (like nvme-fabrics, etc.) - allocating hugepages and having at least one hugetlbfs mount available under /dev/hugepages base_build is created as docker multi-stage build. This is done in order to decrease the size of the final image. The SPDK RPMs are built inside a base image and then copied over to the main image (+ fio binary) - this leaves all the dependencies inside the intermediate image instead of the final one. The resulted difference in size may look similar to the following (it may differ depending on the docker version etc.): no multi-stage build: spdk_base == 1.04GB multi-stage build: spdk_base == 261MB Signed-off-by: Michal Berger <michalx.berger@intel.com> Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I825bd0d0bb4071bd9d44b6a0749c033894899ae0 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9055 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Monica Kenguva <monica.kenguva@intel.com> Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-08-03 07:16:49 +00:00
[[ -e build/fio ]] && cp -a build/fio %{buildroot}/usr/local/bin/fio
# 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
mkdir -p %{buildroot}%{python3_sitelib}
cat <<-EOF > %{buildroot}/etc/ld.so.conf.d/spdk.conf
%{libdir}
/usr/local/lib/dpdk
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
cp -a scripts %{buildroot}/usr/libexec/spdk/scripts
cp -a python/spdk %{buildroot}%{python3_sitelib}
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/*
%{python3_sitelib}/spdk/*
%package devel
Summary: SPDK development libraries and headers
%description devel
SPDK development libraries and headers
%files devel
/usr/local/include/*
%if %{shared}
%{libdir}/lib*.so
%endif
%package libs
Summary: SPDK libraries
%description libs
SPDK libraries
%files libs
/etc/ld.so.conf.d/*
%{libdir}/lib*.a
%{libdir}/pkgconfig/*.pc
%if %{shared}
%{libdir}/lib*.so.*
%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
%changelog
* Tue Feb 16 2021 Michal Berger <michalx.berger@intel.com>
- Initial RPM .spec for the SPDK