Bug 1437670 - Add basic BSD support to GN build. r=dminor f=gaston

- If cross-toolchain is N/A use system one instead of error
- BSDs often use Linux interfaces, so don't exclude the files
- Define is_bsd as changes specific to a particular BSD are rare
- Adjust is_clang in case Gecko would use it in future

MozReview-Commit-ID: 5LlCbEKbAPO

--HG--
extra : rebase_source : 68fc72056f65c28d43d2bfb238b26b8895e76ba9
This commit is contained in:
Jan Beich 2018-03-11 18:34:27 +00:00
Родитель bc1c24a7e5
Коммит 5bd9fa806e
3 изменённых файлов: 36 добавлений и 6 удалений

Просмотреть файл

@ -142,7 +142,7 @@ declare_args() {
# to configure warnings.
is_clang =
current_os == "mac" || current_os == "ios" || current_os == "chromeos" ||
current_os == "fuchsia" ||
current_os == "fuchsia" || current_os == "freebsd" || current_os == "openbsd" ||
(current_os == "linux" && current_cpu != "s390x" &&
current_cpu != "s390" && current_cpu != "ppc64" && current_cpu != "ppc")
@ -219,7 +219,7 @@ if (host_toolchain == "") {
} else if (host_os == "aix") {
host_toolchain = "//build/toolchain/aix:$host_cpu"
} else {
assert(false, "Unsupported host_os: $host_os")
host_toolchain = "//build/toolchain/fallback:default"
}
}
@ -261,7 +261,7 @@ if (target_os == "android") {
target_os == "winrt_10") {
_default_toolchain = "//build/toolchain/win:winrt_$target_cpu"
} else {
assert(false, "Unsupported target_os: $target_os")
_default_toolchain = host_toolchain
}
# If a custom toolchain has been set in the args, set it as default. Otherwise,
@ -374,9 +374,11 @@ if (current_os == "win" || current_os == "winrt_81" ||
is_nacl = false
is_posix = true
is_win = false
} else if (current_os == "aix") {
} else {
# AIX, BSDs, Solaris, etc.
is_android = false
is_chromeos = false
is_fuchsia = false
is_ios = false
is_linux = false
is_mac = false
@ -385,6 +387,14 @@ if (current_os == "win" || current_os == "winrt_81" ||
is_win = false
}
# A list of BSD systems maintained by community
if (current_os == "dragonfly" || current_os == "freebsd" ||
current_os == "netbsd" || current_os == "openbsd") {
is_bsd = true
} else {
is_bsd = false
}
# =============================================================================
# SOURCES FILTERS
# =============================================================================
@ -454,7 +464,7 @@ if (!is_ios) {
if (!is_mac && !is_ios) {
sources_assignment_filter += [ "*.mm" ]
}
if (!is_linux) {
if (!is_linux && !is_bsd) {
sources_assignment_filter += [
"*_linux.h",
"*_linux.cc",

Просмотреть файл

@ -48,7 +48,7 @@ declare_args() {
# These variables depend on other variables and can't be set externally.
# Indicates if the UI toolkit depends on X11.
use_x11 = is_linux && !use_ozone
use_x11 = (is_linux || is_bsd) && !use_ozone
# Turn off glib if Ozone is enabled.
if (use_ozone) {

Просмотреть файл

@ -0,0 +1,20 @@
# Copyright 2017 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/toolchain/gcc_toolchain.gni")
gcc_toolchain("default") {
cc = "cc"
cxx = "c++"
readelf = "readelf"
nm = "nm"
ar = "ar"
ld = cxx
toolchain_args = {
current_cpu = target_cpu
current_os = target_os
}
}