[PATCH rdma-core 9/9] rpm: Add flag to include static libraries in the build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that we can produce them properly, make it easy to add them.

Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@xxxxxxxx>
---

Tested both ways on centos7 and tumbleweed

 redhat/rdma-core.spec | 15 +++++++++++++++
 suse/rdma-core.spec   | 18 +++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index c281c5fa4e2c..644c3ffd01bf 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -10,6 +10,8 @@ Summary: RDMA core userspace libraries and daemons
 License: GPLv2 or BSD
 Url: https://github.com/linux-rdma/rdma-core
 Source: rdma-core-%{version}.tgz
+# Do not build static libs by default.
+%define with_static %{?_with_static: 1} %{?!_with_static: 0}
 
 BuildRequires: binutils
 BuildRequires: cmake >= 2.8.11
@@ -73,6 +75,13 @@ Obsoletes: librdmacm-devel < %{version}-%{release}
 Requires: ibacm = %{version}-%{release}
 Provides: ibacm-devel = %{version}-%{release}
 Obsoletes: ibacm-devel < %{version}-%{release}
+%if %{with_static}
+# Since our pkg-config files include private references to these packages they
+# need to have their .pc files installed too, even for dynamic linking, or
+# pkg-config breaks.
+BuildRequires: pkgconfig(libnl-3.0)
+BuildRequires: pkgconfig(libnl-route-3.0)
+%endif
 
 %description devel
 RDMA core development libraries and headers.
@@ -233,6 +242,9 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
          -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
          -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
          -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
+%if %{with_static}
+         -DENABLE_STATIC=1 \
+%endif
          %{EXTRA_CMAKE_FLAGS}
 %make_jobs
 
@@ -352,6 +364,9 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %dir %{_includedir}/rdma
 %{_includedir}/infiniband/*
 %{_includedir}/rdma/*
+%if %{with_static}
+%{_libdir}/lib*.a
+%endif
 %{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*.pc
 %{_mandir}/man3/ibv_*
diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec
index 4bb4086cdc78..3eafce39afd2 100644
--- a/suse/rdma-core.spec
+++ b/suse/rdma-core.spec
@@ -17,6 +17,9 @@
 
 
 %bcond_without  systemd
+# Do not build static libs by default.
+%define with_static %{?_with_static: 1} %{?!_with_static: 0}
+
 %define         git_ver %{nil}
 Name:           rdma-core
 Version:        21.0
@@ -143,7 +146,14 @@ Obsoletes:      librdmacm-devel < %{version}-%{release}
 #Requires:       ibacm = %%{version}-%%{release}
 Provides:       ibacm-devel = %{version}-%{release}
 Obsoletes:      ibacm-devel < %{version}-%{release}
-
+%if %{with_static}
+# Since our pkg-config files include private references to these packages they
+# need to have their .pc files installed too, even for dynamic linking, or
+# pkg-config breaks.
+BuildRequires: pkgconfig(libnl-3.0)
+BuildRequires: pkgconfig(libnl-route-3.0)
+%endif
+ 
 %description devel
 RDMA core development libraries and headers.
 
@@ -348,6 +358,9 @@ on those changes.
          -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
          -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
          -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
+%if %{with_static}
+         -DENABLE_STATIC=1 \
+%endif
          %{EXTRA_CMAKE_FLAGS}
 %make_jobs
 
@@ -526,6 +539,9 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %dir %{_includedir}/rdma
 %{_includedir}/infiniband/*
 %{_includedir}/rdma/*
+%if %{with_static}
+%{_libdir}/lib*.a
+%endif
 %{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*.pc
 %{_mandir}/man3/ibv_*
-- 
2.18.0


Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux