Moving sources (base/ports) from /usr

Ede Wolf listac at
Thu Jun 11 07:22:23 UTC 2020

With a little delay, here is just the conclusion. Moving ports or src to 
another location is actually way more simple than it seemed at first 
impression. Seems like well structured OS.
So, to the best of my knowledge:

For ports, simple move to the desired location and specify in 



That's it, you are set. Works without any modification for portmaster as 
I do not know about other tools that have an own configuration files, 
like portsnap, as I have not have them used yet.

WRKDIRPREFIX is where stuff is build, but it also keeps your config 
DISTDIR is where the downloaded source is kept.

Moving /usr/src is even more effortless, just set following variable in 
/etc/src-env.conf (or whatever you have defined this file to be in 


That's it. There is one more environmant variable, that can optionally 
be exported in the shell of your choice, that is SOURCEDIR

setenv SOURCEDIR /clutter/src
export SOURCEDIR=/clutter/src

Or your respective configuration file.

This is only used by mergemaster, and if not set, mergemaster will ask 
during invocation.
Just be aware, if not net and you have not deleted the contents below 
/usr/src, mergemaster may use /usr/src if a certain makefile is present 
and this may lead to unexpected results.

Remaining open questions:
- Is it possible for makeworld/kernek to move the workdir out of 
/usr/obj? So temporary stuff may go to /tmp

- Is there a way to prevent installworld from creating /usr/src if it 
not present?

- Why are portvariables defined in make.conf, not in src-env.conf?

But those are minuscule.

Thanks everybode for your time, help and explanations.


More information about the freebsd-questions mailing list