# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/sysroot.gni")
import("//build/toolchain/clang.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")

gcc_toolchain("arm") {
  cc = "arm-linux-gnueabi-gcc"
  cxx = "arm-linux-gnueabi-g++"
  ar = "arm-linux-gnueabi-ar"
  ld = cxx

  toolchain_cpu_arch = "arm"
  toolchain_os = "linux"
}

gcc_toolchain("x86") {
  if (is_clang) {
    if (use_clang_type_profiler) {
      prefix = rebase_path("//third_party/llvm-allocated-type/Linux_ia32/bin",
                           root_build_dir)
    } else {
      prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
                           root_build_dir)
    }
    cc = "$prefix/clang"
    cxx = "$prefix/clang++"
  } else {
    cc = "gcc"
    cxx = "g++"
  }

  ar = "ar"
  ld = cxx

  toolchain_cpu_arch = "x86"
  toolchain_os = "linux"
}

gcc_toolchain("x64") {
  if (is_clang) {
    if (use_clang_type_profiler) {
      prefix = rebase_path("//third_party/llvm-allocated-type/Linux_x64/bin",
                           root_build_dir)
    } else {
      prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
                           root_build_dir)
    }
    cc = "$prefix/clang"
    cxx = "$prefix/clang++"
  } else {
    cc = "gcc"
    cxx = "g++"
  }

  ar = "ar"
  ld = cxx

  toolchain_cpu_arch = "x64"
  toolchain_os = "linux"
}

gcc_toolchain("mipsel") {
  cc = "mipsel-linux-gnu-gcc"
  cxx = "mipsel-linux-gnu-g++"
  ar = "mipsel-linux-gnu-ar"
  ld = cxx

  toolchain_cpu_arch = "mipsel"
  toolchain_os = "linux"
}