From ad5e0122c1e7f5d8a92cad7086a2f232748ba3ce Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 3 Nov 2011 17:56:03 +0000 Subject: [PATCH] build: Stub out llvm-build utility tool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143620 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/llvm-build/README.txt | 5 +++++ utils/llvm-build/llvm-build | 6 ++++++ utils/llvm-build/llvmbuild/__init__.py | 1 + utils/llvm-build/llvmbuild/main.py | 27 ++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 utils/llvm-build/README.txt create mode 100755 utils/llvm-build/llvm-build create mode 100644 utils/llvm-build/llvmbuild/__init__.py create mode 100644 utils/llvm-build/llvmbuild/main.py diff --git a/utils/llvm-build/README.txt b/utils/llvm-build/README.txt new file mode 100644 index 00000000000..b6bcaae0f1d --- /dev/null +++ b/utils/llvm-build/README.txt @@ -0,0 +1,5 @@ +============================== + llvm-build - LLVM Build Tool +============================== + +`llvm-build` is a tool for helping build the LLVM project. diff --git a/utils/llvm-build/llvm-build b/utils/llvm-build/llvm-build new file mode 100755 index 00000000000..7377e3d3fed --- /dev/null +++ b/utils/llvm-build/llvm-build @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import llvmbuild + +if __name__ == '__main__': + llvmbuild.main() diff --git a/utils/llvm-build/llvmbuild/__init__.py b/utils/llvm-build/llvmbuild/__init__.py new file mode 100644 index 00000000000..77602189733 --- /dev/null +++ b/utils/llvm-build/llvmbuild/__init__.py @@ -0,0 +1 @@ +from main import main diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py new file mode 100644 index 00000000000..0d990a78f6a --- /dev/null +++ b/utils/llvm-build/llvmbuild/main.py @@ -0,0 +1,27 @@ +import os + +def main(): + from optparse import OptionParser, OptionGroup + parser = OptionParser("usage: %prog [options]") + parser.add_option("", "--source-root", dest="source_root", metavar="PATH", + help="Path to the LLVM source (inferred if not given)", + action="store", default=None) + (opts, args) = parser.parse_args() + + # Determine the LLVM source path, if not given. + source_root = opts.source_root + if source_root: + if not os.path.exists(os.path.join(source_root, 'lib', 'VMCore', + 'Function.cpp')): + parser.error('invalid LLVM source root: %r' % source_root) + else: + llvmbuild_path = os.path.dirname(__file__) + llvm_build_path = os.path.dirname(llvmbuild_path) + utils_path = os.path.dirname(llvm_build_path) + source_root = os.path.dirname(utils_path) + if not os.path.exists(os.path.join(source_root, 'lib', 'VMCore', + 'Function.cpp')): + parser.error('unable to infer LLVM source root, please specify') + +if __name__=='__main__': + main()