diff options
author | Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> | 2012-09-15 14:27:15 +0200 |
---|---|---|
committer | Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com> | 2012-09-18 19:06:55 +0200 |
commit | feb4433e07d5612c996e9d4521238a14034d85c8 (patch) | |
tree | d45b75484602d5048ec8084af459269fb4747955 /tools/shared.py | |
parent | 7667ffacc92589a851e4bc5aca3f8aaad289ecb4 (diff) |
Add ability to use versioned llvm binaries
Some distributions in order to have multiple version of the same
tool add the version to the binary. Teach emscripten about
an environment variable called LLVM_ADD_VERSION that add the version
to the binary when building its path.
This let me use emscripten on debian sid.
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/shared.py b/tools/shared.py index 3f613524..60908ea1 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -122,18 +122,28 @@ def check_sanity(force=False): # Tools/paths +LLVM_ADD_VERSION = os.getenv('LLVM_ADD_VERSION') + +# Some distributions ship with multiple llvm versions so they add +# the version to the binaries, cope with that +def build_llvm_tool_path(tool): + if LLVM_ADD_VERSION: + return os.path.join(LLVM_ROOT, tool + "-" + LLVM_ADD_VERSION) + else: + return os.path.join(LLVM_ROOT, tool) + CLANG_CC=os.path.expanduser(os.path.join(LLVM_ROOT, 'clang')) CLANG_CPP=os.path.expanduser(os.path.join(LLVM_ROOT, 'clang++')) CLANG=CLANG_CPP -LLVM_LINK=os.path.join(LLVM_ROOT, 'llvm-link') -LLVM_AR=os.path.join(LLVM_ROOT, 'llvm-ar') -LLVM_OPT=os.path.expanduser(os.path.join(LLVM_ROOT, 'opt')) -LLVM_AS=os.path.expanduser(os.path.join(LLVM_ROOT, 'llvm-as')) -LLVM_DIS=os.path.expanduser(os.path.join(LLVM_ROOT, 'llvm-dis')) -LLVM_NM=os.path.expanduser(os.path.join(LLVM_ROOT, 'llvm-nm')) -LLVM_INTERPRETER=os.path.expanduser(os.path.join(LLVM_ROOT, 'lli')) -LLVM_COMPILER=os.path.expanduser(os.path.join(LLVM_ROOT, 'llc')) -LLVM_EXTRACT=os.path.expanduser(os.path.join(LLVM_ROOT, 'llvm-extract')) +LLVM_LINK=build_llvm_tool_path('llvm-link') +LLVM_AR=build_llvm_tool_path('llvm-ar') +LLVM_OPT=os.path.expanduser(build_llvm_tool_path('opt')) +LLVM_AS=os.path.expanduser(build_llvm_tool_path('llvm-as')) +LLVM_DIS=os.path.expanduser(build_llvm_tool_path('llvm-dis')) +LLVM_NM=os.path.expanduser(build_llvm_tool_path('llvm-nm')) +LLVM_INTERPRETER=os.path.expanduser(build_llvm_tool_path('lli')) +LLVM_COMPILER=os.path.expanduser(build_llvm_tool_path('llc')) +LLVM_EXTRACT=os.path.expanduser(build_llvm_tool_path('llvm-extract')) COFFEESCRIPT = path_from_root('tools', 'eliminator', 'node_modules', 'coffee-script', 'bin', 'coffee') EMSCRIPTEN = path_from_root('emscripten.py') |