Library numbers in LIB_DEPENDS considered harmful (Re: recent portrevision bump for libvpx)

Mikhail T. mi+thun at aldan.algebra.com
Fri Feb 17 23:41:24 UTC 2012


On 17.02.2012 17:05, Zhihao Yuan wrote:
> LIB_DEPENDS= png.6: or =png: does not affect how the lib got linked.
Allow me to rephrase my argument from a different perspective...

The language used in our ports' Makefiles is, largely, /declarative/ -- various 
things are declared and then bsd.port.mk (and friends) interpret them to do the 
right thing.

Each declaration is meant to say something, so let's examine, what a LIB_DEPENDS 
entry declares:

    LIB_DEPENDS=    foo.V:${PORTSDIR}/cat/libfoo

The above line says, that this port needs a shared library libfoo.so.V to be 
installed. It also says, how to install it, if it is not already present at 
build-time.

If, in fact, the current port does not care, which version of libfoo is uses -- 
and most software does not -- then declaring an explicit V is wrong: it 
/gratuitously/ tightens the build-time requirements. Unless a particular version 
is, indeed, required, the above line should read simply:

    LIB_DEPENDS=    foo:${PORTSDIR}/cat/libfoo

Let's say, you sent someone to buy a bottle of dry red wine in a store. Wouldn't 
you be (unpleasantly) surprised, if he returned empty-handed, because the store 
did not have any Californian Pinot Noir of the 2003 vintage? Huh? You did not 
ask for Pinot Noir. You did not specify the origin nor the year either -- why 
did not he get something else that matched your much wider and easier-to-satisfy 
requirement: "dry red wine"?

A similar thing happens here: if the, say, vlc software needs libx264 to be 
available at build time, the FreeBSD port of vlc should not add a requirement of 
a particular version to that.

    -mi



More information about the freebsd-ports mailing list