def GetHostToolchain(self, **kwargs):
    if not hasattr(self, '_host_toolchain'):
      env_variables = self.GetEnvironmentVariables()
      cc_path = env_variables['CC_host']
      cxx_path = env_variables['CXX_host']

      # Takes the provided value of CXX_HOST with a prepended 'ccache' and an
      # appended 'bin/clang++' and strips them off, leaving us with an absolute
      # path to the root directory of our toolchain.
      begin_path_index = cxx_path.find('/')
      end_path_index = cxx_path.rfind('/', 0, cxx_path.rfind('/')) + 1
      cxx_path_root = cxx_path[begin_path_index:end_path_index]

      self._host_toolchain = [
          clang.CCompiler(path=cc_path),
          clang.CxxCompiler(path=cxx_path),
          clang.AssemblerWithCPreprocessor(path=cc_path),
          ar.StaticThinLinker(),
          ar.StaticLinker(),
          clangxx.ExecutableLinker(path=cxx_path),
          evergreen_linker.SharedLibraryLinker(
              path=cxx_path_root, extra_flags=['-m aarch64elf']),
          cp.Copy(),
          touch.Stamp(),
          bash.Shell(),
      ]
    return self._host_toolchain
Beispiel #2
0
    def GetHostToolchain(self):
        environment_variables = self.GetEnvironmentVariables()
        cc_path = environment_variables['CC']
        cxx_path = environment_variables['CXX']

        return [
            clang.CCompiler(path=cc_path),
            clang.CxxCompiler(path=cxx_path),
            clang.AssemblerWithCPreprocessor(path=cc_path),
            ar.StaticThinLinker(),
            ar.StaticLinker(),
            clangxx.ExecutableLinker(path=cxx_path),
            cp.Copy(),
            touch.Stamp(),
            bash.Shell(),
        ]
Beispiel #3
0
    def GetHostToolchain(self, **kwargs):
        environment_variables = self.GetEnvironmentVariables()
        cc_path = environment_variables['CC_host']
        cxx_path = environment_variables['CXX_host']

        return [
            clang.CCompiler(path=cc_path),
            clang.CxxCompiler(path=cxx_path),
            clang.AssemblerWithCPreprocessor(path=cc_path),
            ar.StaticThinLinker(),
            ar.StaticLinker(),
            clangxx.ExecutableLinker(path=cxx_path, write_group=True),
            clangxx.SharedLibraryLinker(path=cxx_path),
            cp.Copy(),
            touch.Stamp(),
            bash.Shell(),
        ]
Beispiel #4
0
 def GetHostToolchain(self):
   if not self._host_toolchain:
     cc_path = self.host_compiler_environment['CC_host'],
     cxx_path = self.host_compiler_environment['CXX_host']
     self._host_toolchain = [
         clang.CCompiler(path=cc_path),
         clang.CxxCompiler(path=cxx_path),
         clang.AssemblerWithCPreprocessor(path=cc_path),
         ar.StaticThinLinker(),
         ar.StaticLinker(),
         clangxx.ExecutableLinker(path=cxx_path),
         clangxx.SharedLibraryLinker(path=cxx_path),
         cp.Copy(),
         touch.Stamp(),
         bash.Shell(),
     ]
   return self._host_toolchain
Beispiel #5
0
 def GetHostToolchain(self):
     if not self._host_toolchain:
         if not hasattr(self, 'host_compiler_environment'):
             self.host_compiler_environment = build.GetHostCompilerEnvironment(
                 clang_build.GetClangSpecification(), False)
         cc_path = self.host_compiler_environment['CC_host'],
         cxx_path = self.host_compiler_environment['CXX_host']
         self._host_toolchain = [
             clang.CCompiler(path=cc_path),
             clang.CxxCompiler(path=cxx_path),
             clang.AssemblerWithCPreprocessor(path=cc_path),
             ar.StaticThinLinker(),
             ar.StaticLinker(),
             clangxx.ExecutableLinker(path=cxx_path),
             clangxx.SharedLibraryLinker(path=cxx_path),
             cp.Copy(),
             touch.Stamp(),
             bash.Shell(),
         ]
     return self._host_toolchain
