diff --git a/Makefile b/Makefile
index 1216dadd297eec8becabe132d55a28905fa2bfe0..b6c630aa10afe888d31bf6cf5eb24859192f19a0 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,9 @@ CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_
 ifdef CLANG_VENDOR
 CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
 endif
+ifdef CLANG_REPOSITORY_STRING
+CPP.Flags += -DCLANG_REPOSITORY_STRING='"$(CLANG_REPOSITORY_STRING)"'
+endif
 
 # Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
 # work with it enabled with GCC), Clang/llvm-gcc don't support it yet, and newer
diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp
index 9367319c5f453afa383f2930ca471d579ba66f68..af2f848071bde4be46302ccc1bfe168882a6cb29 100644
--- a/lib/Basic/Version.cpp
+++ b/lib/Basic/Version.cpp
@@ -22,6 +22,9 @@ using namespace std;
 namespace clang {
   
 std::string getClangRepositoryPath() {
+#if defined(CLANG_REPOSITORY_STRING)
+  return CLANG_REPOSITORY_STRING;
+#else
 #ifdef SVN_REPOSITORY
   llvm::StringRef URL(SVN_REPOSITORY);
 #else
@@ -45,6 +48,7 @@ std::string getClangRepositoryPath() {
     URL = URL.substr(Start + 4);
 
   return URL;
+#endif
 }
 
 std::string getClangRevision() {