Adopt upstream standard installation layout now that there is one.

Now that upstream has a sane "make install" target, lets use it.
The layout (inevitably) differs a fair bit from what we had but
better switch now than live with our own invention forevermore.
This commit is contained in:
Panu Matilainen 2016-01-20 16:20:17 +02:00
parent 01bbd4d155
commit 7c36913a2c

View File

@ -93,9 +93,9 @@ Example applications utilizing the Data Plane Development Kit, such
as L2 and L3 forwarding. as L2 and L3 forwarding.
%endif %endif
%define sdkdir %{_libdir}/%{name}-%{version}-sdk %define sdkdir %{_datadir}/%{name}
%define docdir %{_docdir}/%{name}-%{version} %define docdir %{_docdir}/%{name}
%define incdir %{_includedir}/%{name}-%{version} %define incdir %{_includedir}/%{name}
%define pmddir %{_libdir}/%{name}-pmds %define pmddir %{_libdir}/%{name}-pmds
%prep %prep
@ -159,45 +159,16 @@ make V=1 O=%{target}/examples T=%{target} %{?_smp_mflags} examples
%endif %endif
%install %install
# In case dpdk-devel is installed
unset RTE_SDK RTE_INCLUDE RTE_TARGET
# DPDK's "make install" seems a bit broken -- do things manually... %make_install O=%{target} prefix=%{_usr} libdir=%{_libdir}
mkdir -p %{buildroot}%{_bindir} %if ! %{with tools}
cp -a %{target}/app/testpmd %{buildroot}%{_bindir}/testpmd rm -rf %{buildroot}%{sdkdir}/tools
mkdir -p %{buildroot}%{incdir}/ rm -rf %{buildroot}%{_sbindir}/dpdk_nic_bind
cp -Lr %{target}/include/* %{buildroot}%{incdir}/
mkdir -p %{buildroot}%{_libdir}
cp -a %{target}/lib/* %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{docdir}
cp -a %{target}/doc/* %{buildroot}%{docdir}
%if %{with shared}
libext=so
%else
libext=a
%endif
# DPDK apps expect a particular (and somewhat peculiar) directory layout
# for building, arrange for that
mkdir -p %{buildroot}%{sdkdir}/%{target}
mkdir -p %{buildroot}%{sdkdir}/lib
cp -a %{target}/.config %{buildroot}%{sdkdir}/%{target}
ln -s ../lib %{buildroot}%{sdkdir}/%{target}/lib
ln -s ../../include/%{name}-%{version} %{buildroot}%{sdkdir}/include
ln -s ../../../include/%{name}-%{version} %{buildroot}%{sdkdir}/%{target}/include
cp -a mk/ %{buildroot}%{sdkdir}
mkdir -p %{buildroot}%{sdkdir}/scripts
cp -a scripts/*.sh %{buildroot}%{sdkdir}/scripts
# Create library symlinks for the "sdk"
for f in %{buildroot}/%{_libdir}/*.${libext}; do
l=`basename ${f}`
ln -s ../../${l} %{buildroot}%{sdkdir}/lib/${l}
done
%if %{with tools}
cp -p tools/*.py %{buildroot}%{_bindir}
%endif %endif
rm -f %{buildroot}%{sdkdir}/tools/setup.sh
%if %{with examples} %if %{with examples}
find %{target}/examples/ -name "*.map" | xargs rm -f find %{target}/examples/ -name "*.map" | xargs rm -f
@ -205,8 +176,6 @@ for f in %{target}/examples/*/%{target}/app/*; do
bn=`basename ${f}` bn=`basename ${f}`
cp -p ${f} %{buildroot}%{_bindir}/dpdk_example_${bn} cp -p ${f} %{buildroot}%{_bindir}/dpdk_example_${bn}
done done
mkdir -p %{buildroot}%{_datadir}/%{name}-%{version}
cp -a examples/ %{buildroot}%{_datadir}/%{name}-%{version}
%endif %endif
# Create a driver directory with symlinks to all pmds # Create a driver directory with symlinks to all pmds
@ -234,22 +203,19 @@ if ( ! \$RTE_SDK ) then
endif endif
EOF EOF
# Theres no point in packaging any of the tools # Fixup target machine mismatch
# We currently don't need the igb uio script, there sed -i -e 's:-%{machine}-:-default-:g' %{buildroot}/%{_sysconfdir}/profile.d/dpdk-sdk*
# are several uio scripts already available
# And the cpu_layout script functionality is
# covered by lscpu
#cp -a tools %{buildroot}%{datadir}
# Fixup irregular modes in headers
find %{buildroot}%{incdir} -type f | xargs chmod 0644
# Upstream has an option to build a combined library but it's bloatware which # Upstream has an option to build a combined library but it's bloatware which
# wont work at all when library versions start moving, replace it with a # wont work at all when library versions start moving, replace it with a
# linker script which avoids these issues. Linking against the script during # linker script which avoids these issues. Linking against the script during
# build resolves into links to the actual used libraries which is just fine # build resolves into links to the actual used libraries which is just fine
# for us, so this combined library is a build-time only construct now. # for us, so this combined library is a build-time only construct now.
%if %{with shared}
libext=so
%else
libext=a
%endif
comblib=libdpdk.${libext} comblib=libdpdk.${libext}
echo "GROUP (" > ${comblib} echo "GROUP (" > ${comblib}
@ -260,9 +226,8 @@ install -m 644 ${comblib} %{buildroot}/%{_libdir}/${comblib}
%files %files
# BSD # BSD
%{_bindir}/* %{_bindir}/testpmd
%exclude %{_bindir}/*.py %{_bindir}/dpdk_proc_info
%exclude %{_bindir}/dpdk_example_*
%if %{with shared} %if %{with shared}
%{_libdir}/*.so.* %{_libdir}/*.so.*
%{pmddir}/ %{pmddir}/
@ -276,6 +241,12 @@ install -m 644 ${comblib} %{buildroot}/%{_libdir}/${comblib}
#BSD #BSD
%{incdir}/ %{incdir}/
%{sdkdir} %{sdkdir}
%if %{with tools}
%exclude %{sdkdir}/tools/
%endif
%if %{with examples}
%exclude %{sdkdir}/examples/
%endif
%{_sysconfdir}/profile.d/dpdk-sdk-*.* %{_sysconfdir}/profile.d/dpdk-sdk-*.*
%if ! %{with shared} %if ! %{with shared}
%{_libdir}/*.a %{_libdir}/*.a
@ -285,14 +256,14 @@ install -m 644 ${comblib} %{buildroot}/%{_libdir}/${comblib}
%if %{with tools} %if %{with tools}
%files tools %files tools
%{_bindir}/*.py %{sdkdir}/tools/
%{_sbindir}/dpdk_nic_bind
%endif %endif
%if %{with examples} %if %{with examples}
%files examples %files examples
%{_bindir}/dpdk_example_* %{_bindir}/dpdk_example_*
%exclude %{_bindir}/*.py %doc %{sdkdir}/examples
%{_datadir}/%{name}-%{version}/examples
%endif %endif
%changelog %changelog
@ -302,6 +273,7 @@ install -m 644 ${comblib} %{buildroot}/%{_libdir}/${comblib}
- Move the unversioned pmd symlinks from libdir -devel - Move the unversioned pmd symlinks from libdir -devel
- Make option matching stricter in spec setconf - Make option matching stricter in spec setconf
- Spec cleanups - Spec cleanups
- Adopt upstream standard installation layout
* Thu Oct 22 2015 Aaron Conole <aconole@redhat.com> - 2.1.0-3 * Thu Oct 22 2015 Aaron Conole <aconole@redhat.com> - 2.1.0-3
- Include examples binaries - Include examples binaries