Add a spec option to build as shared libraries, default to static for now

This commit is contained in:
Panu Matilainen 2015-01-28 11:28:50 +02:00
parent 38bb65f078
commit ae10511010

View File

@ -1,5 +1,7 @@
# Add option to enable combined library (--with combined) # Add option to enable combined library (--with combined)
%bcond_with combined %bcond_with combined
# Add option to build as shared libraries (--with shared)
%bcond_with shared
Name: dpdk Name: dpdk
Version: 1.7.0 Version: 1.7.0
@ -41,7 +43,9 @@ fast packet processing in the user space.
%package devel %package devel
Summary: Data Plane Development Kit development files Summary: Data Plane Development Kit development files
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
%if ! %{with shared}
Provides: %{name}-static = %{version}-%{release} Provides: %{name}-static = %{version}-%{release}
%endif
%description devel %description devel
This package contains the headers and other files needed for developing This package contains the headers and other files needed for developing
@ -61,6 +65,11 @@ API programming documentation for the Data Plane Development Kit.
%setup -q %setup -q
%patch1 -p1 -z .config %patch1 -p1 -z .config
%if %{with shared}
sed -i 's:^CONFIG_RTE_BUILD_SHARED_LIB=n$:CONFIG_RTE_BUILD_SHARED_LIB=y:g' config/common_linuxapp
%endif
%build %build
export EXTRA_CFLAGS="%{optflags}" export EXTRA_CFLAGS="%{optflags}"
@ -127,7 +136,13 @@ find %{buildroot}%{_includedir}/%{name}-%{version} -type f | xargs chmod 0644
# with symbol/library versioning once it lands. Use a linker script to # with symbol/library versioning once it lands. Use a linker script to
# avoid the issue. # avoid the issue.
%if %{with combined} %if %{with combined}
%if %{with shared}
libext=so
%else
libext=a libext=a
%endif
comblib=libintel_dpdk.${libext} comblib=libintel_dpdk.${libext}
echo "GROUP (" > ${comblib} echo "GROUP (" > ${comblib}
@ -141,6 +156,9 @@ install -m 644 ${comblib} %{buildroot}/%{_libdir}/%{name}-%{version}/${comblib}
# BSD # BSD
%{_bindir}/* %{_bindir}/*
%dir %{_libdir}/%{name}-%{version} %dir %{_libdir}/%{name}-%{version}
%if %{with shared}
%{_libdir}/%{name}-%{version}/*.so
%endif
%files doc %files doc
#BSD #BSD
@ -151,11 +169,14 @@ install -m 644 ${comblib} %{buildroot}/%{_libdir}/%{name}-%{version}/${comblib}
%{_includedir}/* %{_includedir}/*
%{sdkdir} %{sdkdir}
%{_sysconfdir}/profile.d/dpdk-sdk-*.* %{_sysconfdir}/profile.d/dpdk-sdk-*.*
%if ! %{with shared}
%{_libdir}/%{name}-%{version}/*.a %{_libdir}/%{name}-%{version}/*.a
%endif
%changelog %changelog
* Wed Jan 27 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-7 * Wed Jan 27 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-7
- Policy compliance: move static libraries to -devel, provide dpdk-static - Policy compliance: move static libraries to -devel, provide dpdk-static
- Add a spec option to build as shared libraries
* Wed Jan 27 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-6 * Wed Jan 27 2015 Panu Matilainen <pmatilai@redhat.com> - 1.7.0-6
- Avoid variable expansion in the spec here-documents during build - Avoid variable expansion in the spec here-documents during build