Re: Questions regarding BUILD_DEPENDS definition

From: Matthew Seaman <>
Date: Tue, 11 Apr 2023 10:23:37 UTC
On 11/04/2023 09:45, Matthias Fechner wrote:
> Dear all,
> I have a question regarding BUILD_DEPENDS.
> The manual in tells:
> # BUILD_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
> #                                 package depends to build (between the 
> "extract" and
> #                                 "build" stages, inclusive).  The test 
> done to
> #                                 determine the existence of the 
> dependency is the
> #                                 same as FETCH_DEPENDS.  If the third 
> field ("target")
> #                                 exists, it will be used instead of 
> So if I understood it correctly, it should only be used between the 
> extract and build phase but should not be recorded as a dependency if 
> the package is installed with pkg?
> But it seems that pkg is pulling the BUILD_DEPENDS while installing the 
> package.
> Clear example is this one:
> How can I define a build dependency that is required to build the port 
> but is not installed with the port?

Your initial understanding was correct: BUILD_DEPENDS is for software 
required to build a package, but not necessary to be installed at 
run-time.  In my experience, it works exactly as described.

If devel/gitlab-shell is pulling in security/heimdal when you're 
installing from a package repository, then something is clearly going 
wrong.  pkg(8) only records the run-time dependencies in the packages it 
handles -- you can see those by `pkg info -d gitlab-shell`

If you're building the gitlab-shell package locally, then the 
BUILD_DEPENDS packages will be installed as part of the build process, 
but marked for `pkg autoremove` to delete.