コード例 #1
0
def DetectTargetArch():
    """Attempt for determine target architecture.

  This works by looking for target_arch in GYP_DEFINES.
  """
    # TODO(agrieve): Make this script not depend on GYP_DEFINES so that it works
    #     with GN as well.
    gyp_environment.SetEnvironment()
    supplemental_includes = gyp_chromium.GetSupplementalFiles()
    gyp_defines = gyp_chromium.GetGypVars(supplemental_includes)
    target_arch = gyp_defines.get('target_arch')
    if target_arch == 'x64':
        return 'amd64'
    elif target_arch == 'ia32':
        return 'i386'
    elif target_arch == 'arm':
        return 'arm'
    elif target_arch == 'arm64':
        return 'arm64'
    elif target_arch == 'mipsel':
        return 'mips'
    elif target_arch:
        raise Error('Unrecognized target_arch: %s' % target_arch)

    return None
コード例 #2
0
def main():
    if options.running_as_hook and not sys.platform.startswith('linux'):
        return 0

    gyp_environment.SetEnvironment()
    supplemental_includes = gyp_chromium.GetSupplementalFiles()
    gyp_defines = gyp_chromium.GetGypVars(supplemental_includes)
    is_android = gyp_defines.get('OS') == 'android'

    if options.arch:
        target_arch = options.arch
    else:
        target_arch = DetectArch(gyp_defines, is_android)
        if not target_arch:
            print 'Unable to detect target architecture'
            return 1

    if (options.running_as_hook
            and not UsingSysroot(target_arch, is_android, gyp_defines)):
        return 0

    if is_android:
        # 32-bit Android builds require a 32-bit host sysroot for the v8 snapshot.
        if '64' not in target_arch:
            ret = _InstallSysroot('i386')
            if ret:
                return ret
        # Always need host sysroot (which we assume is x64).
        target_arch = 'amd64'

    return _InstallSysroot(target_arch)
コード例 #3
0
def InstallDefaultSysroots(host_arch):
  """Install the default set of sysroot images.

  This includes at least the sysroot for host architecture, and the 32-bit
  sysroot for building the v8 snapshot image.  It can also include the cross
  compile sysroot for ARM/MIPS if cross compiling environment can be detected.

  Another reason we're installing this by default is so that developers can
  compile and run on our supported platforms without having to worry about
  flipping things back and forth and whether the sysroots have been downloaded
  or not.
  """
  InstallDefaultSysrootForArch(host_arch)

  if host_arch == 'amd64':
    InstallDefaultSysrootForArch('i386')

  # Desktop Chromium OS builds require the precise sysroot.
  # TODO(thomasanderson): only download this when the GN arg target_os
  # == 'chromeos', when the functionality to perform the check becomes
  # available.
  InstallSysroot('Precise', 'amd64')

  # If we can detect a non-standard target_arch such as ARM or MIPS,
  # then install the sysroot too.  Don't attempt to install arm64
  # since this is currently and android-only architecture.
  target_arch = DetectTargetArch()
  if target_arch and target_arch not in (host_arch, 'i386'):
    InstallDefaultSysrootForArch(target_arch)

  # Desktop Linux ozone builds require libxkbcommon* which is not
  # available in Wheezy.
  # TODO(thomasanderson): Remove this once the Jessie sysroot is used
  # by default.
  gyp_defines = gyp_chromium.GetGypVars(gyp_chromium.GetSupplementalFiles())
  if gyp_defines.get('use_ozone') == '1':
    InstallSysroot('Jessie', 'amd64')
コード例 #4
0
    return 'ppc'
  elif detected_host_arch == 's390':
    return 's390'

  raise Error('Unrecognized host arch: %s' % detected_host_arch)


def DetectTargetArch():
  """Attempt for determine target architecture.

  This works by looking for target_arch in GYP_DEFINES.
  """
  # TODO(agrieve): Make this script not depend on GYP_DEFINES so that it works
  #     with GN as well.
  gyp_environment.SetEnvironment()
  supplemental_includes = gyp_chromium.GetSupplementalFiles()
  gyp_defines = gyp_chromium.GetGypVars(supplemental_includes)
  target_arch = gyp_defines.get('target_arch')
  if target_arch == 'x64':
    return 'amd64'
  elif target_arch == 'ia32':
    return 'i386'
  elif target_arch == 'arm':
    return 'arm'
  elif target_arch == 'arm64':
    return 'arm64'
  elif target_arch == 'mipsel':
    return 'mips'
  elif target_arch == 'mips64el':
    return 'mips64'