The DESTDIR macro

What is it?

DESTDIR is a make environmental variable that we use in installing various parts of the FreeBSD operating system. According to its name, it sets the destination directory, where the desired components should go.

DESTDIR in src tree

We use DESTDIR for populating a jail environment. Setting DESTDIR while making an installworld will result in an individual FreeBSD userland environment, what is called a jail. We make use of jails for virtual server hosting or imprisoning processes to improve security.

DESTDIR in doc/www tree

The compiled webpages and documentations go to ${DESTDIR}/data. While mirroring the FreeBSD webpages we should set this properly in conjunction with our webserver.

DESTDIR in ports tree

So far, the DESTDIR macro in ports tree hasn't been implemented. As a SummerOfCode2007 student, GáborKövesdán is working on the implementation. According to our interpretation of DESTDIR, it should install packages into existing environments (or jails). Specifically, it means that packages should go to ${DESTDIR}/${PREFIX} and be registered under ${DESTDIR}/var/db/pkg.

For example: Installing misc/foo with DESTDIR=/bla results in a package under /bla/usr/local and it is registered under /bla/var/db/pkg, so that it be removable from the environment with pkg_delete. Of course, LOCALBASE can be overriden so using DESTDIR=/bla and LOCALBASE=/opt (or PREFIX=/opt) installs the package into /bla/opt and the package info still goes to /bla/var/db/pkg.

How does it work for ports?

DESTDIR was not taken into account at the beginnings and sometimes it is difficult to implement missing features later. This was the case with DESTDIR as well. As a part of the SummerOfCode2006 program, a more complicated and less useful solution was implemented. As a SummerOfCode2007 project, the DESTDIR functionality has been rewritten and committed to CVS. It builds and installs ports completely chrooted and mounts the necessary directiries via mount_nullfs(1) and mount_devs(1).

If you need further information feel free to contact GáborKövesdán : <>

DESTDIR (last edited 2008-06-17 21:37:22 by localhost)