Re: How to correctly reference WRKSRC of another port?

From: Mathieu Arnold <>
Date: Tue, 25 May 2021 14:16:41 UTC
On Mon, May 24, 2021 at 08:16:47PM +0200, Philipp Ost wrote:
> Hi everyone,
> I'm currently working on a port (my first ;-)) which has a (optional) build
> time dependency on the sources of math/nauty.
> Currently, I've hardwired '/usr/ports/math/nauty/work/nauty27r1' as argument
> to the configure script, but that's clearly not the way to do it.
> The Porter's Handbook mentions using WRKDIRPREFIXPORTSDIR [0], but that does
> not work. A search for WRKDIRPREFIXPORTSDIR in /usr/ports/Mk comes up empty.
> Do I explicitly have to define this variable?
> I've set NAUTY_BUILD_DEPENDS=nauty>0:math/nauty:extract. How do I correctly
> reference nauty's WRKSRC?
> It would be nice if anyone could point me in the right direction.
> Thanks in advance!
> Philipp
> [0]

So, that section has just been made a bit more readable, it should not
makes much more sense.

There is no best way to achieve what you need.  The probably easiest way
would be to follow what audio/pulseaudio-module-xrdp does, mainly:

BUILD_DEPENDS=	${NONEXISTENT}:math/nauty:patch
NAUTY_WRKSRC=   $$(${MAKE} -C ${PORTSDIR}/math/nauty -VWRKSRC)

and then wherever you hardcoded the /usr/ports/... just put

Note that the special BUILD_DEPENDS is required, otherwise, there is no
guarantee that the sources will actually be there.  Also, the :patch at
the end is the target youu actually need the sources to be in, maybe it
should be :configure or :build.

Mathieu Arnold