xref: /spdk/rpmbuild/spdk.spec (revision 1078198e78653b2f39414c1566740018d76ee73d)
1# Global macros
2%define debug_package %{nil}
3
4%{!?deps:%define deps 1}
5%{!?dpdk:%define dpdk 0}
6%{!?dpdk_build_path:%define dpdk_build_path "dpdk/build"}
7%{!?dpdk_path:%define dpdk_path "dpdk"}
8%{!?requirements:%define requirements 0}
9%{!?build_requirements:%define build_requirements 0}
10%{!?shared:%define shared 0}
11%{!?rbd:%define rbd 0}
12%{!?libdir:%define libdir /usr/local/lib}
13%{!?vfio_user:%define vfio_user 0}
14
15# Spec metadata
16Name:           spdk
17Version:        %{version}
18Release:        %{release}
19Summary:        Storage Performance Development Kit
20
21# This is a minimal set of requirements needed for SPDK apps to run when built with
22# default configuration. These are also predetermined by rpmbuild. Extra requirements
23# can be defined through a comma-separated list passed via $requirements when building
24# the spec.
25Requires: glibc
26Requires: libaio
27Requires: libgcc
28Requires: libstdc++
29Requires: libuuid
30Requires: ncurses-libs
31Requires: numactl-libs
32Requires: openssl-libs
33Requires: zlib
34
35%if %{requirements}
36Requires: %(echo "%{requirements_list}")
37%endif
38
39BuildRequires: python3-devel
40
41%if %{build_requirements}
42BuildRequires: %(echo "%{build_requirements_list}")
43%endif
44
45License:       BSD
46URL:           https://spdk.io
47Source:        spdk-%{version}.tar.gz
48
49%description
50
51The Storage Performance Development Kit (SPDK) provides a set of tools and libraries for
52writing high performance, scalable, user-mode storage applications. It achieves high
53performance by moving all of the necessary drivers into userspace and operating in a
54polled mode instead of relying on interrupts, which avoids kernel context switches and
55eliminates interrupt handling overhead.
56
57%prep
58make clean %{make} &>/dev/null || :
59%setup
60
61%build
62set +x
63
64cfs() {
65	(($# > 1)) || return 0
66
67	local dst=$1 f
68
69	mkdir -p "$dst"
70	shift; for f; do [[ -e $f ]] && cp -a "$f" "$dst"; done
71}
72
73cl() {
74	[[ -e $2 ]] || return 0
75
76	cfs "$1" $(find "$2" -name '*.so*' -type f -o -type l | grep -v .symbols)
77}
78
79%if %{deps}
80_PKGDEP_OPTS="--docs --pmem --rdma --uring"
81%if %{rbd}
82_PKGDEP_OPTS="$_PKGDEP_OPTS --rbd"
83%endif
84./scripts/pkgdep.sh $_PKGDEP_OPTS
85%endif
86
87# Rely mainly on CONFIG
88git submodule update --init
89./configure --disable-unit-tests --disable-tests %{configure}
90make %{make}
91make DESTDIR=%{buildroot} install %{make}
92
93# Include DPDK libs in case --with-shared is in use.
94%if %{dpdk}
95cfs %{buildroot}/usr/local/lib/dpdk %{dpdk_build_path}/lib/*
96# Special case for SPDK_RUN_EXTERNAL_DPDK setup
97cl %{buildroot}/usr/local/lib/dpdk %{dpdk_path}/intel-ipsec-mb/
98cl %{buildroot}/usr/local/lib/dpdk %{dpdk_path}/isa-l/
99%endif
100
101# Include libvfio-user libs in case --with-vfio-user is in use together with --with-shared
102%if %{vfio_user} && %{shared}
103cl %{buildroot}/usr/local/lib/libvfio-user build/libvfio-user/
104%endif
105# Try to include extra binaries that were potentially built
106cfs %{buildroot}/usr/local/bin build/fio
107
108# And some useful setup scripts SPDK uses
109mkdir -p %{buildroot}/usr/libexec/spdk
110mkdir -p %{buildroot}/etc/bash_completion.d
111mkdir -p %{buildroot}/etc/profile.d
112mkdir -p %{buildroot}/etc/ld.so.conf.d
113
114cat <<-EOF > %{buildroot}/etc/ld.so.conf.d/spdk.conf
115%{libdir}
116/usr/local/lib/dpdk
117/usr/local/lib/libvfio-user
118EOF
119
120cat <<-'EOF' > %{buildroot}/etc/profile.d/spdk_path.sh
121PATH=$PATH:/usr/libexec/spdk/scripts
122PATH=$PATH:/usr/libexec/spdk/scripts/vagrant
123PATH=$PATH:/usr/libexec/spdk/test/common/config
124export PATH
125EOF
126
127cfs %{buildroot}/usr/libexec/spdk scripts
128ln -s /usr/libexec/spdk/scripts/bash-completion/spdk %{buildroot}/etc/bash_completion.d/
129
130# We need to take into the account the fact that most of the scripts depend on being
131# run directly from the repo. To workaround it, create common root space under dir
132# like /usr/libexec/spdk and link all potential relative paths the script may try
133# to reference.
134
135# setup.sh uses pci_ids.h
136ln -s /usr/local/include %{buildroot}/usr/libexec/spdk
137
138%files
139/etc/profile.d/*
140/etc/bash_completion.d/*
141/usr/libexec/spdk/*
142/usr/local/bin/*
143%{python3_sitelib}/spdk*/*
144
145
146%package devel
147Summary: SPDK development libraries and headers
148
149%description devel
150SPDK development libraries and headers
151
152%files devel
153/usr/local/include/*
154%if %{shared}
155%{libdir}/lib*.so
156%endif
157
158%package libs
159Summary:  SPDK libraries
160
161%description libs
162SPDK libraries
163
164%files libs
165/etc/ld.so.conf.d/*
166%{libdir}/lib*.a
167%{libdir}/pkgconfig/*.pc
168%if %{shared}
169%{libdir}/lib*.so.*
170%endif
171
172%post libs
173ldconfig
174
175%if %{dpdk}
176%package dpdk-libs
177Summary: DPDK libraries
178
179%description dpdk-libs
180DPDK libraries
181
182%files dpdk-libs
183/usr/local/lib/dpdk
184
185%post dpdk-libs
186ldconfig
187%endif
188
189%if %{vfio_user} && %{shared}
190%package libvfio-user
191Summary: libvfio-user libraries
192
193%description libvfio-user
194libvfio-user libraries
195
196%files libvfio-user
197/usr/local/lib/libvfio-user
198
199%post libvfio-user
200ldconfig
201%endif
202
203%changelog
204* Tue Feb 16 2021 Michal Berger <michalx.berger@intel.com>
205- Initial RPM .spec for the SPDK
206