Proper directory for building software

I am wondering directory wise the proper location for working with custom software not in the official ports tree. Working with a tutorial yesterday I noticed they used /usr/local/src for Crochet's svn checkout directory.

Is this the proper location? I was trying out a test port of OpenCPN and was unsure where I should be working. My first thoughts were /usr/ports but that did not seem wise so I went with /opt as I have seen on Linux.

What about compiling source code acquired from the web. Where is proper build location? Same spot?
 
Have a look at hier(7). It contains an explanation of the various directories and what they're used for.

FWIW, on my machines I've set WRKDIRPREFIX (see ports(7)) to /tmp/build. Mainly because my ports tree is often mounted read-only and partly because I use tmpfs(5) for /tmp/.
 
I use /opt for my "home cooking" as the final target for installed programs but I keep the sources in my own home directory and build them there under unprivileged user and then only for final install phase I use sudo or doas.
 
Back
Top