mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 00:06:09 +03:00
build: Support OpenWRT builds
This commit is contained in:
parent
ca86d3ff05
commit
969e620937
@ -143,6 +143,8 @@ declare_args() {
|
||||
# This allows to make behavior of uninitialized memory bugs consistent, easier to
|
||||
# recognize when debugging and often just to crash immediately.
|
||||
init_stack_vars = false
|
||||
|
||||
is_openwrt = false
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
@ -576,6 +578,11 @@ config("compiler") {
|
||||
ldflags += [ "-stdlib=libc++" ]
|
||||
}
|
||||
|
||||
if (is_openwrt && current_cpu == target_cpu) {
|
||||
defines += [ "_LIBCPP_HAS_MUSL_LIBC", "__UCLIBC__" ]
|
||||
libs = [ "atomic" ]
|
||||
}
|
||||
|
||||
# Add flags for link-time optimization. These flags enable
|
||||
# optimizations/transformations that require whole-program visibility at link
|
||||
# time, so they need to be applied to all translation units, and we may end up
|
||||
@ -779,6 +786,9 @@ config("compiler_cpu_abi") {
|
||||
if (is_android) {
|
||||
cflags += [ "--target=mipsel-linux-android" ]
|
||||
ldflags += [ "--target=mipsel-linux-android" ]
|
||||
} else if (is_openwrt) {
|
||||
cflags += [ "--target=mipsel-openwrt-linux-musl" ]
|
||||
ldflags += [ "--target=mipsel-openwrt-linux-musl" ]
|
||||
} else {
|
||||
cflags += [ "--target=mipsel-linux-gnu" ]
|
||||
ldflags += [ "--target=mipsel-linux-gnu" ]
|
||||
@ -861,8 +871,13 @@ config("compiler_cpu_abi") {
|
||||
ldflags += [ "-Wl,--hash-style=sysv" ]
|
||||
if (custom_toolchain == "") {
|
||||
if (is_clang) {
|
||||
cflags += [ "--target=mips-linux-gnu" ]
|
||||
ldflags += [ "--target=mips-linux-gnu" ]
|
||||
if (is_openwrt) {
|
||||
cflags += [ "--target=mips-openwrt-linux-musl" ]
|
||||
ldflags += [ "--target=mips-openwrt-linux-musl" ]
|
||||
} else {
|
||||
cflags += [ "--target=mips-linux-gnu" ]
|
||||
ldflags += [ "--target=mips-linux-gnu" ]
|
||||
}
|
||||
} else {
|
||||
cflags += [ "-EB" ]
|
||||
ldflags += [ "-EB" ]
|
||||
@ -910,6 +925,9 @@ config("compiler_cpu_abi") {
|
||||
if (is_android) {
|
||||
cflags += [ "--target=mips64el-linux-android" ]
|
||||
ldflags += [ "--target=mips64el-linux-android" ]
|
||||
} else if (is_openwrt) {
|
||||
cflags += [ "--target=mips64el-openwrt-linux-musl" ]
|
||||
ldflags += [ "--target=mips64el-openwrt-linux-musl" ]
|
||||
} else {
|
||||
cflags += [ "--target=mips64el-linux-gnuabi64" ]
|
||||
ldflags += [ "--target=mips64el-linux-gnuabi64" ]
|
||||
@ -970,8 +988,13 @@ config("compiler_cpu_abi") {
|
||||
ldflags += [ "-Wl,--hash-style=sysv" ]
|
||||
if (custom_toolchain == "") {
|
||||
if (is_clang) {
|
||||
cflags += [ "--target=mips64-linux-gnuabi64" ]
|
||||
ldflags += [ "--target=mips64-linux-gnuabi64" ]
|
||||
if (is_openwrt) {
|
||||
cflags += [ "--target=mips64-openwrt-linux-musl" ]
|
||||
ldflags += [ "--target=mips64-openwrt-linux-musl" ]
|
||||
} else {
|
||||
cflags += [ "--target=mips64-linux-gnuabi64" ]
|
||||
ldflags += [ "--target=mips64-linux-gnuabi64" ]
|
||||
}
|
||||
} else {
|
||||
cflags += [
|
||||
"-EB",
|
||||
|
@ -108,6 +108,11 @@ config("executable_config") {
|
||||
"-Wl,--disable-new-dtags",
|
||||
]
|
||||
}
|
||||
|
||||
# Needed for non-standard ldso on OpenWRT
|
||||
if (ldso_path != "" && current_cpu == target_cpu) {
|
||||
ldflags += [ "-Wl,--dynamic-linker=${ldso_path}" ]
|
||||
}
|
||||
}
|
||||
|
||||
# Settings for shared libraries.
|
||||
|
Loading…
Reference in New Issue
Block a user