diff options
Diffstat (limited to 'scripts/Xcode')
-rwxr-xr-x | scripts/Xcode/build-llvm.py | 33 | ||||
-rw-r--r-- | scripts/Xcode/lldbbuild.py | 9 |
2 files changed, 33 insertions, 9 deletions
diff --git a/scripts/Xcode/build-llvm.py b/scripts/Xcode/build-llvm.py index e2a46de1a16ce..4d868de6b1099 100755 --- a/scripts/Xcode/build-llvm.py +++ b/scripts/Xcode/build-llvm.py @@ -14,7 +14,6 @@ from lldbbuild import * #### SETTINGS #### - def LLVM_HASH_INCLUDES_DIFFS(): return False @@ -42,7 +41,25 @@ def process_repo(r): 'ref': r["ref"] } +def fallback_repo(name): + return { + 'name': name, + 'vcs': None, + 'root': process_root(name), + 'url': None, + 'ref': None + } + +def dirs_exist(names): + for name in names: + if not os.path.isdir(process_root(name)): + return False + return True + def XCODE_REPOSITORIES(): + names = ["llvm", "clang", "ninja"] + if dirs_exist(names): + return [fallback_repo(n) for n in names] override = repo.get_override() if override: return [process_repo(r) for r in override] @@ -207,7 +224,7 @@ def apply_patches(spec): f, spec['name'] + '.*.diff')] for p in patches: run_in_directory(["patch", - "-p0", + "-p1", "-i", os.path.join(lldb_source_path(), 'scripts', @@ -233,6 +250,8 @@ def should_build_llvm(): def do_symlink(source_path, link_path): print "Symlinking " + source_path + " to " + link_path + if os.path.islink(link_path): + os.remove(link_path) if not os.path.exists(link_path): os.symlink(source_path, link_path) @@ -433,8 +452,8 @@ def build_llvm_if_needed(): #### MAIN LOGIC #### -all_check_out_if_needed() -build_llvm_if_needed() -write_archives_txt() - -sys.exit(0) +if __name__ == "__main__": + all_check_out_if_needed() + build_llvm_if_needed() + write_archives_txt() + sys.exit(0) diff --git a/scripts/Xcode/lldbbuild.py b/scripts/Xcode/lldbbuild.py index 8496cfabf3daf..e70fe1bf803ff 100644 --- a/scripts/Xcode/lldbbuild.py +++ b/scripts/Xcode/lldbbuild.py @@ -1,5 +1,6 @@ import os import subprocess +import sys #### UTILITIES #### @@ -14,7 +15,11 @@ def enum(*sequential, **named): def lldb_source_path(): - return os.environ.get('SRCROOT') + path = os.environ.get('SRCROOT') + if path: + return path + else: + return "./" def expected_llvm_build_path(): @@ -80,7 +85,7 @@ VCS = enum('git', def run_in_directory(args, path): - return subprocess.check_output(args, cwd=path) + return subprocess.check_output([str(arg) for arg in args], cwd=path) class Git: |