예제 #1
0
def SandboxedTranslators(arches):
    le32_packages = [
        'newlib_le32', 'libcxx_le32', 'libs_support_le32',
        'core_sdk_libs_le32', 'metadata', 'compiler_rt_bc_le32'
    ]
    arch_deps = [GSDJoin('libs_support_translator', arch) for arch in arches]

    def TranslatorLibDir(arch):
        return os.path.join('%(output)s', 'translator',
                            pynacl.platform.GetArch3264(arch), 'lib')

    translators = {
        # The translator build requires the PNaCl compiler, the le32 target libs
        # and core SDK libs, and the native translator libs for the target arches
        'translator_compiler': {
            'type':
            'work',
            'dependencies':
            ['target_lib_compiler'] + le32_packages + arch_deps,
            'commands': [
                # Copy the le32 bitcode libs
                command.CopyRecursive('%(' + p + ')s', '%(output)s')
                for p in ['target_lib_compiler'] + le32_packages
            ] + [
                # Also copy the le32 libcxx headers to the root of the
                # translator_compiler package.
                # TODO: This works around a bug in le32-nacl-clang's include
                # path logic (it should use le32-nacl/include but instead it
                # uses /include, which probably should just be a host path.
                command.CopyRecursive('%(libcxx_le32)s/le32-nacl/include',
                                      '%(output)s/include')
            ] + [
                # Copy the native translator libs
                command.CopyRecursive(
                    '%(' + GSDJoin('libs_support_translator', arch) + ')s',
                    TranslatorLibDir(arch)) for arch in arches
            ],
        },
        'sandboxed_translators': {
            'type':
            'build',
            'dependencies': ['translator_compiler'],
            'inputs': {
                'build': os.path.join(NACL_DIR, 'pnacl', 'build.sh'),
                '_': os.path.join(NACL_DIR, 'pnacl', 'scripts',
                                  'common-tools.sh'),
            },
            'commands': [
                command.Command(['%(abs_build)s', 'translator-all']),
                command.Command(['%(abs_build)s', 'translator-prune']),
            ],
        },
    }
    return translators
def SandboxedTranslators(arches):
    le32_packages = [
        'newlib_le32', 'libcxx_le32', 'libs_support_le32',
        'core_sdk_libs_le32', 'metadata', 'compiler_rt_bc_le32'
    ]
    arch_deps = [GSDJoin('libs_support_translator', arch) for arch in arches]

    def TranslatorLibDir(arch):
        return os.path.join('%(output)s', 'translator',
                            pynacl.platform.GetArch3264(arch), 'lib')

    translators = {
        # The translator build requires the PNaCl compiler, the le32 target libs
        # and core SDK libs, and the native translator libs for the target arches
        'translator_compiler': {
            'type':
            'work',
            'dependencies':
            ['target_lib_compiler'] + le32_packages + arch_deps,
            'commands': [
                # Copy the le32 bitcode libs
                command.CopyRecursive('%(' + p + ')s', '%(output)s')
                for p in ['target_lib_compiler'] + le32_packages
            ] + [
                # Copy the native translator libs
                command.CopyRecursive(
                    '%(' + GSDJoin('libs_support_translator', arch) + ')s',
                    TranslatorLibDir(arch)) for arch in arches
            ],
        },
        'sandboxed_translators': {
            'type':
            'build',
            'dependencies': ['translator_compiler'],
            'inputs': {
                'build': os.path.join(NACL_DIR, 'pnacl', 'build.sh'),
                '_': os.path.join(NACL_DIR, 'pnacl', 'scripts',
                                  'common-tools.sh'),
            },
            'commands': [
                command.Command(['%(abs_build)s', 'translator-all']),
                command.Command(['%(abs_build)s', 'translator-prune']),
            ],
        },
    }
    return translators
예제 #3
0
def SDKCompiler(arches):
  arch_packages = ([GSDJoin('newlib', arch) for arch in arches] +
                   [GSDJoin('libcxx', arch) for arch in arches])
  compiler = {
      'sdk_compiler': {
          'type': 'work',
          'output_subdir': 'sdk_compiler',
          'dependencies': ['target_lib_compiler'] + arch_packages,
          'commands': [
              command.CopyRecursive('%(' + t + ')s', '%(output)s')
              for t in ['target_lib_compiler'] + arch_packages],
      },
  }
  return compiler
예제 #4
0
def SDKLibs(host, target):
    def H(component_name):
        return ForHost(component_name, host)

    host_components = [H('binutils_%s' % target), H('gcc_%s' % target)]
    target_components = ['glibc_' + target, 'gcc_libs_' + target]
    components = host_components + target_components

    sdk_compiler = H('sdk_compiler_' + target)

    builds = {
        sdk_compiler: {
            'type':
            'work',
            'dependencies':
            components,
            'commands': [
                command.CopyRecursive('%(' + item + ')s', '%(output)s')
                for item in components
            ],
        },
        'sdk_libs_' + target: {
            'type':
            'build',
            'dependencies': [sdk_compiler],
            'inputs': {
                'src_untrusted': os.path.join(NACL_DIR, 'src', 'untrusted'),
                'src_include': os.path.join(NACL_DIR, 'src', 'include'),
                'scons.py': os.path.join(NACL_DIR, 'scons.py'),
                'site_scons': os.path.join(NACL_DIR, 'site_scons'),
            },
            'commands': [
                command.Command([
                    sys.executable, '%(scons.py)s', '--verbose', '--mode=nacl',
                    '-j%(cores)s', 'naclsdk_validate=0',
                    'platform=%s' % target, '--nacl_glibc',
                    'nacl_glibc_dir=%(abs_' + sdk_compiler + ')s',
                    'DESTINATION_ROOT=%(work_dir)s',
                    'includedir=' + command.path.join(
                        '%(output)s', target + '-nacl', 'include'), 'libdir=' +
                    command.path.join('%(output)s', target + '-nacl', 'lib'),
                    'install'
                ],
                                cwd=NACL_DIR),
            ],
        },
    }

    return builds