# LIB_DEPENDS with a specific major version



## setjmp (Jul 13, 2015)

Hi,

I am making revisions to suggest to the maintainer of net/libfixbuf and ports-mgmt/portlint is giving me an WARN, that makes me wonder if there is a cleaner way to do it. The dependency is Spread 4.1 which has libspread.so.3 however the version 3 port also has libspread.so.1 which won't work. libfixbuf requires Spread 4.1 or newer (works fine with Spread 4.2.0).

Here's the portlint(1) output:

```
[root@eric /usr/ports/setjmp/libfixbuf]# portlint
WARN: Makefile: LIB_DEPENDS don't specify the ABI version number .3 in libspread.so.3 unless it is really necessary.
WARN: Makefile: LIB_DEPENDS the new format is libFOO.so (e.g., liblibspread.so.3.so).
0 fatal errors and 2 warnings found.
```

And here's the Makefile:

```
# Created by: David Thiel <lx@redundancy.redundancy.org>
# $FreeBSD: head/net/libfixbuf/Makefile 372232 2014-11-06 19:41:06Z antoine $

PORTNAME=  libfixbuf
PORTVERSION=  1.7.0
CATEGORIES=  setjmp net
MASTER_SITES=  http://tools.netsa.cert.org/releases/ \
  http://redundancy.redundancy.org/mirror/

MAINTAINER=  setjmp@hotmail.com
COMMENT=  Library for using the IP Flow Information Export protocol

LICENSE=  LGPL21

GNU_CONFIGURE=  yes
INSTALL_TARGET= install-strip
USES=  libtool pathfix pkgconfig
USE_GNOME=  glib20
USE_LDCONFIG=  yes
USE_OPENSSL=  yes

OPTIONS_DEFINE= SCTP OPENSSL SPREAD4

SCTP_CONFIGURE_WITH=  sctp=/usr
SPREAD4_CONFIGURE_WITH= spread=${LOCALBASE}
OPENSSL_CONFIGURE_WITH= openssl=${OPENSSLBASE}
OPTIONS_DEFAULT=SCTP OPENSSL

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSPREAD4}
LIB_DEPENDS+=  libspread.so.3:${PORTSDIR}/net/spread4
.endif

.include <bsd.port.mk>
```

Thank you for looking and any critiquing of this will be appreciated beyond the base question. Note I have a slightly modified Mk tree to enable my own category as to not conflict with the existing ports tree. Since there is already a porter, I will be submitting this to them in the end.

These additions enable a more thorough NETSA set of tools, with additional ports/suggestions forthcoming...

Thanks again,
setjmp


----------



## rootwyrm (Jun 28, 2016)

I believe the preferred way to do that at current (hopefully someone wiser will speak up if I'm wrong here) would be:


```
.if ${PORT_OPTIONS:MSPREAD4}
LIB_DEPENDS+=    libspread.so:net/spread4
RUN_DEPENDS+=    spread4>=4.1.0:net/spread4
.endif
```

This will enforce the libspread.so dependency, and enforce the correct version. There very likely is a different preferred way to do it, but that's the way I'm doing it currently myself. (I am however, not a ports committer, so YMMV.)


----------



## uzsolt (Jun 28, 2016)

setjmp said:


> And here's the Makefile:
> 
> ```
> ...
> ...


I don't know `setjmp` category  I think it's unnecessary. You can use `svn` (or `svnlite`) to create patches and you don't need similar workarounds.



setjmp said:


> ```
> .if ${PORT_OPTIONS:MSPREAD4}
> LIB_DEPENDS+=  libspread.so.3:${PORTSDIR}/net/spread4
> .endif
> ```


You can use Option Helpers (see 5.12.3.11. Dependencies, _OPT___DEPTYPE_ and _OPT___DEPTYPE__OFF).


----------

