# Proper directory for building software



## Phishfry (Sep 13, 2016)

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?


----------



## SirDice (Sep 13, 2016)

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/.


----------



## kpa (Sep 14, 2016)

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.


----------

