Mercurial > hg > truffle
comparison mx/commands.py @ 4607:ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 17 Feb 2012 14:07:32 +0100 |
parents | ebd98fc68b67 |
children | 05a33fabcfe6 b1b78a46b907 |
comparison
equal
deleted
inserted
replaced
4606:ad0440b099ff | 4607:ee87cfe2f8f9 |
---|---|
268 failed.append(test) | 268 failed.append(test) |
269 | 269 |
270 if len(failed) != 0: | 270 if len(failed) != 0: |
271 mx.abort('Scala DaCapo failures: ' + str(failed)) | 271 mx.abort('Scala DaCapo failures: ' + str(failed)) |
272 | 272 |
273 def _vmLibDirInJdk(jdk): | |
274 """ | |
275 Get the directory within a JDK where jvm.cfg file and the server | |
276 and client subdirectories are located. | |
277 """ | |
278 if platform.system() == 'Darwin': | |
279 return join(jdk, 'jre', 'lib') | |
280 return join(jdk, 'jre', 'lib', 'amd64') | |
281 | |
273 def _jdk(build='product', create=False): | 282 def _jdk(build='product', create=False): |
274 """ | 283 """ |
275 Get the JDK into which Graal is installed, creating it first if necessary. | 284 Get the JDK into which Graal is installed, creating it first if necessary. |
276 """ | 285 """ |
277 jdk = join(_graal_home, 'jdk' + mx.java().version, build) | 286 jdk = join(_graal_home, 'jdk' + mx.java().version, build) |
290 mx.abort('Host JDK directory is missing: ' + src) | 299 mx.abort('Host JDK directory is missing: ' + src) |
291 shutil.copytree(src, dst) | 300 shutil.copytree(src, dst) |
292 | 301 |
293 # Make a copy of the default VM so that this JDK can be | 302 # Make a copy of the default VM so that this JDK can be |
294 # reliably used as the bootstrap for a HotSpot build. | 303 # reliably used as the bootstrap for a HotSpot build. |
295 jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') | 304 jvmCfg = join(_vmLibDirInJdk(jdk), 'jvm.cfg') |
296 if not exists(jvmCfg): | 305 if not exists(jvmCfg): |
297 mx.abort(jvmCfg + ' does not exist') | 306 mx.abort(jvmCfg + ' does not exist') |
298 | 307 |
299 lines = [] | 308 lines = [] |
300 defaultVM = None | 309 defaultVM = None |
307 defaultVM = parts[0][1:] | 316 defaultVM = parts[0][1:] |
308 lines.append('-' + defaultVM + '0 KNOWN\n') | 317 lines.append('-' + defaultVM + '0 KNOWN\n') |
309 lines.append(line) | 318 lines.append(line) |
310 | 319 |
311 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg | 320 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
312 shutil.copytree(join(jdk, 'jre', 'lib', 'amd64', defaultVM), join(jdk, 'jre', 'lib', 'amd64', defaultVM + '0')) | 321 shutil.copytree(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), defaultVM + '0')) |
313 | 322 |
314 with open(jvmCfg, 'w') as f: | 323 with open(jvmCfg, 'w') as f: |
315 for line in lines: | 324 for line in lines: |
316 f.write(line) | 325 f.write(line) |
317 | 326 |
388 buildSuffix = 'graal' | 397 buildSuffix = 'graal' |
389 | 398 |
390 for build in builds: | 399 for build in builds: |
391 jdk = _jdk(build, create=True) | 400 jdk = _jdk(build, create=True) |
392 | 401 |
393 vmDir = join(jdk, 'jre', 'lib', 'amd64', vm) | 402 vmDir = join(_vmLibDirInJdk(jdk), vm) |
394 if not exists(vmDir): | 403 if not exists(vmDir): |
395 mx.log('Creating VM directory in JDK7: ' + vmDir) | 404 mx.log('Creating VM directory in JDK7: ' + vmDir) |
396 os.makedirs(vmDir) | 405 os.makedirs(vmDir) |
397 | 406 |
398 def filterXusage(line): | 407 def filterXusage(line): |
432 env.pop('LD_LIBRARY_PATH', None) | 441 env.pop('LD_LIBRARY_PATH', None) |
433 env.pop('CLASSPATH', None) | 442 env.pop('CLASSPATH', None) |
434 | 443 |
435 mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage) | 444 mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage) |
436 | 445 |
437 jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg') | 446 jvmCfg = join(_vmLibDirInJdk(jdk), 'jvm.cfg') |
438 found = False | 447 found = False |
439 if not exists(jvmCfg): | 448 if not exists(jvmCfg): |
440 mx.abort(jvmCfg + ' does not exist') | 449 mx.abort(jvmCfg + ' does not exist') |
441 | 450 |
442 prefix = '-' + vm | 451 prefix = '-' + vm |
793 flavor = 'intel' | 802 flavor = 'intel' |
794 if 'att' in args: | 803 if 'att' in args: |
795 flavor = 'att' | 804 flavor = 'att' |
796 build = _vmbuild if _vmSourcesAvailable else 'product' | 805 build = _vmbuild if _vmSourcesAvailable else 'product' |
797 lib = mx.lib_suffix('hsdis-amd64') | 806 lib = mx.lib_suffix('hsdis-amd64') |
798 path = join(_jdk(build), 'jre', 'lib', 'amd64', lib) | 807 path = join(_vmLibDirInJdk(_jdk(build)), lib) |
799 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) | 808 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) |
800 | 809 |
801 def mx_init(): | 810 def mx_init(): |
802 _vmbuild = 'product' | 811 _vmbuild = 'product' |
803 commands = { | 812 commands = { |