diff mbox series

[rdma-core,9/9] rpm: Include static libraries in the build

Message ID 20181023205701.3729-10-jgg@ziepe.ca (mailing list archive)
State Not Applicable
Headers show
Series Build static libraries in rdma-core | expand

Commit Message

Jason Gunthorpe Oct. 23, 2018, 8:57 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

Now that we can produce them properly, add them.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 redhat/rdma-core.spec | 7 +++++++
 suse/rdma-core.spec   | 8 ++++++++
 2 files changed, 15 insertions(+)

Comments

Nicolas Morey-Chaisemartin Oct. 24, 2018, 10:43 a.m. UTC | #1
On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
>
> Now that we can produce them properly, add them.
>
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>
> --- a/suse/rdma-core.spec
> +++ b/suse/rdma-core.spec
> @@ -144,6 +144,12 @@ Obsoletes:      librdmacm-devel < %{version}-%{release}
>  Provides:       ibacm-devel = %{version}-%{release}
>  Obsoletes:      ibacm-devel < %{version}-%{release}
>  
> +# 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)
> +
>  %description devel
>  RDMA core development libraries and headers.
>  
> @@ -348,6 +354,7 @@ on those changes.
>           -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
>           -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
>           -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
> +         -DENABLE_STATIC=1 \
>           %{EXTRA_CMAKE_FLAGS}
>  %make_jobs
>  
> @@ -526,6 +533,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
>  %dir %{_includedir}/rdma
>  %{_includedir}/infiniband/*
>  %{_includedir}/rdma/*
> +%{_libdir}/lib*.a
>  %{_libdir}/lib*.so
>  %{_libdir}/pkgconfig/*.pc
>  %{_mandir}/man3/ibv_*

SUSE packaging policy does not allow for static libraries (apart from a few rare exceptions).
Thus, they shouldn't enable them by default. I'm not against adding a RPM option to enable it if needed.

Nicolas
Jason Gunthorpe Oct. 24, 2018, 3:24 p.m. UTC | #2
On Wed, Oct 24, 2018 at 12:43:52PM +0200, Nicolas Morey-Chaisemartin wrote:
> 
> 
> On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
> > From: Jason Gunthorpe <jgg@mellanox.com>
> >
> > Now that we can produce them properly, add them.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> >
> > +++ b/suse/rdma-core.spec
> > @@ -144,6 +144,12 @@ Obsoletes:      librdmacm-devel < %{version}-%{release}
> >  Provides:       ibacm-devel = %{version}-%{release}
> >  Obsoletes:      ibacm-devel < %{version}-%{release}
> >  
> > +# 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)
> > +
> >  %description devel
> >  RDMA core development libraries and headers.
> >  
> > @@ -348,6 +354,7 @@ on those changes.
> >           -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
> >           -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
> >           -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
> > +         -DENABLE_STATIC=1 \
> >           %{EXTRA_CMAKE_FLAGS}
> >  %make_jobs
> >  
> > @@ -526,6 +533,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
> >  %dir %{_includedir}/rdma
> >  %{_includedir}/infiniband/*
> >  %{_includedir}/rdma/*
> > +%{_libdir}/lib*.a
> >  %{_libdir}/lib*.so
> >  %{_libdir}/pkgconfig/*.pc
> >  %{_mandir}/man3/ibv_*
> 
> SUSE packaging policy does not allow for static libraries (apart
> from a few rare exceptions).  Thus, they shouldn't enable them by
> default. I'm not against adding a RPM option to enable it if needed.

Sure, I'll drop the patch to the suse/rdma-core.spec from this series.

Thanks,
Jason
Doug Ledford Oct. 25, 2018, 2 p.m. UTC | #3
On Wed, 2018-10-24 at 12:43 +0200, Nicolas Morey-Chaisemartin wrote:
> 
> On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
> > From: Jason Gunthorpe <jgg@mellanox.com>
> > 
> > Now that we can produce them properly, add them.
> > 
> > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> > ---
> > 
> > --- a/suse/rdma-core.spec
> > +++ b/suse/rdma-core.spec
> > @@ -144,6 +144,12 @@ Obsoletes:      librdmacm-devel < %{version}-%{release}
> >  Provides:       ibacm-devel = %{version}-%{release}
> >  Obsoletes:      ibacm-devel < %{version}-%{release}
> >  
> > +# 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)
> > +
> >  %description devel
> >  RDMA core development libraries and headers.
> >  
> > @@ -348,6 +354,7 @@ on those changes.
> >           -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
> >           -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
> >           -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
> > +         -DENABLE_STATIC=1 \
> >           %{EXTRA_CMAKE_FLAGS}
> >  %make_jobs
> >  
> > @@ -526,6 +533,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
> >  %dir %{_includedir}/rdma
> >  %{_includedir}/infiniband/*
> >  %{_includedir}/rdma/*
> > +%{_libdir}/lib*.a
> >  %{_libdir}/lib*.so
> >  %{_libdir}/pkgconfig/*.pc
> >  %{_mandir}/man3/ibv_*
> 
> SUSE packaging policy does not allow for static libraries (apart from a few rare exceptions).
> Thus, they shouldn't enable them by default. I'm not against adding a RPM option to enable it if needed.

Red Hat/Fedora have the same policy BTW.  As far as Red Hat is
concerned, it's all about making sure that security updates to libraries
actually make it into use and insecure, broken libraries don't stay
hanging around because they are statically linked into something.
Jason Gunthorpe Oct. 25, 2018, 2:18 p.m. UTC | #4
On Thu, Oct 25, 2018 at 10:00:06AM -0400, Doug Ledford wrote:
> On Wed, 2018-10-24 at 12:43 +0200, Nicolas Morey-Chaisemartin wrote:
> > 
> > On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
> > > From: Jason Gunthorpe <jgg@mellanox.com>
> > > 
> > > Now that we can produce them properly, add them.
> > > 
> > > Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> > > 
> > > +++ b/suse/rdma-core.spec
> > > @@ -144,6 +144,12 @@ Obsoletes:      librdmacm-devel < %{version}-%{release}
> > >  Provides:       ibacm-devel = %{version}-%{release}
> > >  Obsoletes:      ibacm-devel < %{version}-%{release}
> > >  
> > > +# 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)
> > > +
> > >  %description devel
> > >  RDMA core development libraries and headers.
> > >  
> > > @@ -348,6 +354,7 @@ on those changes.
> > >           -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
> > >           -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
> > >           -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
> > > +         -DENABLE_STATIC=1 \
> > >           %{EXTRA_CMAKE_FLAGS}
> > >  %make_jobs
> > >  
> > > @@ -526,6 +533,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
> > >  %dir %{_includedir}/rdma
> > >  %{_includedir}/infiniband/*
> > >  %{_includedir}/rdma/*
> > > +%{_libdir}/lib*.a
> > >  %{_libdir}/lib*.so
> > >  %{_libdir}/pkgconfig/*.pc
> > >  %{_mandir}/man3/ibv_*
> > 
> > SUSE packaging policy does not allow for static libraries (apart from a few rare exceptions).
> > Thus, they shouldn't enable them by default. I'm not against adding a RPM option to enable it if needed.
> 
> Red Hat/Fedora have the same policy BTW.  As far as Red Hat is
> concerned, it's all about making sure that security updates to libraries
> actually make it into use and insecure, broken libraries don't stay
> hanging around because they are statically linked into something.

Some of the distros have asked for this, do you want to just drop the
patches enabling this in packaging and leave it up to the packagers
for now?

Jason
Nicolas Morey-Chaisemartin Oct. 25, 2018, 3:31 p.m. UTC | #5
On 10/25/18 4:18 PM, Jason Gunthorpe wrote:
> On Thu, Oct 25, 2018 at 10:00:06AM -0400, Doug Ledford wrote:
>> On Wed, 2018-10-24 at 12:43 +0200, Nicolas Morey-Chaisemartin wrote:
>>> On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
>>>> From: Jason Gunthorpe <jgg@mellanox.com>
>>>>
>>>> Now that we can produce them properly, add them.
>>>>
>>>> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
>>>>
>>> SUSE packaging policy does not allow for static libraries (apart from a few rare exceptions).
>>> Thus, they shouldn't enable them by default. I'm not against adding a RPM option to enable it if needed.
>> Red Hat/Fedora have the same policy BTW.  As far as Red Hat is
>> concerned, it's all about making sure that security updates to libraries
>> actually make it into use and insecure, broken libraries don't stay
>> hanging around because they are statically linked into something.
> Some of the distros have asked for this, do you want to just drop the
> patches enabling this in packaging and leave it up to the packagers
> for now?
>
> Jason

If people have asked for this on RPM based distro, let's add a flag (disabled by default) for both RHEL and SUSE so any outside packager ( OFED ? ) can enable it very easily.

Nicolas
Jason Gunthorpe Oct. 25, 2018, 3:53 p.m. UTC | #6
On Thu, Oct 25, 2018 at 05:31:46PM +0200, Nicolas Morey-Chaisemartin wrote:
> 
> 
> On 10/25/18 4:18 PM, Jason Gunthorpe wrote:
> > On Thu, Oct 25, 2018 at 10:00:06AM -0400, Doug Ledford wrote:
> >> On Wed, 2018-10-24 at 12:43 +0200, Nicolas Morey-Chaisemartin wrote:
> >>> On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
> >>>> From: Jason Gunthorpe <jgg@mellanox.com>
> >>>>
> >>>> Now that we can produce them properly, add them.
> >>>>
> >>>> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> >>>>
> >>> SUSE packaging policy does not allow for static libraries (apart
> >>> from a few rare exceptions).  Thus, they shouldn't enable them
> >>> by default. I'm not against adding a RPM option to enable it if
> >>> needed.
> >> Red Hat/Fedora have the same policy BTW.  As far as Red Hat is
> >> concerned, it's all about making sure that security updates to
> >> libraries actually make it into use and insecure, broken
> >> libraries don't stay hanging around because they are statically
> >> linked into something.
> > Some of the distros have asked for this, do you want to just drop the
> > patches enabling this in packaging and leave it up to the packagers
> > for now?
> 
> If people have asked for this on RPM based distro, let's add a flag
> (disabled by default) for both RHEL and SUSE so any outside packager
> ( OFED ? ) can enable it very easily.

Sure, I've never used rpmbuild flags, can you give an quick example?

Jason
Jarod Wilson Oct. 25, 2018, 4:42 p.m. UTC | #7
On 2018-10-25 11:53 AM, Jason Gunthorpe wrote:
> On Thu, Oct 25, 2018 at 05:31:46PM +0200, Nicolas Morey-Chaisemartin wrote:
>>
>>
>> On 10/25/18 4:18 PM, Jason Gunthorpe wrote:
>>> On Thu, Oct 25, 2018 at 10:00:06AM -0400, Doug Ledford wrote:
>>>> On Wed, 2018-10-24 at 12:43 +0200, Nicolas Morey-Chaisemartin wrote:
>>>>> On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
>>>>>> From: Jason Gunthorpe <jgg@mellanox.com>
>>>>>>
>>>>>> Now that we can produce them properly, add them.
>>>>>>
>>>>>> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
>>>>>>
>>>>> SUSE packaging policy does not allow for static libraries (apart
>>>>> from a few rare exceptions).  Thus, they shouldn't enable them
>>>>> by default. I'm not against adding a RPM option to enable it if
>>>>> needed.
>>>> Red Hat/Fedora have the same policy BTW.  As far as Red Hat is
>>>> concerned, it's all about making sure that security updates to
>>>> libraries actually make it into use and insecure, broken
>>>> libraries don't stay hanging around because they are statically
>>>> linked into something.
>>> Some of the distros have asked for this, do you want to just drop the
>>> patches enabling this in packaging and leave it up to the packagers
>>> for now?
>>
>> If people have asked for this on RPM based distro, let's add a flag
>> (disabled by default) for both RHEL and SUSE so any outside packager
>> ( OFED ? ) can enable it very easily.
> 
> Sure, I've never used rpmbuild flags, can you give an quick example?

Something like this:

diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index c281c5fa..19154ff5 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -11,6 +11,8 @@ License: GPLv2 or BSD
  Url: https://github.com/linux-rdma/rdma-core
  Source: rdma-core-%{version}.tgz

+%define with_static %{?_with_static: 1} %{?!_with_static: 0}
+
  BuildRequires: binutils
  BuildRequires: cmake >= 2.8.11
  BuildRequires: gcc
@@ -233,6 +235,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 +357,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_*

The junk at the top should allow you to do 'rpmbuild -bb --with static 
rdma-core.spec', but for simplicity, you could also simply %define 
with_static 0, and let people edit it to 1 to enable (which is probably 
better for a distro case).
Nicolas Morey-Chaisemartin Oct. 25, 2018, 4:47 p.m. UTC | #8
On 10/25/18 6:42 PM, Jarod Wilson wrote:
> On 2018-10-25 11:53 AM, Jason Gunthorpe wrote:
>> On Thu, Oct 25, 2018 at 05:31:46PM +0200, Nicolas Morey-Chaisemartin wrote:
>>>
>>>
>>> On 10/25/18 4:18 PM, Jason Gunthorpe wrote:
>>>> On Thu, Oct 25, 2018 at 10:00:06AM -0400, Doug Ledford wrote:
>>>>> On Wed, 2018-10-24 at 12:43 +0200, Nicolas Morey-Chaisemartin wrote:
>>>>>> On 10/23/18 10:57 PM, Jason Gunthorpe wrote:
>>>>>>> From: Jason Gunthorpe <jgg@mellanox.com>
>>>>>>>
>>>>>>> Now that we can produce them properly, add them.
>>>>>>>
>>>>>>> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
>>>>>>>
>>>>>> SUSE packaging policy does not allow for static libraries (apart
>>>>>> from a few rare exceptions).  Thus, they shouldn't enable them
>>>>>> by default. I'm not against adding a RPM option to enable it if
>>>>>> needed.
>>>>> Red Hat/Fedora have the same policy BTW.  As far as Red Hat is
>>>>> concerned, it's all about making sure that security updates to
>>>>> libraries actually make it into use and insecure, broken
>>>>> libraries don't stay hanging around because they are statically
>>>>> linked into something.
>>>> Some of the distros have asked for this, do you want to just drop the
>>>> patches enabling this in packaging and leave it up to the packagers
>>>> for now?
>>>
>>> If people have asked for this on RPM based distro, let's add a flag
>>> (disabled by default) for both RHEL and SUSE so any outside packager
>>> ( OFED ? ) can enable it very easily.
>>
>> Sure, I've never used rpmbuild flags, can you give an quick example?
>
> Something like this:
>
> diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
> index c281c5fa..19154ff5 100644
> --- a/redhat/rdma-core.spec
> +++ b/redhat/rdma-core.spec
> @@ -11,6 +11,8 @@ License: GPLv2 or BSD
>  Url: https://github.com/linux-rdma/rdma-core
>  Source: rdma-core-%{version}.tgz
>
> +%define with_static %{?_with_static: 1} %{?!_with_static: 0}
> +

You could use:
%bcond_with static_libs
The code is simpler but deceiving as this means that "without" is the default.

>  BuildRequires: binutils
>  BuildRequires: cmake >= 2.8.11
>  BuildRequires: gcc
> @@ -233,6 +235,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
>
Was looking into that and for some weird reason it fails on centos7:
+ /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_BINDIR:PATH=/usr/bin -DCMAKE_INSTALL_SBINDIR:PATH=/usr/sbin -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DCMAKE_INSTALL_LIBEXECDIR:PATH=/usr/libexec -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=/var -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib -DCMAKE_INSTALL_INCLUDEDIR:PATH=/usr/include -DCMAKE_INSTALL_INFODIR:PATH=/usr/share/info -DCMAKE_INSTALL_MANDIR:PATH=/usr/share/man -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DCMAKE_INSTALL_SYSTEMD_SERVICEDIR:PATH=/usr/lib/systemd/system -DCMAKE_INSTALL_INITDDIR:PATH=/etc/rc.d/init.d -DCMAKE_INSTALL_RUNDIR:PATH=/run
-DCMAKE_INSTALL_DOCDIR:PATH=/usr/share/doc/rdma-core-21.0 -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=/usr/lib/udev/rules.d -DENABLE_STATIC=1 '%{EXTRA_CMAKE_FLAGS}'
CMake Error: The source directory "/home/nmorey/rpmbuild/BUILD/rdma-core-21.0/%{EXTRA_CMAKE_FLAGS}" does not exist.

Seems the RPM version is handling something badly..

Nicolas
Nicolas Morey-Chaisemartin Oct. 25, 2018, 4:51 p.m. UTC | #9
On 10/25/18 6:47 PM, Nicolas Morey-Chaisemartin wrote:
>
> On 10/25/18 6:42 PM, Jarod Wilson wrote:
>>
>> Something like this:
>>
>> diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
>> index c281c5fa..19154ff5 100644
>> --- a/redhat/rdma-core.spec
>> +++ b/redhat/rdma-core.spec
>> @@ -11,6 +11,8 @@ License: GPLv2 or BSD
>>  Url: https://github.com/linux-rdma/rdma-core
>>  Source: rdma-core-%{version}.tgz
>>
>> +%define with_static %{?_with_static: 1} %{?!_with_static: 0}
>> +
> You could use:
> %bcond_with static_libs
> The code is simpler but deceiving as this means that "without" is the default.
>
>>  BuildRequires: binutils
>>  BuildRequires: cmake >= 2.8.11
>>  BuildRequires: gcc
>> @@ -233,6 +235,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
>>
> Was looking into that and for some weird reason it fails on centos7:
> + /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_BINDIR:PATH=/usr/bin -DCMAKE_INSTALL_SBINDIR:PATH=/usr/sbin -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DCMAKE_INSTALL_LIBEXECDIR:PATH=/usr/libexec -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=/var -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib -DCMAKE_INSTALL_INCLUDEDIR:PATH=/usr/include -DCMAKE_INSTALL_INFODIR:PATH=/usr/share/info -DCMAKE_INSTALL_MANDIR:PATH=/usr/share/man -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DCMAKE_INSTALL_SYSTEMD_SERVICEDIR:PATH=/usr/lib/systemd/system -DCMAKE_INSTALL_INITDDIR:PATH=/etc/rc.d/init.d -DCMAKE_INSTALL_RUNDIR:PATH=/run
> -DCMAKE_INSTALL_DOCDIR:PATH=/usr/share/doc/rdma-core-21.0 -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=/usr/lib/udev/rules.d -DENABLE_STATIC=1 '%{EXTRA_CMAKE_FLAGS}'
> CMake Error: The source directory "/home/nmorey/rpmbuild/BUILD/rdma-core-21.0/%{EXTRA_CMAKE_FLAGS}" does not exist.
>
> Seems the RPM version is handling something badly..
>
> Nicolas
>

Scratch that. It works your way. Something does not like bcond on centos though
Jarod Wilson Oct. 25, 2018, 5:11 p.m. UTC | #10
On 2018-10-25 12:51 PM, Nicolas Morey-Chaisemartin wrote:
> 
> 
> On 10/25/18 6:47 PM, Nicolas Morey-Chaisemartin wrote:
>>
>> On 10/25/18 6:42 PM, Jarod Wilson wrote:
>>>
>>> Something like this:
>>>
>>> diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
>>> index c281c5fa..19154ff5 100644
>>> --- a/redhat/rdma-core.spec
>>> +++ b/redhat/rdma-core.spec
>>> @@ -11,6 +11,8 @@ License: GPLv2 or BSD
>>>   Url: https://github.com/linux-rdma/rdma-core
>>>   Source: rdma-core-%{version}.tgz
>>>
>>> +%define with_static %{?_with_static: 1} %{?!_with_static: 0}
>>> +
>> You could use:
>> %bcond_with static_libs
>> The code is simpler but deceiving as this means that "without" is the default.
...
 >> Was looking into that and for some weird reason it fails on centos7:
...
 > Scratch that. It works your way. Something does not like bcond on 
centos though

Yeah, I never liked the unintuitive appearance of bcond, and had vague 
recollections of it not being properly supported in older versions of rpm.
diff mbox series

Patch

diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index c281c5fa4e2cf9..131001051c1eee 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -73,6 +73,11 @@  Obsoletes: librdmacm-devel < %{version}-%{release}
 Requires: ibacm = %{version}-%{release}
 Provides: ibacm-devel = %{version}-%{release}
 Obsoletes: ibacm-devel < %{version}-%{release}
+# 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)
 
 %description devel
 RDMA core development libraries and headers.
@@ -233,6 +238,7 @@  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} \
+	 -DENABLE_STATIC=1 \
          %{EXTRA_CMAKE_FLAGS}
 %make_jobs
 
@@ -352,6 +358,7 @@  rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %dir %{_includedir}/rdma
 %{_includedir}/infiniband/*
 %{_includedir}/rdma/*
+%{_libdir}/lib*.a
 %{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*.pc
 %{_mandir}/man3/ibv_*
diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec
index 4bb4086cdc789b..0a0620b48e76a4 100644
--- a/suse/rdma-core.spec
+++ b/suse/rdma-core.spec
@@ -144,6 +144,12 @@  Obsoletes:      librdmacm-devel < %{version}-%{release}
 Provides:       ibacm-devel = %{version}-%{release}
 Obsoletes:      ibacm-devel < %{version}-%{release}
 
+# 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)
+
 %description devel
 RDMA core development libraries and headers.
 
@@ -348,6 +354,7 @@  on those changes.
          -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
          -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
          -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
+         -DENABLE_STATIC=1 \
          %{EXTRA_CMAKE_FLAGS}
 %make_jobs
 
@@ -526,6 +533,7 @@  rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %dir %{_includedir}/rdma
 %{_includedir}/infiniband/*
 %{_includedir}/rdma/*
+%{_libdir}/lib*.a
 %{_libdir}/lib*.so
 %{_libdir}/pkgconfig/*.pc
 %{_mandir}/man3/ibv_*