Exemplo n.º 1
0
def CheckTranslatorPrerequisites():
  """ Assert that the scons artifacts for running the sandboxed translator
      exist: sel_universal, and sel_ldr. """
  for var in ['SEL_UNIVERSAL', 'SEL_LDR', 'BOOTSTRAP_LDR']:
    needed_file = env.getone(var)
    if not pathtools.exists(needed_file):
      Log.Fatal('Could not find %s [%s]', var, needed_file)
Exemplo n.º 2
0
def LinkerFiles(args):
    ret = []
    for f in args:
        if IsFlag(f):
            continue
        else:
            if not pathtools.exists(f):
                Log.Fatal("Unable to open '%s'", pathtools.touser(f))
            ret.append(f)
    return ret
Exemplo n.º 3
0
def LinkerFiles(args):
  ret = []
  for f in args:
    if IsFlag(f):
      continue
    else:
      if not pathtools.exists(f):
        Log.Fatal("Unable to open '%s'", pathtools.touser(f))
      ret.append(f)
  return ret
Exemplo n.º 4
0
def CheckTranslatorPrerequisites():
    """ Assert that the scons artifacts for running the sandboxed translator
      exist: sel_universal, and sel_ldr. """
    reqs = ['SEL_UNIVERSAL', 'SEL_LDR']
    # Linux also requires the nacl bootstrap helper.
    if GetBuildOS() == 'linux':
        reqs.append('BOOTSTRAP_LDR')
    for var in reqs:
        needed_file = env.getone(var)
        if not pathtools.exists(needed_file):
            Log.Fatal('Could not find %s [%s]', var, needed_file)
Exemplo n.º 5
0
def CheckTranslatorPrerequisites():
  """ Assert that the scons artifacts for running the sandboxed translator
      exist: sel_universal, and sel_ldr. """
  reqs = ['SEL_UNIVERSAL', 'SEL_LDR']
  # Linux also requires the nacl bootstrap helper.
  if GetBuildOS() == 'linux':
    reqs.append('BOOTSTRAP_LDR')
  for var in reqs:
    needed_file = env.getone(var)
    if not pathtools.exists(needed_file):
      Log.Fatal('Could not find %s [%s]', var, needed_file)
Exemplo n.º 6
0
def CheckTranslatorPrerequisites():
  """ Assert that the scons artifacts for running the sandboxed translator
      exist: sel_ldr, and the IRT blob. """
  if env.getbool('DRY_RUN'):
    return
  reqs = ['SEL_LDR', 'IRT_BLOB']
  # Linux also requires the nacl bootstrap helper.
  if GetBuildOS() == 'linux':
    reqs.append('BOOTSTRAP_LDR')
  for var in reqs:
    needed_file = env.getone(var)
    if not pathtools.exists(needed_file):
      Log.Fatal('Could not find %s [%s]', var, needed_file)
Exemplo n.º 7
0
def FindBaseHost(tool):
  """ Find the base directory for host binaries (i.e. llvm/binutils) """
  if env.has('BPREFIXES'):
    for prefix in env.get('BPREFIXES'):
      if os.path.exists(pathtools.join(prefix, 'bin',
                                       tool + env.getone('EXEC_EXT'))):
        return prefix

  base_pnacl = FindBasePNaCl()
  if not pathtools.exists(pathtools.join(base_pnacl, 'bin',
                          tool + env.getone('EXEC_EXT'))):
    Log.Fatal('Could not find PNaCl host directory for ' + tool)
  return base_pnacl
Exemplo n.º 8
0
def CheckTranslatorPrerequisites():
    """ Assert that the scons artifacts for running the sandboxed translator
      exist: sel_ldr, and the IRT blob. """
    if env.getbool('DRY_RUN'):
        return
    reqs = ['SEL_LDR', 'IRT_BLOB']
    # Linux also requires the nacl bootstrap helper.
    if GetBuildOS() == 'linux':
        reqs.append('BOOTSTRAP_LDR')
    for var in reqs:
        needed_file = env.getone(var)
        if not pathtools.exists(needed_file):
            Log.Fatal('Could not find %s [%s]', var, needed_file)
Exemplo n.º 9
0
def FindBaseHost(tool):
  """ Find the base directory for host binaries (i.e. llvm/binutils) """
  if env.has('BPREFIXES'):
    for prefix in env.get('BPREFIXES'):
      if os.path.exists(pathtools.join(prefix, 'bin',
                                       tool + env.getone('EXEC_EXT'))):
        return prefix

  base_pnacl = FindBasePNaCl()
  if not pathtools.exists(pathtools.join(base_pnacl, 'bin',
                          tool + env.getone('EXEC_EXT'))):
    Log.Fatal('Could not find PNaCl host directory for ' + tool)
  return base_pnacl
Exemplo n.º 10
0
def FindFile(search_names, search_dirs, acceptable_types):
    for curdir in search_dirs:
        for name in search_names:
            path = pathtools.join(curdir, name)
            if pathtools.exists(path):
                if acceptable_types == LibraryTypes.ANY:
                    return path
                # Linker scripts aren't classified as Native or Bitcode.
                if IsLinkerScript(path):
                    return path
                if acceptable_types == LibraryTypes.NATIVE and filetype.IsNative(path):
                    return path
                if acceptable_types == LibraryTypes.BITCODE and (
                    filetype.IsLLVMBitcode(path) or filetype.IsBitcodeArchive(path)
                ):
                    return path
    return None
Exemplo n.º 11
0
def GetNativeLibsDirname(other_inputs):
  """Check that native libs have a common directory and return the directory."""
  dirname = None
  for f in other_inputs:
    if IsFlag(f):
      continue
    else:
      if not pathtools.exists(f):
        Log.Fatal("Unable to open '%s'", pathtools.touser(f))
      if dirname is None:
        dirname = pathtools.dirname(f)
      else:
        if dirname != pathtools.dirname(f):
          Log.Fatal('Need a common directory for native libs: %s != %s',
                    dirname, pathtools.dirname(f))
  if not dirname:
    Log.Fatal('No native libraries found')
  return dirname + '/'
Exemplo n.º 12
0
def FindFile(search_names, search_dirs, acceptable_types):
    for curdir in search_dirs:
        for name in search_names:
            path = pathtools.join(curdir, name)
            if pathtools.exists(path):
                if acceptable_types == LibraryTypes.ANY:
                    return path
                # Linker scripts aren't classified as Native or Bitcode.
                if IsLinkerScript(path):
                    return path
                if (acceptable_types == LibraryTypes.NATIVE
                        and driver_tools.IsNative(path)):
                    return path
                if (acceptable_types == LibraryTypes.BITCODE
                        and (driver_tools.IsLLVMBitcode(path)
                             or driver_tools.IsBitcodeArchive(path))):
                    return path
    return None
Exemplo n.º 13
0
def GetNativeLibsDirname(other_inputs):
    """Check that native libs have a common directory and return the directory."""
    dirname = None
    for f in other_inputs:
        if IsFlag(f):
            continue
        else:
            if not pathtools.exists(f):
                Log.Fatal("Unable to open '%s'", pathtools.touser(f))
            if dirname is None:
                dirname = pathtools.dirname(f)
            else:
                if dirname != pathtools.dirname(f):
                    Log.Fatal(
                        'Need a common directory for native libs: %s != %s',
                        dirname, pathtools.dirname(f))
    if not dirname:
        Log.Fatal('No native libraries found')
    return dirname + '/'