Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Feb 2007 17:30:08 +0100
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>
Cc:        ports@FreeBSD.org
Subject:   Re: Optionally depending on one of two ports (or none of them)
Message-ID:  <45E06810.1070704@FreeBSD.org>
In-Reply-To: <20070224163229.062bd234@localhost>
References:  <20070222141301.007fee4f@localhost>	<45DDA117.3050508@FreeBSD.org> <20070224163229.062bd234@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
Fabian Keil schrieb:
> Gabor Kovesdan <gabor@FreeBSD.org> wrote:
>   
>
>> What about grepping in the output of pkg_info? Or even better just 
>> grepping in ls ${PKG_DBDIR} to determine which one is installed and 
>> adding the appropriate dependency.
>>     
>  
> Are you aware of ports that already do that?
>
> I grepped around a bit but didn't find any,
> and as my make knowledge is rather limited
> it sounds like too much work to be worth it.
>
>   

No, but I made an example for you, you can use this:

HAVE_TOR_DEVEL!=        if ls /var/db/pkg | grep tor-devel-\* >/dev/null 
2>&1 ; then echo YES; fi;

You should decide which one to use as a default. Let's say it is tor.

.if defined(HAVE_TOR_DEVEL)
RUN_DEPENDS+=   ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor-devel
.else
RUN_DEPENDS+=   ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor
.endif

Or if you want to make tor-devel the default one:

.if !defined(HAVE_TOR_DEVEL)
RUN_DEPENDS+=   ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor
.else
RUN_DEPENDS+=   ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor-devel
.endif


Or you can make it better by giving a knob for selecting the default.
The only problem is with my example, it does not respect PKG_DBDIR, but 
I think it is better then just adding a pkg-message for the user to make 
decision. I could not use ${PKG_DBDIR} in the evaluation somehow, it did 
not work. This is not a big deal, though, people don't often override 
that I think.

Regards,
Gabor



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