LIB_DEPENDS

Chuck Swiger cswiger at mac.com
Wed Feb 9 22:13:15 PST 2005


Paul Schmehl wrote:
> I need to include tcl as a dependency in a new port I'm working on.  I'd 
> like to not install tcl83 if the host already has something higher than 
> tcl83, but require tcl83 as the minimum version.
> 
> How do I do that?  Is it possible?

Here is a simple Makefile snippet:

# Use lang/tcl83 by default...
WITH_TCL_VER?=  83
LIB_DEPENDS+=   tcl${WITH_TCL_VER}:${PORTSDIR}/lang/tcl${WITH_TCL_VER}

...a more complicated version might be something like:

# Use TCL 83 by default, but look for and use other versions if present.
.if exists(${LOCALBASE}/lib/libtcl80.a)
WITH_TCL_VER=  80
.elif exists(${LOCALBASE}/lib/libtcl81.a)
WITH_TCL_VER=  81
.elif exists(${LOCALBASE}/lib/libtcl82.a)
WITH_TCL_VER=  82
.elif exists(${LOCALBASE}/lib/libtcl83.a)
WITH_TCL_VER=  83
.elif exists(${LOCALBASE}/lib/libtcl84.a)
WITH_TCL_VER=  84
.else
WITH_TCL_VER=  83
.endif

.if ${WITH_TCL_VER} == 80
LIB_DEPENDS+=   tcl80:${PORTSDIR}/lang/tcl80
.elif ${WITH_TCL_VER} == 81
LIB_DEPENDS+=   tcl81:${PORTSDIR}/lang/tcl81
.elif ${WITH_TCL_VER} == 82
LIB_DEPENDS+=   tcl82:${PORTSDIR}/lang/tcl82
.elif ${WITH_TCL_VER} == 83
LIB_DEPENDS+=   tcl83:${PORTSDIR}/lang/tcl83
.elif ${WITH_TCL_VER} == 84
LIB_DEPENDS+=   tcl84:${PORTSDIR}/lang/tcl84
.else
.error WITH_TCL_VER must be one of 80, 81, 82, 83, or 84
.endif

[ Untested.  Add salt and season to taste. ]

-- 
-Chuck


More information about the freebsd-ports mailing list