Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Mar 2009 18:37:39 +0300
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        freebsd-ports@freebsd.org
Subject:   Re: Configuring 'RUN_DEPENDS'
Message-ID:  <20090303153739.GC55713@hades.panopticon>
In-Reply-To: <20090303072936.0e154820@scorpio>
References:  <20090303072936.0e154820@scorpio>

next in thread | previous in thread | raw e-mail | index | archive | help
* Jerry (gesbbb@yahoo.com) wrote:
> A port I am creating has a RUN_DEPENDS of either 'curl' or 'wget'. I
> have tried several times to write some sort of test in the make file to
> determine if one or the other were installed, and if neither then to
> install 'curl'. I suppose I could create an OPTIONS to install one or
> the other; however, I have not gotten that to work correctly either.

You'll need something like this:

---
.include <bsd.port.pre.mk>

.if exists(${LOCALBASE}/bin/wget) && !exists(${LOCALBASE}/bin/curl)
RUN_DEPENDS+=	wget:${PORTSDIR}/ftp/wget
.else
RUN_DEPENDS+=	curl:${PORTSDIR}/ftp/curl
.endif
---

You should be careful though to match this with your program's logic.
I.e. `what does it do if both wget and curl are installed?' The above
case is for `it uses curl then' answer.

> The port will also require Clamav, either the standard port or the
> devel one. Therefore I have two run dependencies to adjust.

No, you don't. clamav and clamav-devel are conflicting ports that
install the same files, so should you depend on clamav as

RUN_DEPENDS=	clamscan:${PORTSDIR}/security/clamav
or
LIB_DEPENDS=	clamav:${PORTSDIR}/security/clamav

if clamav-devel is installed instead, dependency will still match it and
it'll be used. Note `clamav', not `clamav.5' in LIB_DEPENDS.

> I tried Googling and the Porters Handbook, but I cannot find what I am
> looking for. Is it possible? I assume it must be. A regular 'if' or
> 'case' statement I would normally use does not work in a make file.

>From my experience, the best source for digging examples of such
nontrivial cases are Makefiles for other ports. grep'ping portstree
is too slow, so it's better to create an index like that:

find -L /usr/ports -name Makefile -maxdepth 3 -mindepth 3 -exec grep -H '' {} \; > MAKEFILES.INDEX

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090303153739.GC55713>