when building with cwd = source root, use relative paths
authorEvan Martin <martine@danga.com>
Tue, 17 Nov 2015 22:28:08 +0000 (14:28 -0800)
committerEvan Martin <martine@danga.com>
Tue, 17 Nov 2015 22:42:12 +0000 (14:42 -0800)
The pull request that introduced building from a directory other
than the source dir, https://github.com/ninja-build/ninja/pull/979,
made it so all source paths are effectively absolute paths.  This
change restores the old behavior in the case when you are building
in the source.  See the comments there.

configure.py

index 845b046..d60cbac 100755 (executable)
@@ -281,7 +281,12 @@ def binary(name):
         return exe
     return name
 
-n.variable('root', sourcedir)
+root = sourcedir
+if root == os.getcwd():
+    # In the common case where we're building directly in the source
+    # tree, simplify all the paths to just be cwd-relative.
+    root = '.'
+n.variable('root', root)
 n.variable('builddir', 'build')
 n.variable('cxx', CXX)
 if platform.is_msvc():