This is an old revision of the document!
To separate source files and build products, it's possible to use all sorts of systems of top-level build directories and/or symbolic links. A simple way to implement this on top of an otherwise standard source tree is to use a union mount, however.
The concept is simply to layer an empty read-write directory on top of a read-only source tree and perform the build in this merged layer. In this document two approaches are described, one using aufs and one using the user-space unionfs-fuse.
To use aufs, make sure it's installed. On Ubuntu this can be achieved with:
sudo apt-get install aufs-tools
To use unionfs-fuse, that'll need to be installed instead:
sudo apt-get install unionfs-fuse
For the sake of this example we'll assume that the source files are in
First, a directory to create the build artifacts must be created as well as a directory for a mount point:
mkdir ~/projects/ipsum/build-artifacts mkdir ~/projects/ipsum/build-mnt
To use aufs root privileges are required:
sudo mount -t aufs -o dirs=<build-dir>=rw:<source-dir>=ro none <mnt-dir>
… where, in this example:
To unmount the partition later, simply use standard
sudo umount <mnt-dir>
To use unionfs-fuse root privileges are not required. Being a user-space filesystem, the binary for it is simply invoked and will automatically fork into the background:
<code> unionfs-fuse -o cow <build-