Recently I was asked “what’s a vpath build?” If you regularly build postgres from source it’s something you should know about. A vpath build is one where the build tree is kept completely separate from the source tree, so you can completely remove the build tree and your source tree is still there, clean and pristine. It’s very easy to set up unless you’re building with the Microsoft toolset. Essentially what you do is create the root of your build tree, change directory into that directory, and then call
configure in your source tree from there.
configure knows all about setting up the vpath tree and does all the work for you. After that, you just run
make etc just like you would normally. So it looks like this:
mkdir mybuild cd mybuild /path/to/postgresql-source/configure make
You can even do this inside your source tree, so that mybuild is a subdirectory of the postgresql source root.
Another advantage of this is that if you’re working on several
git branches at once in a given work tree, you can keep a build tree for each branch and then switch between branches.
The Buildfarm client has support for this type of build in its configuration file, and it’s actually the most efficient way to run the client.