2012-11-17 04:07:12 +04:00
|
|
|
# vim: set ts=4 sw=4 tw=99 et:
|
|
|
|
import os
|
|
|
|
import sys
|
2013-02-22 03:36:52 +04:00
|
|
|
import utils
|
2012-11-17 04:07:12 +04:00
|
|
|
import puller
|
2013-02-22 03:36:52 +04:00
|
|
|
import platform
|
2012-11-17 04:07:12 +04:00
|
|
|
import subprocess
|
|
|
|
from utils import Run
|
|
|
|
|
|
|
|
class Engine(object):
|
|
|
|
def __init__(self, conf):
|
|
|
|
self.testroot = conf.get('main', 'testroot')
|
|
|
|
self.cpu = conf.get('main', 'cpu')
|
|
|
|
|
|
|
|
def updateAndBuild(self, update, forceRebuild):
|
|
|
|
pop = os.getcwd()
|
|
|
|
os.chdir(os.path.join(self.testroot, self.source))
|
|
|
|
|
|
|
|
if self.puller == 'svn':
|
|
|
|
scm = puller.SVN
|
|
|
|
elif self.puller == 'hg':
|
|
|
|
scm = puller.HG
|
|
|
|
shell = self.shell()
|
|
|
|
|
|
|
|
if not os.path.isfile(shell):
|
|
|
|
forceRebuild = True
|
|
|
|
|
|
|
|
updated = False
|
|
|
|
if update:
|
|
|
|
updated = scm.Update()
|
|
|
|
|
|
|
|
if forceRebuild or updated:
|
|
|
|
try:
|
|
|
|
os.unlink(shell)
|
|
|
|
except:
|
|
|
|
pass
|
2013-02-22 03:48:19 +04:00
|
|
|
|
2012-11-17 04:07:12 +04:00
|
|
|
self.build()
|
2013-02-22 03:48:19 +04:00
|
|
|
if not os.path.isfile(shell):
|
|
|
|
if self.reconf():
|
|
|
|
self.build()
|
|
|
|
|
2012-11-17 04:07:12 +04:00
|
|
|
updated = True
|
|
|
|
|
|
|
|
version = scm.Identify()
|
|
|
|
|
|
|
|
if not os.path.isfile(shell):
|
|
|
|
print(shell)
|
|
|
|
os.chdir(pop)
|
|
|
|
raise Exception('could not find shell')
|
|
|
|
|
|
|
|
os.chdir(pop)
|
|
|
|
return [version, updated]
|
|
|
|
|
2013-02-22 03:48:19 +04:00
|
|
|
def reconf(self):
|
|
|
|
return False
|
|
|
|
|
2012-11-17 04:07:12 +04:00
|
|
|
def env(self):
|
|
|
|
return None
|
|
|
|
|
|
|
|
class Nitro(Engine):
|
|
|
|
def __init__(self, conf):
|
|
|
|
super(Nitro, self).__init__(conf)
|
|
|
|
self.puller = 'svn'
|
|
|
|
self.source = conf.get('jsc', 'source')
|
2013-02-23 04:43:52 +04:00
|
|
|
if conf.has_option('jsc', 'conf'):
|
|
|
|
self.extra = conf.get('jsc', 'conf').split(' ')
|
|
|
|
else:
|
|
|
|
self.extra = []
|
2012-11-17 04:07:12 +04:00
|
|
|
self.args = None
|
2013-02-20 08:24:48 +04:00
|
|
|
self.important = False # WebKit changes too frequently, we'd need to detect JSC changes.
|
2012-11-17 04:07:12 +04:00
|
|
|
self.modes = [
|
|
|
|
{
|
|
|
|
'mode': 'jsc',
|
|
|
|
'args': None
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
def env(self):
|
|
|
|
env = os.environ.copy()
|
|
|
|
env['DYLD_FRAMEWORK_PATH'] = os.path.abspath(os.path.join('WebKitBuild', 'Release'))
|
|
|
|
return env
|
|
|
|
|
|
|
|
def build(self):
|
2013-02-23 04:43:52 +04:00
|
|
|
with utils.FolderChanger(os.path.join('Tools', 'Scripts')):
|
2013-02-22 03:48:19 +04:00
|
|
|
if self.cpu == 'x86':
|
2013-02-23 04:43:52 +04:00
|
|
|
args = ['/usr/bin/perl', 'build-jsc', '--32-bit']
|
2013-02-22 03:48:19 +04:00
|
|
|
else:
|
2013-02-23 04:43:52 +04:00
|
|
|
args = ['/usr/bin/perl', 'build-jsc']
|
|
|
|
args.extend(self.extra)
|
|
|
|
Run(args)
|
2012-11-17 04:07:12 +04:00
|
|
|
|
|
|
|
def shell(self):
|
|
|
|
return os.path.join('WebKitBuild', 'Release', 'jsc')
|
|
|
|
|
|
|
|
class V8(Engine):
|
|
|
|
def __init__(self, conf):
|
|
|
|
super(V8, self).__init__(conf)
|
|
|
|
self.puller = 'svn'
|
|
|
|
self.source = conf.get('v8', 'source')
|
|
|
|
self.args = ['--expose-gc']
|
|
|
|
self.important = True
|
2013-02-22 05:22:21 +04:00
|
|
|
self.hardfp = "hardfp" in conf.get('main', 'flags')
|
2012-11-17 04:07:12 +04:00
|
|
|
self.modes = [
|
|
|
|
{
|
|
|
|
'mode': 'v8',
|
|
|
|
'args': None
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
def build(self):
|
|
|
|
Run(['make', 'dependencies'])
|
|
|
|
if self.cpu == 'x64':
|
|
|
|
Run(['make', 'x64.release'])
|
|
|
|
elif self.cpu == 'arm':
|
2013-02-22 05:22:21 +04:00
|
|
|
if self.hardfp:
|
|
|
|
Run(['make', 'arm.release', 'hardfp=on'])
|
|
|
|
else:
|
|
|
|
Run(['make', 'arm.release'])
|
2012-11-17 04:07:12 +04:00
|
|
|
elif self.cpu == 'x86':
|
|
|
|
Run(['make', 'ia32.release'])
|
|
|
|
|
|
|
|
def shell(self):
|
|
|
|
if self.cpu == 'x64':
|
|
|
|
return os.path.join('out', 'x64.release', 'd8')
|
|
|
|
elif self.cpu == 'arm':
|
|
|
|
return os.path.join('out', 'arm.release', 'd8')
|
|
|
|
elif self.cpu == 'x86':
|
|
|
|
return os.path.join('out', 'ia32.release', 'd8')
|
|
|
|
|
|
|
|
class Mozilla(Engine):
|
2013-02-20 08:24:48 +04:00
|
|
|
def __init__(self, conf, source):
|
2012-11-17 04:07:12 +04:00
|
|
|
super(Mozilla, self).__init__(conf)
|
|
|
|
self.puller = 'hg'
|
2013-02-20 08:24:48 +04:00
|
|
|
self.source = conf.get(source, 'source')
|
2013-02-22 03:36:52 +04:00
|
|
|
self.config_line = conf.get(source, 'conf')
|
2012-11-17 04:07:12 +04:00
|
|
|
self.args = None
|
|
|
|
self.important = True
|
|
|
|
|
2012-12-13 03:46:54 +04:00
|
|
|
def env(self):
|
|
|
|
env = os.environ.copy()
|
|
|
|
if self.cpu == 'x64':
|
|
|
|
env['DYLD_LIBRARY_PATH'] = "/usr/local/nspr64/lib"
|
|
|
|
elif self.cpu == 'x86':
|
|
|
|
env['DYLD_LIBRARY_PATH'] = "/usr/local/nspr32/lib"
|
|
|
|
return env
|
|
|
|
|
2013-02-22 03:48:19 +04:00
|
|
|
def reconf(self):
|
2013-02-22 03:36:52 +04:00
|
|
|
# Step 1. autoconf.
|
|
|
|
with utils.FolderChanger(os.path.join('js', 'src')):
|
|
|
|
if platform.system() == "Darwin":
|
|
|
|
utils.Shell("autoconf213")
|
|
|
|
elif platform.system() == "Linux":
|
|
|
|
utils.Shell("autoconf2.13")
|
|
|
|
elif platform.system() == "Windows":
|
|
|
|
utils.Shell("autoconf-2.13")
|
|
|
|
|
|
|
|
# Step 2. configure
|
2013-02-22 03:48:19 +04:00
|
|
|
if not os.path.exists(os.path.join('js', 'src', 'Opt')):
|
|
|
|
os.mkdir(os.path.join('js', 'src', 'Opt'))
|
2013-02-22 03:36:52 +04:00
|
|
|
with utils.FolderChanger(os.path.join('js', 'src', 'Opt')):
|
|
|
|
utils.Shell(self.config_line)
|
|
|
|
|
2013-02-22 03:48:19 +04:00
|
|
|
return True
|
|
|
|
|
|
|
|
def build(self):
|
2013-02-22 03:36:52 +04:00
|
|
|
utils.Shell("make -j 3 -C " + os.path.join('js', 'src', 'Opt'))
|
2012-11-17 04:07:12 +04:00
|
|
|
|
|
|
|
def shell(self):
|
|
|
|
return os.path.join('js', 'src', 'Opt', 'js')
|
|
|
|
|
2013-02-20 08:24:48 +04:00
|
|
|
class MozillaInbound(Mozilla):
|
|
|
|
def __init__(self, conf):
|
|
|
|
super(MozillaInbound, self).__init__(conf, 'mi')
|
|
|
|
self.modes = [
|
|
|
|
{
|
|
|
|
'mode': 'ti',
|
|
|
|
'args': ['-m', '-n', '--no-ion']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'mode': 'jmim',
|
|
|
|
'args': ['--ion', '-m', '-n', '--ion-parallel-compile=on']
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
class MozillaBaselineCompiler(Mozilla):
|
|
|
|
def __init__(self, conf):
|
|
|
|
super(MozillaBaselineCompiler, self).__init__(conf, 'bc')
|
|
|
|
self.modes = [
|
|
|
|
{
|
|
|
|
'mode': 'bc',
|
|
|
|
'args': ['--ion', '--no-jm', '-n', '--ion-parallel-compile=on']
|
|
|
|
}
|
|
|
|
]
|