How to indicate source directory in other than /usr/src?

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Tue May 29 13:04:52 UTC 2012


"Thomas Mueller" <mueller23 at insightbb.com> writes:

> How does one indicate a system source directory location when in other than /usr/src?

I'm not sure I understand quite what you're asking, but I'll have a try
anyway. 

> That could be necessary when in another directory, for instance running ndiscvt.

For ports, I would would normally say that you want SRC_BASE. However,
that's for building ports, not running them, so I may be missing the
point. 

> Or one could be building FreeBSD for a USB stick and want to do the heavy work on a hard drive; I could also want to build and install ports on the USB stick but do the heavy work on the hard drive.

This is the normal case; you don't want to do anything special about the
location of the build, only for the install. For the base system, you
just want MAKEOBJDIRPREFIX (normally /usr/obj) to be on the hard
drive. For ports, you want MAKEWRKDIRPREFIX to be on the hard drive if
set, and the ports tree to be on the hard drive if not.

> I couldn't find a variable named SRCDIR anywhere in the documentation, in contrast to PORTSDIR, which I did find.

I don't remember there being one, but I also don't see a comparable use
for one.

> I may also want to build 10-CURRENT from 9-STABLE system without giving up the 9-STABLE source tree; I would need both source trees, but then after the first successful build of 10-CURRENT, I could use that to build updated versions.

MAKEOBJDIRPREFIX can do this, but in my case I would move the original
/usr/obj tree out of the way to avoid damaging it by mistake.

Good luck.


More information about the freebsd-questions mailing list