Re: Difference between LIB_DEPENDS and RUN_DEPENDS

From: Stefan Esser <se_at_FreeBSD.org>
Date: Fri, 10 Jun 2022 12:57:46 UTC
Am 10.06.22 um 14:03 schrieb jbo@insane.engineer:
> Hello folks,
> 
> Maybe an unusual request but could somebody elaborate on the difference between
> LIB_DEPENDS and RUN_DEPENDS?
> I read the corresponding handbook section thrice and it's not clear to me when
> to use which - I must be missing something obvious.
> 
> RUN_DEPENDS appears to be for runtime dependencies. But when do I want to use
> LIB_DEPENDS?

LIB_DEPENDS affects building of the port and the run dependencies registered
in the resulting package.

It tests for the existence of a library, while BUILD_DEPENDS check for a file
and RUN_DEPENDS check for an installed package (possibly restricted to some
range of versions of the package).

> I'm working on a port of a C++ library which depends on on some shared
> libraries (provided by existing ports) but it's not clear to me whether those
> should be listed in RUN_DEPENDS or LIB_DEPENDS.

Just use:

LIB_DEPENDS+=	libXXXX.so:some/port

This will make sure that library is available when building the port and it
will register a run dependency on the package that provides that library in
the package built by your port.

See:

https://docs.freebsd.org/en/books/porters-handbook/makefiles/#makefile-depend

for all the details ...

Regards, STefan