Beispiel #6
0
    def GetTargetToolchain(self):
        if not self._target_toolchain:
            tool_prefix = os.path.join(sdk_utils.GetNdkPath(), 'toolchains',
                                       'llvm', 'prebuilt', 'linux-x86_64',
                                       'bin', '')
            cc_path = tool_prefix + _ABI_TOOL_NAMES[self.android_abi][0]
            cxx_path = cc_path + '++'
            ar_path = tool_prefix + _ABI_TOOL_NAMES[self.android_abi][1]
            clang_flags = [
                # We'll pretend not to be Linux, but Starboard instead.
                '-U__linux__',

                # libwebp uses the cpufeatures library to detect ARM NEON support
                '-I{}/sources/android/cpufeatures'.format(self.android_ndk_home
                                                          ),

                # Mimic build/cmake/android.toolchain.cmake in the Android NDK.
                '-ffunction-sections',
                '-funwind-tables',
                '-fstack-protector-strong',
                '-no-canonical-prefixes',

                # Other flags
                '-fsigned-char',
                '-fno-limit-debug-info',
                '-fno-exceptions',
                '-fcolor-diagnostics',
                '-fno-strict-aliasing',  # See http://crbug.com/32204

                # Default visibility is hidden to enable dead stripping.
                '-fvisibility=hidden',
                # Any warning will stop the build.
                '-Werror',

                # Disable errors for the warning till the Android NDK r19 is fixed.
                # The warning is trigger when compiling .c files and complains for
                # '-stdlib=libc++' which is added by the NDK.
                '-Wno-error=unused-command-line-argument',

                # Don't warn about register variables (in base and net)
                '-Wno-deprecated-register',
                # Don't warn about deprecated ICU methods (in googleurl and net)
                '-Wno-deprecated-declarations',
                # Skia doesn't use overrides.
                '-Wno-inconsistent-missing-override',
                # shifting a negative signed value is undefined
                '-Wno-shift-negative-value',
                # Don't warn for implicit sign conversions. (in v8 and protobuf)
                '-Wno-sign-conversion',
            ]
            clang_defines = [
                # Enable compile-time decisions based on the ABI
                'ANDROID_ABI={}'.format(self.android_abi),
                # -DANDROID is an argument to some ifdefs in the NDK's eglplatform.h
                'ANDROID',
                # Cobalt on Linux flag
                'COBALT_LINUX',
                # So that we get the PRI* macros from inttypes.h
                '__STDC_FORMAT_MACROS',
                # Enable GNU extensions to get prototypes like ffsl.
                '_GNU_SOURCE=1',
                # Undefining __linux__ causes the system headers to make wrong
                # assumptions about which C-library is used on the platform.
                '__BIONIC__',
                # Undefining __linux__ leaves libc++ without a threads implementation.
                # TODO: See if there's a way to make libcpp threading use Starboard.
                '_LIBCPP_HAS_THREAD_API_PTHREAD',
            ]
            linker_flags = [
                # Use the static LLVM libc++.
                '-static-libstdc++',

                # Mimic build/cmake/android.toolchain.cmake in the Android NDK.
                '-Wl,--build-id',
                '-Wl,--warn-shared-textrel',
                '-Wl,--fatal-warnings',
                '-Wl,--gc-sections',
                '-Wl,-z,nocopyreloc',

                # Wrapper synchronizes punch-out video bounds with the UI frame.
                '-Wl,--wrap=eglSwapBuffers',
            ]
            self._target_toolchain = [
                clang.CCompiler(path=cc_path,
                                defines=clang_defines,
                                extra_flags=clang_flags),
                clang.CxxCompiler(path=cxx_path,
                                  defines=clang_defines,
                                  extra_flags=clang_flags + [
                                      '-std=c++11',
                                  ]),
                clang.AssemblerWithCPreprocessor(path=cc_path,
                                                 defines=clang_defines,
                                                 extra_flags=clang_flags),
                ar.StaticThinLinker(path=ar_path),
                ar.StaticLinker(path=ar_path),
                clangxx.SharedLibraryLinker(path=cxx_path,
                                            extra_flags=linker_flags),
                clangxx.ExecutableLinker(path=cxx_path,
                                         extra_flags=linker_flags),
            ]
        return self._target_toolchain