Optionally depending on one of two ports (or none of them)
Gabor Kovesdan
gabor at FreeBSD.org
Sat Feb 24 16:30:38 UTC 2007
Fabian Keil schrieb:
> Gabor Kovesdan <gabor at 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
More information about the freebsd-ports
mailing list