Can't find port work dir setting.

Just a short question: I'm trying to build emulators/qemu on a 12.3 system as part of a scripted system installation. I like to assume that the build directory is <category>/<port>/work, but for some reason qemu uses work-defaullt. I also have seen this happen to other ports. How do I make sure it's always "work" ? There's no need for a different name.
 
I like to assume that the build directory is <category>/<port>/work
It's actually set by WRKDIRPREFIX. But defaults to a work directory in the port's directory. You can set WRKDIRPREFIX for example if you have a read-only ports tree.

but for some reason qemu uses work-defaullt. I also have seen this happen to other ports. How do I make sure it's always "work" ? There's no need for a different name.
What is WRKDIR set to? It defaults to work:

2. The extract target is run. It looks for the port’s distribution file (typically a compressed tarball) in DISTDIR and unpacks it into a temporary subdirectory specified by WRKDIR (defaults to work).

 
Code:
titan:yuri:/usr/ports/emulators/qemu$ make -v FLAVOR
default
titan:yuri:/usr/ports/emulators/qemu$ grep 'WRKDIR.*FLAVOR' /usr/ports/Mk/bsd.port.mk
_WRKDIR=        work-${FLAVOR}
 
Why? Don't assume, you can easily find the working dir using e.g. make -C /usr/ports/cat/port -v WRKDIR.
I have a set of scripts that make a FreeBSD 12.3 USB live install from source only. The part that creates the final USB image collects a series of compiled binary packages from the work/pkg directories. All this runs in a chroot dir with /dev and various code dirs mounted inside.

I just finished a build to the usual workdir by adding WRKDIR=work to the make command. Not sure what was going wrong. After the next run, I'll check this again.
 
The part that creates the final USB image collects a series of compiled binary packages from the work/pkg directories.
Copy these from a repository. Set PKGREPOSITORY or make sure /usr/ports/packages exists and is writable so your packages end up there instead of the work directory. It's best not to muck around with WRKDIR.

See ports(7):
Code:
     PACKAGES          Used only for the package target; the base directory
                       for the packages tree, normally packages/ in PORTSDIR.
                       If this directory exists, the package tree will be
                       (partially) constructed.  This directory does not have
                       to exist; if it does not, packages will be placed into
                       the current directory, or you can define one of

                       PKGREPOSITORY      Directory to put the package in.

                       PKGFILE            The full path to the package.
 
I think I found the cause, but not sure. All my work dirs are actually symlinks to a different disk. This is no problem for all ports until now but repeating the make command for qemu causes it to create a new work- directory called work-default. (which it isn't).
This also causes 2 minor build errors about a doc dir that can't be moved because it already exists in the target, and a symlink that breaks the build only for not allowing to be overwritten with the same symlink.

Anyway, with the WRKDIR=work option, it's solved. Not using it anywhere else and Qemu works, so there's no problem with it.
 
Code:
titan:yuri:/usr/ports/emulators/qemu$ make -v FLAVOR
default
titan:yuri:/usr/ports/emulators/qemu$ grep 'WRKDIR.*FLAVOR' /usr/ports/Mk/bsd.port.mk
_WRKDIR=        work-${FLAVOR}
So, logically, the command to leave it only "work" should be make -v ""
But then the work-default dir keeps being created. I even have no idea where that name comes from. A search for "default" in /usr/ports/Mk results in too many hits and work-default isn't found.

What is the qemu port trying? What I want is a work dir called work, where the dotfiles tell what's already done. It must be possible to copy it to another portstree and modify/continue from where it was, or delete it to cause a full rebuild.
 
Back
Top