Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / native_client / toolchain_build / toolchain_build.py
index a1601a6..34d03c1 100755 (executable)
@@ -8,6 +8,7 @@
 The real entry plumbing is in toolchain_main.py.
 """
 
+import collections
 import fnmatch
 import platform
 import os
@@ -31,7 +32,7 @@ NACL_DIR = os.path.dirname(SCRIPT_DIR)
 # to use in place of the package name when calling GitUrl (below).
 GIT_REVISIONS = {
     'binutils': {
-        'rev': '7deface59753c3b249ac08d854d471951796343f',
+        'rev': 'b08b9f0894e43f0bb966f3ad9094a4405ce6f570',
         'upstream-branch': 'upstream/binutils-2_24-branch',
         'upstream-name': 'binutils-2.24',
         # This is tag binutils-2_24, but Gerrit won't let us push
@@ -39,18 +40,18 @@ GIT_REVISIONS = {
         'upstream-base': '237df3fa4a1d939e6fd1af0c3e5029a25a137310',
         },
     'gcc': {
-        'rev': 'a2e4a3140c035233409598487c56b76108f8c74d',
-        'upstream-branch': 'upstream/gcc-4_8-branch',
-        'upstream-name': 'gcc-4.8.2',
-         # Upstream tag gcc-4_8_2-release:
-        'upstream-base': '9bcca88e24e64d4e23636aafa3404088b13bcb0e',
+        'rev': 'daf66f6da8d77ceb3cc75e63f3a7156abb09d564',
+        'upstream-branch': 'upstream/gcc-4_9-branch',
+        'upstream-name': 'gcc-4.9.2',
+         # Upstream tag gcc-4_9_2-release:
+        'upstream-base': 'c1283af40b65f1ad862cf5b27e2d9ed10b2076b6',
         },
     'newlib': {
-        'rev': 'a9ae3c60b36dea3d8a10e18b1b6db952d21268c2',
+        'rev': 'bf66148d14c7fca26b9198dd5dc81e743893bb66',
         'upstream-branch': 'upstream/master',
-        'upstream-name': 'newlib-2.0.0',
-        # Upstream tag newlib_2_0_0:
-        'upstream-base': 'c3fc84e062cacc2b3e13c1f6b9151d0cc85392ba',
+        'upstream-name': 'newlib-2.1.0',
+        # Upstream tag newlib_2_1_0:
+        'upstream-base': '99fc6c167467b41466ec90e8260e9c49cbe3d13c',
         },
     'gdb': {
         'rev': '5deb4793a5e3f2f48d7899f424bb4484686020f8',
@@ -72,11 +73,24 @@ TAR_FILES = {
     }
 
 GIT_BASE_URL = 'https://chromium.googlesource.com/native_client'
+GIT_PUSH_URL = 'ssh://gerrit.chromium.org/native_client'
 
+ALT_GIT_BASE_URL = 'https://chromium.googlesource.com/a/native_client'
 
-def GitUrl(package):
+KNOWN_MIRRORS = [('http://git.chromium.org/native_client', GIT_BASE_URL)]
+PUSH_MIRRORS = [('http://git.chromium.org/native_client', GIT_PUSH_URL),
+                (ALT_GIT_BASE_URL, GIT_PUSH_URL),
+                (GIT_BASE_URL, GIT_PUSH_URL)]
+
+
+def GitUrl(package, push_url=False):
   repo = GIT_REVISIONS[package].get('repo', package)
-  return '%s/nacl-%s.git' % (GIT_BASE_URL, repo)
+  if push_url:
+    base_url = GIT_PUSH_URL
+  else:
+    base_url = GIT_BASE_URL
+
+  return '%s/nacl-%s.git' % (base_url, repo)
 
 
 def CollectSources():
@@ -105,8 +119,12 @@ def CollectSources():
   for package, info in GIT_REVISIONS.iteritems():
     sources[package] = {
         'type': 'source',
-        'commands': [command.SyncGitRepo(GitUrl(package), '%(output)s',
-                                         info['rev'])],
+        'commands': command.SyncGitRepoCmds(GitUrl(package), '%(output)s',
+                                            info['rev'],
+                                            git_cache='%(git_cache_dir)s',
+                                            push_url=GitUrl(package, True),
+                                            known_mirrors=KNOWN_MIRRORS,
+                                            push_mirrors=PUSH_MIRRORS),
         }
     patch_packages.append(package)
     patch_info = {'name': package}
@@ -174,16 +192,8 @@ def CollectSources():
   return sources
 
 
-# List of all platform and architectures we target and will distribute for.
-HOSTS = [
-    ('win', 'x86-64'),
-    ('darwin', 'x86-64'),
-    ('linux', 'arm'),
-    ('linux', 'x86-32')
-    ]
-
 # Canonical tuples we use for hosts.
-WINDOWS_HOST_TUPLE = pynacl.platform.PlatformTriple('win', 'x86-64')
+WINDOWS_HOST_TUPLE = pynacl.platform.PlatformTriple('win', 'x86-32')
 MAC_HOST_TUPLE = pynacl.platform.PlatformTriple('darwin', 'x86-64')
 ARM_HOST_TUPLE = pynacl.platform.PlatformTriple('linux', 'arm')
 LINUX_X86_32_TUPLE = pynacl.platform.PlatformTriple('linux', 'x86-32')
@@ -209,13 +219,28 @@ NATIVE_ENOUGH_MAP = {
 
 # The list of targets to build toolchains for.
 TARGET_LIST = ['arm', 'i686']
-UPLOAD_TARGETS = ['arm']
+
+# List upload targets for each host we want to upload packages for.
+TARGET = collections.namedtuple('TARGET', ['name', 'pkg_prefix'])
+HOST_TARGET = collections.namedtuple('HOST_TARGET',
+                                     ['os', 'arch', 'differ3264', 'targets'])
+
+STANDARD_TARGETS = [TARGET('arm', '')]
+LINUX_X86_64_TARGETS = [TARGET('arm', ''), TARGET('i686', 'ng_')]
+
+UPLOAD_HOST_TARGETS = [
+    HOST_TARGET('win', 'x86-32', False, STANDARD_TARGETS),
+    HOST_TARGET('darwin', 'x86-64', False, STANDARD_TARGETS),
+    HOST_TARGET('linux', 'arm', False, STANDARD_TARGETS),
+    HOST_TARGET('linux', 'x86-32', False, STANDARD_TARGETS),
+    HOST_TARGET('linux', 'x86-64', True, LINUX_X86_64_TARGETS),
+    ]
 
 # GDB is built by toolchain_build but injected into package targets built by
 # other means. List out what package targets, packages, and the tar file we are
 # injecting on top of here.
 GDB_INJECT_HOSTS = [
-  ('win', 'x86-64'),
+  ('win', 'x86-32'),
   ('darwin', 'x86-64'),
   ('linux', 'x86-32'),
   ]
@@ -227,8 +252,7 @@ GDB_INJECT_PACKAGES = [
 
 # These are extra arguments to pass gcc's configure that vary by target.
 TARGET_GCC_CONFIG = {
-# TODO(mcgrathr): Disabled tuning for now, tickling a constant-pool layout bug.
-#    'arm': ['--with-tune=cortex-a15'],
+    'arm': ['--with-tune=cortex-a15'],
     }
 
 PACKAGE_NAME = 'Native Client SDK [%(build_signature)s]'
@@ -367,9 +391,9 @@ GROUP ( libnacl.a libcrt_common.a )
                    'elf32-bigarm-nacl',
                    'elf32-littlearm-nacl']
   elif arch == 'i686':
-    format_list = 'elf32-i386-nacl'
+    format_list = ['elf32-i386-nacl']
   elif arch == 'x86_64':
-    format_list = 'elf32-x86_64-nacl'
+    format_list = ['elf32-x86_64-nacl']
   else:
     raise Exception('TODO(mcgrathr): OUTPUT_FORMAT for %s' % arch)
   return template % ', '.join(['"' + fmt + '"' for fmt in format_list])
@@ -633,12 +657,17 @@ def HostTools(host, target):
   def H(component_name):
     return ForHost(component_name, host)
 
+  def WindowsAlternate(if_windows, if_not_windows, if_mac=None):
+    if if_mac is not None and HostIsMac(host):
+      return if_mac
+    elif HostIsWindows(host):
+      return if_windows
+    else:
+      return if_not_windows
+
   # Return the file name with the appropriate suffix for an executable file.
   def Exe(file):
-    if HostIsWindows(host):
-      return file + '.exe'
-    else:
-      return file
+    return file + WindowsAlternate('.exe', '')
 
   tools = {
       H('binutils_' + target): {
@@ -651,9 +680,7 @@ def HostTools(host, target):
                   ConfigureTargetArgs(target) + [
                       '--enable-deterministic-archives',
                       '--enable-gold',
-                      ] + ([] if HostIsWindows(host) else [
-                          '--enable-plugins',
-                          ])),
+                      ] + WindowsAlternate([], ['--enable-plugins'])),
               command.Command(MakeCommand(host)),
               command.Command(MakeCheckCommand(host)),
               command.Command(MAKE_DESTDIR_CMD + ['install-strip']),
@@ -725,10 +752,16 @@ def HostTools(host, target):
                       '--target=x86_64-nacl',
                       '--enable-targets=arm-none-eabi-nacl',
                       '--with-expat',
+                      # Windows (MinGW) is missing ncurses; we need to
+                      # build one here and link it in statically for
+                      # --enable-tui.  See issue nativeclient:3911.
+                      '--%s-tui' % WindowsAlternate('disable', 'enable'),
                       'CPPFLAGS=-I%(abs_' + H('expat') + ')s/include',
                       'LDFLAGS=-L%(abs_' + H('expat') + ')s/lib',
                       ] +
-                  (['--without-python'] if HostIsWindows(host) else []) +
+                  # TODO(mcgrathr): Should use --with-python to ensure
+                  # we have it on Linux/Mac.
+                  WindowsAlternate(['--without-python'], []) +
                   # TODO(mcgrathr): The default -Werror only breaks because
                   # the OSX default compiler is an old front-end that does
                   # not understand all the GCC options.  Maybe switch to
@@ -896,6 +929,7 @@ def HostIsMac(host):
 def BuildTargetLibsOn(host):
   return host == LINUX_X86_64_TUPLE
 
+
 def GetPackageTargets():
   """Package Targets describes all the final package targets.
 
