Make build and cache directories configurable, and ensure that they are absolute paths.