Add new clang-incoming and clang-master packages that automate git clone and build clang from sources.
This commit is contained in:
99
emsdk
99
emsdk
@@ -360,6 +360,88 @@ def git_clone_checkout_and_pull(url, dstpath, branch):
|
||||
success = git_checkout_and_pull(dstpath, branch)
|
||||
return success
|
||||
|
||||
# The root directory of the build.
|
||||
def fastcomp_build_dir(tool):
|
||||
build_dir = 'build_' + tool.git_branch
|
||||
build_with_vs2010 = True
|
||||
if WINDOWS:
|
||||
if build_with_vs2010:
|
||||
build_dir += '_vs2010'
|
||||
else:
|
||||
build_dir += '_mingw'
|
||||
|
||||
if tool.bitness == 32:
|
||||
build_dir += '_32'
|
||||
else:
|
||||
build_dir += '_64'
|
||||
return build_dir
|
||||
|
||||
# The directory where the binaries are produced.
|
||||
def fastcomp_build_bin_dir(tool):
|
||||
build_dir = fastcomp_build_dir(tool)
|
||||
build_with_vs2010 = True
|
||||
if WINDOWS and build_with_vs2010:
|
||||
return os.path.join(build_dir, 'bin\\RelWithDebInfo')
|
||||
else:
|
||||
return os.path.join(build_dir, 'bin')
|
||||
|
||||
def build_fastcomp_tool(tool):
|
||||
fastcomp_root = tool.installation_path()
|
||||
fastcomp_src_root = os.path.join(fastcomp_root, 'src')
|
||||
git_clone_checkout_and_pull(tool.url, fastcomp_src_root, tool.git_branch)
|
||||
clang_root = os.path.join(fastcomp_src_root, 'tools/clang')
|
||||
git_clone_checkout_and_pull(tool.clang_url, clang_root, tool.git_branch)
|
||||
build_dir = fastcomp_build_dir(tool)
|
||||
build_with_vs2010 = True
|
||||
if WINDOWS:
|
||||
if build_with_vs2010:
|
||||
if tool.bitness == 64:
|
||||
generator = 'Visual Studio 10 Win64'
|
||||
else:
|
||||
generator = 'Visual Studio 10'
|
||||
make = ['C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe', '/t:Build', '/p:Configuration=RelWithDebInfo', '/nologo', '/verbosity:minimal', 'LLVM.sln']
|
||||
else:
|
||||
generator = 'MinGW Makefiles'
|
||||
make = ['mingw32-make']
|
||||
else:
|
||||
generator = 'Unix Makefiles'
|
||||
make = ['make']
|
||||
|
||||
build_root = os.path.join(fastcomp_root, build_dir)
|
||||
|
||||
# Configure
|
||||
if not os.path.isdir(build_root): os.mkdir(build_root) # Create build output directory if it doesn't yet exist.
|
||||
try:
|
||||
cmdline = ['cmake', '-G', generator, '-DCMAKE_BUILD_TYPE=RelWithDebInfo', '-DLLVM_TARGETS_TO_BUILD=X86;JSBackend',
|
||||
'-DLLVM_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_TESTS=OFF', fastcomp_src_root]
|
||||
print 'Running CMake: ' + str(cmdline)
|
||||
ret = subprocess.check_call(cmdline, cwd=build_root)
|
||||
if ret != 0:
|
||||
print >> sys.stderr, 'CMake invocation failed with exit code ' + ret + '!'
|
||||
print >> sys.stderr, 'Working directory: ' + build_root
|
||||
return False
|
||||
except Exception, e:
|
||||
print >> sys.stderr, 'CMake invocation failed due to exception!'
|
||||
print >> sys.stderr, 'Working directory: ' + build_root
|
||||
print >> sys.stderr, str(e)
|
||||
return False
|
||||
|
||||
# Build
|
||||
try:
|
||||
print 'Running build: ' + str(make)
|
||||
ret = subprocess.check_call(make, cwd=build_root)
|
||||
if ret != 0:
|
||||
print >> sys.stderr, 'Build failed with exit code ' + ret + '!'
|
||||
print >> sys.stderr, 'Working directory: ' + build_root
|
||||
return False
|
||||
except Exception, e:
|
||||
print >> sys.stderr, 'Build failed due to exception!'
|
||||
print >> sys.stderr, 'Working directory: ' + build_root
|
||||
print >> sys.stderr, str(e)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def download_and_unzip(zipfile, dest_dir, download_even_if_exists=False):
|
||||
if not download_even_if_exists and num_files_in_directory(dest_dir) > 0:
|
||||
print "The contents of file '" + zipfile + "' already exist in destination '" + dest_dir + "', skipping."
|
||||
@@ -503,6 +585,10 @@ class Tool:
|
||||
if '%installation_dir%' in str:
|
||||
str = str.replace('%installation_dir%', sdk_path(self.installation_dir()))
|
||||
str = str.replace('%.exe%', '.exe' if WINDOWS else '')
|
||||
if '%fastcomp_build_dir%' in str:
|
||||
str = str.replace('%fastcomp_build_dir%', fastcomp_build_dir(self))
|
||||
if '%fastcomp_build_bin_dir%' in str:
|
||||
str = str.replace('%fastcomp_build_bin_dir%', fastcomp_build_bin_dir(self))
|
||||
return str
|
||||
|
||||
# Specifies the target path where this tool will be installed to. This could either be a directory or a filename (e.g. in case of node.js)
|
||||
@@ -510,6 +596,9 @@ class Tool:
|
||||
if WINDOWS and hasattr(self, 'windows_install_path'):
|
||||
pth = self.expand_vars(self.windows_install_path)
|
||||
return sdk_path(pth)
|
||||
if hasattr(self, 'install_path'):
|
||||
pth = self.expand_vars(self.install_path)
|
||||
return sdk_path(pth)
|
||||
p = self.version
|
||||
if hasattr(self, 'bitness'):
|
||||
p += '_' + str(self.bitness) + 'bit'
|
||||
@@ -526,7 +615,7 @@ class Tool:
|
||||
# Returns the configuration item that needs to be added to .emscripten to make this Tool active for the current user.
|
||||
def activated_config(self):
|
||||
if hasattr(self, 'activated_cfg'):
|
||||
return self.expand_vars(self.activated_cfg)
|
||||
return to_unix_path(self.expand_vars(self.activated_cfg))
|
||||
else:
|
||||
return ''
|
||||
|
||||
@@ -674,7 +763,9 @@ class Tool:
|
||||
return True
|
||||
else:
|
||||
url = self.download_url()
|
||||
if hasattr(self, 'git_branch'):
|
||||
if hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_fastcomp':
|
||||
success = build_fastcomp_tool(self)
|
||||
elif hasattr(self, 'git_branch'):
|
||||
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
|
||||
elif url.endswith('zip') or url.endswith('.tar') or url.endswith('.gz'):
|
||||
download_even_if_exists = (self.id == 'vs-tool')
|
||||
@@ -807,7 +898,9 @@ def load_sdk_manifest():
|
||||
global tools
|
||||
try:
|
||||
manifest = json.loads(open(sdk_path("emsdk_manifest.json"), "r").read())
|
||||
except:
|
||||
except Exception, e:
|
||||
print 'Error parsing emsdk_manifest.json!'
|
||||
print str(e)
|
||||
return
|
||||
for tool in manifest['tools']:
|
||||
t = Tool(tool)
|
||||
|
||||
@@ -50,6 +50,54 @@
|
||||
"activated_path": "%installation_dir%/bin",
|
||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin'"
|
||||
},
|
||||
{
|
||||
"id": "clang",
|
||||
"version": "incoming",
|
||||
"bitness": 32,
|
||||
"install_path": "clang/fastcomp",
|
||||
"url": "https://github.com/kripken/emscripten-fastcomp",
|
||||
"clang_url": "https://github.com/kripken/emscripten-fastcomp-clang",
|
||||
"git_branch": "incoming",
|
||||
"custom_install_script": "build_fastcomp",
|
||||
"activated_path": "%installation_dir%/%fastcomp_build_bin_dir%",
|
||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'"
|
||||
},
|
||||
{
|
||||
"id": "clang",
|
||||
"version": "incoming",
|
||||
"bitness": 64,
|
||||
"install_path": "clang/fastcomp",
|
||||
"git_branch": "incoming",
|
||||
"url": "https://github.com/kripken/emscripten-fastcomp",
|
||||
"clang_url": "https://github.com/kripken/emscripten-fastcomp-clang",
|
||||
"custom_install_script": "build_fastcomp",
|
||||
"activated_path": "%installation_dir%/%fastcomp_build_bin_dir%",
|
||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'"
|
||||
},
|
||||
{
|
||||
"id": "clang",
|
||||
"version": "master",
|
||||
"bitness": 32,
|
||||
"install_path": "clang/fastcomp",
|
||||
"url": "https://github.com/kripken/emscripten-fastcomp",
|
||||
"clang_url": "https://github.com/kripken/emscripten-fastcomp-clang",
|
||||
"git_branch": "master",
|
||||
"custom_install_script": "build_fastcomp",
|
||||
"activated_path": "%installation_dir%/%fastcomp_build_bin_dir%",
|
||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'"
|
||||
},
|
||||
{
|
||||
"id": "clang",
|
||||
"version": "master",
|
||||
"bitness": 64,
|
||||
"install_path": "clang/fastcomp",
|
||||
"git_branch": "master",
|
||||
"url": "https://github.com/kripken/emscripten-fastcomp",
|
||||
"clang_url": "https://github.com/kripken/emscripten-fastcomp-clang",
|
||||
"custom_install_script": "build_fastcomp",
|
||||
"activated_path": "%installation_dir%/%fastcomp_build_bin_dir%",
|
||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'"
|
||||
},
|
||||
{
|
||||
"id": "clang",
|
||||
"version": "e1.13.0",
|
||||
@@ -346,37 +394,37 @@
|
||||
{
|
||||
"version": "incoming",
|
||||
"bitness": 32,
|
||||
"uses": ["clang-3.2-32bit", "node-0.10.17-32bit", "python-2.7.5.1-32bit", "java-7.45-32bit", "git-1.8.3", "emscripten-incoming"],
|
||||
"uses": ["git-1.8.3", "clang-incoming-32bit", "node-0.10.17-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-incoming"],
|
||||
"os": "win"
|
||||
},
|
||||
{
|
||||
"version": "incoming",
|
||||
"bitness": 64,
|
||||
"uses": ["clang-3.2-64bit", "node-0.10.17-64bit", "python-2.7.5-64bit", "java-7.45-64bit", "git-1.8.3", "emscripten-incoming"],
|
||||
"uses": ["git-1.8.3", "clang-incoming-64bit", "node-0.10.17-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-incoming"],
|
||||
"os": "win"
|
||||
},
|
||||
{
|
||||
"version": "incoming",
|
||||
"bitness": 64,
|
||||
"uses": ["clang-3.2-64bit", "node-0.10.18-64bit", "emscripten-incoming"],
|
||||
"uses": ["clang-incoming-64bit", "node-0.10.18-64bit", "emscripten-incoming"],
|
||||
"os": "osx"
|
||||
},
|
||||
{
|
||||
"version": "master",
|
||||
"bitness": 32,
|
||||
"uses": ["clang-3.2-32bit", "node-0.10.17-32bit", "python-2.7.5.1-32bit", "java-7.45-32bit", "git-1.8.3", "emscripten-master"],
|
||||
"uses": ["git-1.8.3", "clang-master-32bit", "node-0.10.17-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-master"],
|
||||
"os": "win"
|
||||
},
|
||||
{
|
||||
"version": "master",
|
||||
"bitness": 64,
|
||||
"uses": ["clang-3.2-64bit", "node-0.10.17-64bit", "python-2.7.5-64bit", "java-7.45-64bit", "git-1.8.3", "emscripten-master"],
|
||||
"uses": ["git-1.8.3", "clang-master-64bit", "node-0.10.17-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-master"],
|
||||
"os": "win"
|
||||
},
|
||||
{
|
||||
"version": "master",
|
||||
"bitness": 64,
|
||||
"uses": ["clang-3.2-64bit", "node-0.10.18-64bit", "emscripten-master"],
|
||||
"uses": ["clang-master-64bit", "node-0.10.18-64bit", "emscripten-master"],
|
||||
"os": "osx"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user