Re: Difference between LIB_DEPENDS and RUN_DEPENDS

From: Gleb Popov <arrowd_at_freebsd.org>
Date: Fri, 10 Jun 2022 12:57:47 UTC
On Fri, Jun 10, 2022 at 3:04 PM <jbo@insane.engineer> wrote:

> 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?
> 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.
>
>
> Best regards,
> ~ joel
>

With LIB_DEPENDS you can request a .so library, which is looked for in
paths returned by `ldconfig -r | head`.

LIB_DEPENDS=   libfoo.so.123:devel/libfoo

With {BUILD,RUN,TEST}_DEPENDS you can request
- an executable in the $PATH, like BUILD_DEPENDS=git:devel/git
- any file by an absolute path, like
BUILD_DEPENDS=${LOCALBASE}/include/some_header_only_lib.hpp
- a package of a given version, like
BUILD_DEPENDS=pkgname>1.2.3:devel/pkgname