mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
build: Add OpenWrt toolchains
This commit is contained in:
parent
3f04f77798
commit
e071151fc0
@ -253,6 +253,8 @@ if (target_os == "android") {
|
|||||||
_default_toolchain = "//build/toolchain/win:uwp_$target_cpu"
|
_default_toolchain = "//build/toolchain/win:uwp_$target_cpu"
|
||||||
} else if (target_os == "aix") {
|
} else if (target_os == "aix") {
|
||||||
_default_toolchain = "//build/toolchain/aix:$target_cpu"
|
_default_toolchain = "//build/toolchain/aix:$target_cpu"
|
||||||
|
} else if (target_os == "openwrt") {
|
||||||
|
_default_toolchain = "//build/toolchain/openwrt:$target_cpu"
|
||||||
} else {
|
} else {
|
||||||
assert(false, "Unsupported target_os: $target_os")
|
assert(false, "Unsupported target_os: $target_os")
|
||||||
}
|
}
|
||||||
@ -287,7 +289,7 @@ is_android = current_os == "android"
|
|||||||
is_chromeos = current_os == "chromeos"
|
is_chromeos = current_os == "chromeos"
|
||||||
is_fuchsia = current_os == "fuchsia"
|
is_fuchsia = current_os == "fuchsia"
|
||||||
is_ios = current_os == "ios"
|
is_ios = current_os == "ios"
|
||||||
is_linux = current_os == "linux"
|
is_linux = current_os == "linux" || current_os == "openwrt"
|
||||||
is_mac = current_os == "mac"
|
is_mac = current_os == "mac"
|
||||||
is_nacl = current_os == "nacl"
|
is_nacl = current_os == "nacl"
|
||||||
is_win = current_os == "win" || current_os == "winuwp"
|
is_win = current_os == "win" || current_os == "winuwp"
|
||||||
|
@ -277,6 +277,9 @@ config("compiler") {
|
|||||||
if (is_chromeos_ash) {
|
if (is_chromeos_ash) {
|
||||||
configs += [ "//build/config/chromeos:compiler" ]
|
configs += [ "//build/config/chromeos:compiler" ]
|
||||||
}
|
}
|
||||||
|
if (current_os == "openwrt") {
|
||||||
|
configs += [ "//build/config/openwrt:compiler" ]
|
||||||
|
}
|
||||||
} else if (is_nacl) {
|
} else if (is_nacl) {
|
||||||
configs += [ "//build/config/nacl:compiler" ]
|
configs += [ "//build/config/nacl:compiler" ]
|
||||||
} else if (is_mac) {
|
} else if (is_mac) {
|
||||||
@ -853,7 +856,7 @@ config("compiler_cpu_abi") {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
} else if (current_cpu == "arm") {
|
} else if (current_cpu == "arm") {
|
||||||
if (is_clang && !is_android && !is_nacl) {
|
if (is_clang && !is_android && !is_nacl && current_os != "openwrt") {
|
||||||
cflags += [ "--target=arm-linux-gnueabihf" ]
|
cflags += [ "--target=arm-linux-gnueabihf" ]
|
||||||
ldflags += [ "--target=arm-linux-gnueabihf" ]
|
ldflags += [ "--target=arm-linux-gnueabihf" ]
|
||||||
}
|
}
|
||||||
@ -871,7 +874,7 @@ config("compiler_cpu_abi") {
|
|||||||
cflags += [ "-mtune=$arm_tune" ]
|
cflags += [ "-mtune=$arm_tune" ]
|
||||||
}
|
}
|
||||||
} else if (current_cpu == "arm64") {
|
} else if (current_cpu == "arm64") {
|
||||||
if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
|
if (is_clang && !is_android && !is_nacl && !is_fuchsia && current_os != "openwrt") {
|
||||||
cflags += [ "--target=aarch64-linux-gnu" ]
|
cflags += [ "--target=aarch64-linux-gnu" ]
|
||||||
ldflags += [ "--target=aarch64-linux-gnu" ]
|
ldflags += [ "--target=aarch64-linux-gnu" ]
|
||||||
}
|
}
|
||||||
@ -880,7 +883,7 @@ config("compiler_cpu_abi") {
|
|||||||
}
|
}
|
||||||
} else if (current_cpu == "mipsel" && !is_nacl) {
|
} else if (current_cpu == "mipsel" && !is_nacl) {
|
||||||
ldflags += [ "-Wl,--hash-style=sysv" ]
|
ldflags += [ "-Wl,--hash-style=sysv" ]
|
||||||
if (custom_toolchain == "") {
|
if (custom_toolchain == "" && current_os != "openwrt") {
|
||||||
if (is_clang) {
|
if (is_clang) {
|
||||||
if (is_android) {
|
if (is_android) {
|
||||||
cflags += [ "--target=mipsel-linux-android" ]
|
cflags += [ "--target=mipsel-linux-android" ]
|
||||||
@ -1017,7 +1020,7 @@ config("compiler_cpu_abi") {
|
|||||||
} else if (current_cpu == "mips64el") {
|
} else if (current_cpu == "mips64el") {
|
||||||
cflags += [ "-D__SANE_USERSPACE_TYPES__" ]
|
cflags += [ "-D__SANE_USERSPACE_TYPES__" ]
|
||||||
ldflags += [ "-Wl,--hash-style=sysv" ]
|
ldflags += [ "-Wl,--hash-style=sysv" ]
|
||||||
if (custom_toolchain == "") {
|
if (custom_toolchain == "" && current_os != "openwrt") {
|
||||||
if (is_clang) {
|
if (is_clang) {
|
||||||
if (is_android) {
|
if (is_android) {
|
||||||
cflags += [ "--target=mips64el-linux-android" ]
|
cflags += [ "--target=mips64el-linux-android" ]
|
||||||
|
63
src/build/config/openwrt/BUILD.gn
Normal file
63
src/build/config/openwrt/BUILD.gn
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# Copyright 2014 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/c++/c++.gni")
|
||||||
|
import("//build/config/compiler/compiler.gni")
|
||||||
|
import("//build/config/sanitizers/sanitizers.gni")
|
||||||
|
|
||||||
|
if (current_toolchain == default_toolchain) {
|
||||||
|
import("//build/toolchain/concurrent_links.gni")
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(current_os == "openwrt")
|
||||||
|
|
||||||
|
declare_args() {
|
||||||
|
build_static = false
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is included by reference in the //build/config/compiler config that
|
||||||
|
# is applied to all targets. It is here to separate out the logic that is
|
||||||
|
# Android-only.
|
||||||
|
config("compiler") {
|
||||||
|
cflags = []
|
||||||
|
ldflags = []
|
||||||
|
|
||||||
|
defines = [
|
||||||
|
"_LIBCPP_HAS_MUSL_LIBC",
|
||||||
|
"__UCLIBC__",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (build_static) {
|
||||||
|
# Musl static objects are not built with -fPIC, cannot use -static-pie.
|
||||||
|
ldflags += [ "-static" ]
|
||||||
|
} else if (current_cpu == "x86") {
|
||||||
|
ldflags += [ "-Wl,--dynamic-linker=/lib/ld-musl-i386.so.1" ]
|
||||||
|
} else if (current_cpu == "mipsel") {
|
||||||
|
ldflags += [ "-Wl,--dynamic-linker=/lib/ld-musl-mipsel-sf.so.1" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
abi = "musl"
|
||||||
|
if (current_cpu == "arm") {
|
||||||
|
abi = "muslgnueabi"
|
||||||
|
arch = "arm"
|
||||||
|
} else if (current_cpu == "arm64") {
|
||||||
|
arch = "aarch64"
|
||||||
|
} else if (current_cpu == "x86") {
|
||||||
|
arch = "i486"
|
||||||
|
} else if (current_cpu == "x64") {
|
||||||
|
arch = "x86_64"
|
||||||
|
} else if (current_cpu == "mipsel") {
|
||||||
|
arch = "mipsel"
|
||||||
|
} else if (current_cpu == "mips64el") {
|
||||||
|
arch = "mips64el"
|
||||||
|
} else {
|
||||||
|
assert(false, "Architecture not supported")
|
||||||
|
}
|
||||||
|
cflags += [ "--target=$arch-openwrt-linux-$abi" ]
|
||||||
|
ldflags += [ "--target=$arch-openwrt-linux-$abi" ]
|
||||||
|
|
||||||
|
# Assign any flags set for the C compiler to asmflags so that they are sent
|
||||||
|
# to the assembler.
|
||||||
|
asmflags = cflags
|
||||||
|
}
|
15
src/build/toolchain/openwrt/BUILD.gn
Normal file
15
src/build/toolchain/openwrt/BUILD.gn
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# 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/gcc_toolchain.gni")
|
||||||
|
|
||||||
|
assert(target_os == "openwrt")
|
||||||
|
|
||||||
|
clang_toolchain(target_cpu) {
|
||||||
|
toolchain_args = {
|
||||||
|
current_cpu = target_cpu
|
||||||
|
current_os = "openwrt"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user