@@ -905,17 +939,22 @@ def GetPackageTargets():
   """
   package_targets = {}
 
-  for target_arch in UPLOAD_TARGETS:
-    # Each package target contains non-platform specific newlib and gcc libs.
-    # These packages are added inside of TargetLibs(host, target).
-    newlib_package = 'newlib_%s' % target_arch
-    gcc_lib_package = 'gcc_libs_%s' % target_arch
-    shared_packages = [newlib_package, gcc_lib_package]
+  # Add in standard upload targets.
+  for host_target in UPLOAD_HOST_TARGETS:
+    for target in host_target.targets:
+      target_arch = target.name
+      package_prefix = target.pkg_prefix
+
+      # Each package target contains non-platform specific newlib and gcc libs.
+      # These packages are added inside of TargetLibs(host, target).
+      newlib_package = 'newlib_%s' % target_arch
+      gcc_lib_package = 'gcc_libs_%s' % target_arch
+      shared_packages = [newlib_package, gcc_lib_package]
 
-    for platform, arch in HOSTS:
       # Each package target contains arm binutils and gcc.
       # These packages are added inside of HostTools(host, target).
-      platform_triple = pynacl.platform.PlatformTriple(platform, arch)
+      platform_triple = pynacl.platform.PlatformTriple(host_target.os,
+                                                       host_target.arch)
       binutils_package = ForHost('binutils_%s' % target_arch, platform_triple)
       gcc_package = ForHost('gcc_%s' % target_arch, platform_triple)
       gdb_package = ForHost('gdb', platform_triple)
@@ -924,10 +963,14 @@ def GetPackageTargets():
       platform_packages = [binutils_package, gcc_package, gdb_package]
       combined_packages = shared_packages + platform_packages
 
-      os_name = pynacl.platform.GetOS(platform)
-      arch_name = pynacl.platform.GetArch(arch)
+      os_name = pynacl.platform.GetOS(host_target.os)
+      if host_target.differ3264:
+        arch_name = pynacl.platform.GetArch3264(host_target.arch)
+      else:
+        arch_name = pynacl.platform.GetArch(host_target.arch)
       package_target = '%s_%s' % (os_name, arch_name)
-      package_name = 'nacl_%s_newlib' % (pynacl.platform.GetArch(target_arch))
+      package_name = '%snacl_%s_newlib' % (package_prefix,
+                                           pynacl.platform.GetArch(target_arch))
 
       package_target_dict = package_targets.setdefault(package_target, {})
       package_target_dict.setdefault(package_name, []).extend(combined_packages)