Auto merge of #4818 - alexcrichton:rename-link-paths, r=matklad
authorbors <bors@rust-lang.org>
Mon, 18 Dec 2017 19:30:28 +0000 (19:30 +0000)
committerbors <bors@rust-lang.org>
Mon, 18 Dec 2017 19:30:28 +0000 (19:30 +0000)
commit4bbfc70da98bc00edb5c0e04d32326b270753f2e
tree4fe14241aca3c12d0199dab39f699645ccfc24cd
parent510cf5eb754ad0fc819796b4dbe9d46cf1db7838
parentf0c0a6aaeea727d9bc8526e6a415b6ce9e4e0c26
Auto merge of #4818 - alexcrichton:rename-link-paths, r=matklad

Fix renaming a project using build scripts

This commit fixes an issue in Cargo where if a project's folder was
renamed but it also contained a build script the project could break.
Cargo would continue to use the previous `rustc-link-search` arguments
to configure env vars like `LD_LIBRARY_PATH` but the literal values from
the previous compilation would be stale as the directories would no
longer be there.

To fix this when parsing the build script output we now retain a log of
the previous output directory of a build script invocation as well as
the current output, tweaking paths as appropriate if they were contained
in the output folder.

Closes #4053