5.13. Specifying the Working Directory

Each port is extracted into a working directory, which must be writable. The ports system defaults to having DISTFILES unpack in to a directory called ${DISTNAME}. In other words, if the Makefile has:

PORTNAME=	foo
PORTVERSION=	1.0

then the port's distribution files contain a top-level directory, foo-1.0, and the rest of the files are located under that directory.

A number of variables can be overridden if that is not the case.

5.13.1. WRKSRC

The variable lists the name of the directory that is created when the application's distfiles are extracted. If our previous example extracted into a directory called foo (and not foo-1.0) write:

WRKSRC=	${WRKDIR}/foo

or possibly

WRKSRC=	${WRKDIR}/${PORTNAME}

5.13.2. WRKSRC_SUBDIR

If the source files needed for the port are in a subdirectory of the extracted distribution file, set WRKSRC_SUBDIR to that directory.

WRKSRC_SUBDIR=	src

5.13.3. NO_WRKSUBDIR

If the port does not extract in to a subdirectory at all, then set NO_WRKSUBDIR to indicate that.

NO_WRKSUBDIR=	yes

Note:

Because WRKDIR is the only directory that is supposed to be writable during the build, and is used to store many files recording the status of the build, it is always better to force extraction into a subdirectory anyway.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.