mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
build: allow linking shared dependencies in the GN build
The GN build always compiles the bundled copies of brotli, c-ares, HdrHistogram, llhttp, libuv, nghttp2, SQLite and zstd, so anyone packaging a GN-built Node.js for a Linux distribution has no counterpart to configure's --shared-* options. Add node_shared_* args named after the GYP variables. When one is set, that dependency's GN template defines its target as a group carrying a pkg-config config instead of the bundled sources, so every existing "deps/<name>" reference picks up the system library without further changes, and config.gypi reports the choice like a GYP build does. Refs: https://github.com/nodejs/node/pull/55903 Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65797 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
10 files changed
+444
-318
No files matched your search
Vendored
+40
-27
@@ -4,36 +4,49 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("brotli_gn_build") {
|
||||
config("brotli_config") {
|
||||
include_dirs = [ "c/include" ]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("brotli.gyp") ],
|
||||
"scope",
|
||||
[ "brotli.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":brotli_config" ]
|
||||
sources = gypi_values.brotli_sources
|
||||
if (is_linux) {
|
||||
defines = [ "OS_LINUX" ]
|
||||
} else if (is_mac) {
|
||||
defines = [ "OS_MACOSX" ]
|
||||
} else if (target_os == "freebsd") {
|
||||
defines = [ "OS_FREEBSD" ]
|
||||
if (node_shared_brotli) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("brotli_config") {
|
||||
packages = [ "libbrotlidec", "libbrotlienc" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [ "m" ]
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":brotli_config" ]
|
||||
}
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code",
|
||||
"-Wno-unreachable-code-return",
|
||||
]
|
||||
} else {
|
||||
config("brotli_config") {
|
||||
include_dirs = [ "c/include" ]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("brotli.gyp") ],
|
||||
"scope",
|
||||
[ "brotli.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":brotli_config" ]
|
||||
sources = gypi_values.brotli_sources
|
||||
if (is_linux) {
|
||||
defines = [ "OS_LINUX" ]
|
||||
} else if (is_mac) {
|
||||
defines = [ "OS_MACOSX" ]
|
||||
} else if (target_os == "freebsd") {
|
||||
defines = [ "OS_FREEBSD" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [ "m" ]
|
||||
}
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code",
|
||||
"-Wno-unreachable-code-return",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+76
-63
@@ -4,78 +4,91 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("cares_gn_build") {
|
||||
config("cares_config") {
|
||||
include_dirs = [ "include" ]
|
||||
if (!is_component_build) {
|
||||
defines = [ "CARES_STATICLIB" ]
|
||||
if (node_shared_cares) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("cares_config") {
|
||||
packages = [ "libcares" ]
|
||||
}
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("cares.gyp") ],
|
||||
"scope",
|
||||
[ "cares.gyp" ])
|
||||
|
||||
component(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":cares_config" ]
|
||||
if (is_component_build) {
|
||||
defines = [ "CARES_BUILDING_LIBRARY" ]
|
||||
} else {
|
||||
defines = []
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":cares_config" ]
|
||||
}
|
||||
if (is_win) {
|
||||
defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
|
||||
}
|
||||
if (is_posix) {
|
||||
defines += [
|
||||
"_DARWIN_USE_64_BIT_INODE=1",
|
||||
"_LARGEFILE_SOURCE",
|
||||
"_FILE_OFFSET_BITS=64",
|
||||
"_GNU_SOURCE",
|
||||
"HAVE_CONFIG_H",
|
||||
]
|
||||
} else {
|
||||
config("cares_config") {
|
||||
include_dirs = [ "include" ]
|
||||
if (!is_component_build) {
|
||||
defines = [ "CARES_STATICLIB" ]
|
||||
}
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"src/lib",
|
||||
"src/lib/include",
|
||||
]
|
||||
if (is_win) {
|
||||
include_dirs += [ "config/win32" ]
|
||||
} else if (is_linux) {
|
||||
include_dirs += [ "config/linux" ]
|
||||
} else if (is_mac) {
|
||||
include_dirs += [ "config/darwin" ]
|
||||
}
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("cares.gyp") ],
|
||||
"scope",
|
||||
[ "cares.gyp" ])
|
||||
|
||||
if (is_win) {
|
||||
libs = [
|
||||
"ws2_32.lib",
|
||||
"iphlpapi.lib",
|
||||
]
|
||||
}
|
||||
|
||||
sources = gypi_values.cares_sources_common
|
||||
if (is_linux) {
|
||||
sources += [ "config/linux/ares_config.h" ]
|
||||
}
|
||||
if (is_mac) {
|
||||
sources += gypi_values.cares_sources_mac
|
||||
}
|
||||
|
||||
if (is_clang) {
|
||||
if (is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-macro-redefined",
|
||||
]
|
||||
component(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":cares_config" ]
|
||||
if (is_component_build) {
|
||||
defines = [ "CARES_BUILDING_LIBRARY" ]
|
||||
} else {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code",
|
||||
defines = []
|
||||
}
|
||||
if (is_win) {
|
||||
defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
|
||||
}
|
||||
if (is_posix) {
|
||||
defines += [
|
||||
"_DARWIN_USE_64_BIT_INODE=1",
|
||||
"_LARGEFILE_SOURCE",
|
||||
"_FILE_OFFSET_BITS=64",
|
||||
"_GNU_SOURCE",
|
||||
"HAVE_CONFIG_H",
|
||||
]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"src/lib",
|
||||
"src/lib/include",
|
||||
]
|
||||
if (is_win) {
|
||||
include_dirs += [ "config/win32" ]
|
||||
} else if (is_linux) {
|
||||
include_dirs += [ "config/linux" ]
|
||||
} else if (is_mac) {
|
||||
include_dirs += [ "config/darwin" ]
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
libs = [
|
||||
"ws2_32.lib",
|
||||
"iphlpapi.lib",
|
||||
]
|
||||
}
|
||||
|
||||
sources = gypi_values.cares_sources_common
|
||||
if (is_linux) {
|
||||
sources += [ "config/linux/ares_config.h" ]
|
||||
}
|
||||
if (is_mac) {
|
||||
sources += gypi_values.cares_sources_mac
|
||||
}
|
||||
|
||||
if (is_clang) {
|
||||
if (is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-macro-redefined",
|
||||
]
|
||||
} else {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+34
-21
@@ -4,29 +4,42 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("histogram_gn_build") {
|
||||
config("histogram_config") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("histogram.gyp") ],
|
||||
"scope",
|
||||
[ "histogram.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":histogram_config" ]
|
||||
sources = gypi_values.histogram_sources
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-atomic-alignment",
|
||||
"-Wno-incompatible-pointer-types",
|
||||
"-Wno-unused-function",
|
||||
]
|
||||
if (node_shared_hdr_histogram) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("histogram_config") {
|
||||
packages = [ "hdr_histogram" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [ "atomic" ]
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":histogram_config" ]
|
||||
}
|
||||
} else {
|
||||
config("histogram_config") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("histogram.gyp") ],
|
||||
"scope",
|
||||
[ "histogram.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":histogram_config" ]
|
||||
sources = gypi_values.histogram_sources
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-atomic-alignment",
|
||||
"-Wno-incompatible-pointer-types",
|
||||
"-Wno-unused-function",
|
||||
]
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [ "atomic" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+30
-17
@@ -4,26 +4,39 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("llhttp_gn_build") {
|
||||
config("llhttp_config") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
if (node_shared_http_parser) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("llhttp_config") {
|
||||
packages = [ "libllhttp" ]
|
||||
}
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":llhttp_config" ]
|
||||
}
|
||||
} else {
|
||||
config("llhttp_config") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("llhttp.gyp") ],
|
||||
"scope",
|
||||
[ "llhttp.gyp" ])
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("llhttp.gyp") ],
|
||||
"scope",
|
||||
[ "llhttp.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":llhttp_config" ]
|
||||
include_dirs = [ "include" ]
|
||||
sources = gypi_values.llhttp_sources
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code",
|
||||
]
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":llhttp_config" ]
|
||||
include_dirs = [ "include" ]
|
||||
sources = gypi_values.llhttp_sources
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+41
-28
@@ -4,40 +4,53 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("nghttp2_gn_build") {
|
||||
config("nghttp2_config") {
|
||||
include_dirs = [ "lib/includes" ]
|
||||
if (!is_component_build) {
|
||||
defines = [ "NGHTTP2_STATICLIB" ]
|
||||
if (node_shared_nghttp2) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("nghttp2_config") {
|
||||
packages = [ "libnghttp2" ]
|
||||
}
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("nghttp2.gyp") ],
|
||||
"scope",
|
||||
[ "nghttp2.gyp" ])
|
||||
|
||||
component(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
public_configs = [ ":nghttp2_config" ]
|
||||
defines = [
|
||||
"_U_",
|
||||
"HAVE_CONFIG_H"
|
||||
]
|
||||
if (is_component_build) {
|
||||
defines += [ "BUILDING_NGHTTP2" ]
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":nghttp2_config" ]
|
||||
}
|
||||
} else {
|
||||
config("nghttp2_config") {
|
||||
include_dirs = [ "lib/includes" ]
|
||||
if (!is_component_build) {
|
||||
defines = [ "NGHTTP2_STATICLIB" ]
|
||||
}
|
||||
}
|
||||
|
||||
sources = gypi_values.nghttp2_sources
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("nghttp2.gyp") ],
|
||||
"scope",
|
||||
[ "nghttp2.gyp" ])
|
||||
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
# Ref https://github.com/nghttp2/nghttp2/pull/2258
|
||||
# This can be removed when the above PR is ingested.
|
||||
"-Wno-extra-semi",
|
||||
component(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
public_configs = [ ":nghttp2_config" ]
|
||||
defines = [
|
||||
"_U_",
|
||||
"HAVE_CONFIG_H"
|
||||
]
|
||||
if (is_component_build) {
|
||||
defines += [ "BUILDING_NGHTTP2" ]
|
||||
}
|
||||
|
||||
sources = gypi_values.nghttp2_sources
|
||||
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
# Ref https://github.com/nghttp2/nghttp2/pull/2258
|
||||
# This can be removed when the above PR is ingested.
|
||||
"-Wno-extra-semi",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+59
-39
@@ -4,47 +4,67 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("sqlite_gn_build") {
|
||||
config("sqlite_config") {
|
||||
include_dirs = [ "." ]
|
||||
defines = [
|
||||
"SQLITE_ENABLE_COLUMN_METADATA",
|
||||
"SQLITE_ENABLE_DBSTAT_VTAB",
|
||||
"SQLITE_ENABLE_FTS3",
|
||||
"SQLITE_ENABLE_FTS3_PARENTHESIS",
|
||||
"SQLITE_ENABLE_FTS5",
|
||||
"SQLITE_ENABLE_GEOPOLY",
|
||||
"SQLITE_ENABLE_MATH_FUNCTIONS",
|
||||
"SQLITE_ENABLE_PERCENTILE",
|
||||
"SQLITE_ENABLE_PREUPDATE_HOOK",
|
||||
"SQLITE_ENABLE_RBU",
|
||||
"SQLITE_ENABLE_RTREE",
|
||||
"SQLITE_ENABLE_SESSION",
|
||||
]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("sqlite.gyp") ],
|
||||
"scope",
|
||||
[ "sqlite.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":sqlite_config" ]
|
||||
sources = gypi_values.sqlite_sources
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code-return",
|
||||
"-Wno-unreachable-code-break",
|
||||
"-Wno-unreachable-code",
|
||||
]
|
||||
if (is_win) {
|
||||
cflags_c += [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unused-function",
|
||||
"-Wno-unused-variable",
|
||||
if (node_shared_sqlite) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("sqlite_config") {
|
||||
packages = [ "sqlite3" ]
|
||||
}
|
||||
# sqlite3.h only declares the session extension when this is defined.
|
||||
config("sqlite_defines") {
|
||||
defines = [ "SQLITE_ENABLE_SESSION" ]
|
||||
}
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [
|
||||
":sqlite_config",
|
||||
":sqlite_defines",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
config("sqlite_config") {
|
||||
include_dirs = [ "." ]
|
||||
defines = [
|
||||
"SQLITE_ENABLE_COLUMN_METADATA",
|
||||
"SQLITE_ENABLE_DBSTAT_VTAB",
|
||||
"SQLITE_ENABLE_FTS3",
|
||||
"SQLITE_ENABLE_FTS3_PARENTHESIS",
|
||||
"SQLITE_ENABLE_FTS5",
|
||||
"SQLITE_ENABLE_GEOPOLY",
|
||||
"SQLITE_ENABLE_MATH_FUNCTIONS",
|
||||
"SQLITE_ENABLE_PERCENTILE",
|
||||
"SQLITE_ENABLE_PREUPDATE_HOOK",
|
||||
"SQLITE_ENABLE_RBU",
|
||||
"SQLITE_ENABLE_RTREE",
|
||||
"SQLITE_ENABLE_SESSION",
|
||||
]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("sqlite.gyp") ],
|
||||
"scope",
|
||||
[ "sqlite.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":sqlite_config" ]
|
||||
sources = gypi_values.sqlite_sources
|
||||
cflags_c = [
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-unreachable-code-return",
|
||||
"-Wno-unreachable-code-break",
|
||||
"-Wno-unreachable-code",
|
||||
]
|
||||
if (is_win) {
|
||||
cflags_c += [
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unused-function",
|
||||
"-Wno-unused-variable",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+114
-101
@@ -4,113 +4,126 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("uv_gn_build") {
|
||||
config("uv_external_config") {
|
||||
include_dirs = [ "include" ]
|
||||
if (is_clang || !is_win) {
|
||||
cflags_cc = [
|
||||
"-Wno-deprecated-pragma", # for using ENODATA in errno.h
|
||||
if (node_shared_libuv) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("uv_external_config") {
|
||||
packages = [ "libuv" ]
|
||||
}
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":uv_external_config" ]
|
||||
}
|
||||
} else {
|
||||
config("uv_external_config") {
|
||||
include_dirs = [ "include" ]
|
||||
if (is_clang || !is_win) {
|
||||
cflags_cc = [
|
||||
"-Wno-deprecated-pragma", # for using ENODATA in errno.h
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
config("uv_internal_config") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"src",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
config("uv_internal_config") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"src",
|
||||
]
|
||||
|
||||
defines = [ "BUILDING_UV_SHARED" ] # always export symbols
|
||||
if (is_posix) {
|
||||
defines += [
|
||||
"_LARGEFILE_SOURCE",
|
||||
"_FILE_OFFSET_BITS=64",
|
||||
]
|
||||
}
|
||||
if (is_linux) {
|
||||
defines += [
|
||||
"_POSIX_C_SOURCE=200112",
|
||||
"_GNU_SOURCE",
|
||||
]
|
||||
}
|
||||
if (is_apple) {
|
||||
defines += [
|
||||
"_DARWIN_USE_64_BIT_INODE=1",
|
||||
"_DARWIN_UNLIMITED_SELECT=1",
|
||||
]
|
||||
}
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-deprecated-declarations",
|
||||
"-Wno-extra-semi",
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-string-conversion",
|
||||
"-Wno-shadow",
|
||||
"-Wno-unreachable-code",
|
||||
"-Wno-unreachable-code-return",
|
||||
"-Wno-unused-but-set-parameter",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unused-function",
|
||||
"-Wno-unused-result",
|
||||
"-Wno-unused-variable",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("uv.gyp") ],
|
||||
"scope",
|
||||
[ "uv.gyp" ])
|
||||
|
||||
component(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
configs += [ ":uv_internal_config" ]
|
||||
public_configs = [ ":uv_external_config" ]
|
||||
|
||||
if (is_posix) {
|
||||
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
||||
configs += [ "//build/config/gcc:symbol_visibility_default" ]
|
||||
defines = [ "BUILDING_UV_SHARED" ] # always export symbols
|
||||
if (is_posix) {
|
||||
defines += [
|
||||
"_LARGEFILE_SOURCE",
|
||||
"_FILE_OFFSET_BITS=64",
|
||||
]
|
||||
}
|
||||
if (is_linux) {
|
||||
defines += [
|
||||
"_POSIX_C_SOURCE=200112",
|
||||
"_GNU_SOURCE",
|
||||
]
|
||||
}
|
||||
if (is_apple) {
|
||||
defines += [
|
||||
"_DARWIN_USE_64_BIT_INODE=1",
|
||||
"_DARWIN_UNLIMITED_SELECT=1",
|
||||
]
|
||||
}
|
||||
if (is_clang || !is_win) {
|
||||
cflags_c = [
|
||||
"-Wno-deprecated-declarations",
|
||||
"-Wno-extra-semi",
|
||||
"-Wno-implicit-fallthrough",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-string-conversion",
|
||||
"-Wno-shadow",
|
||||
"-Wno-unreachable-code",
|
||||
"-Wno-unreachable-code-return",
|
||||
"-Wno-unused-but-set-parameter",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-unused-function",
|
||||
"-Wno-unused-result",
|
||||
"-Wno-unused-variable",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
libs = [
|
||||
"advapi32.lib",
|
||||
"iphlpapi.lib",
|
||||
"psapi.lib",
|
||||
"shell32.lib",
|
||||
"user32.lib",
|
||||
"userenv.lib",
|
||||
"ws2_32.lib",
|
||||
]
|
||||
}
|
||||
if (is_posix) {
|
||||
ldflags = [ "-pthread" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [
|
||||
"m",
|
||||
"dl",
|
||||
"rt",
|
||||
]
|
||||
}
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("uv.gyp") ],
|
||||
"scope",
|
||||
[ "uv.gyp" ])
|
||||
|
||||
sources = gypi_values.uv_sources_common
|
||||
if (is_win) {
|
||||
sources += gypi_values.uv_sources_win
|
||||
}
|
||||
if (is_posix) {
|
||||
sources += gypi_values.uv_sources_posix +
|
||||
[ "src/unix/proctitle.c" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
sources += gypi_values.uv_sources_linux
|
||||
}
|
||||
if (is_apple) {
|
||||
sources += gypi_values.uv_sources_apple +
|
||||
gypi_values.uv_sources_bsd_common
|
||||
component(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
configs += [ ":uv_internal_config" ]
|
||||
public_configs = [ ":uv_external_config" ]
|
||||
|
||||
if (is_posix) {
|
||||
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
||||
configs += [ "//build/config/gcc:symbol_visibility_default" ]
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
libs = [
|
||||
"advapi32.lib",
|
||||
"iphlpapi.lib",
|
||||
"psapi.lib",
|
||||
"shell32.lib",
|
||||
"user32.lib",
|
||||
"userenv.lib",
|
||||
"ws2_32.lib",
|
||||
]
|
||||
}
|
||||
if (is_posix) {
|
||||
ldflags = [ "-pthread" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
libs = [
|
||||
"m",
|
||||
"dl",
|
||||
"rt",
|
||||
]
|
||||
}
|
||||
|
||||
sources = gypi_values.uv_sources_common
|
||||
if (is_win) {
|
||||
sources += gypi_values.uv_sources_win
|
||||
}
|
||||
if (is_posix) {
|
||||
sources += gypi_values.uv_sources_posix +
|
||||
[ "src/unix/proctitle.c" ]
|
||||
}
|
||||
if (is_linux) {
|
||||
sources += gypi_values.uv_sources_linux
|
||||
}
|
||||
if (is_apple) {
|
||||
sources += gypi_values.uv_sources_apple +
|
||||
gypi_values.uv_sources_bsd_common
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+28
-15
@@ -4,25 +4,38 @@
|
||||
|
||||
# The actual configurations are put inside a template in unofficial.gni to
|
||||
# prevent accidental edits from contributors.
|
||||
import("../../node.gni")
|
||||
|
||||
template("zstd_gn_build") {
|
||||
config("zstd_config") {
|
||||
include_dirs = [ "./lib" ]
|
||||
}
|
||||
if (node_shared_zstd) {
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
pkg_config("zstd_config") {
|
||||
packages = [ "libzstd" ]
|
||||
}
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":zstd_config" ]
|
||||
}
|
||||
} else {
|
||||
config("zstd_config") {
|
||||
include_dirs = [ "./lib" ]
|
||||
}
|
||||
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("zstd.gyp") ],
|
||||
"scope",
|
||||
[ "zstd.gyp" ])
|
||||
gypi_values = exec_script("../../tools/gypi_to_gn.py",
|
||||
[ rebase_path("zstd.gyp") ],
|
||||
"scope",
|
||||
[ "zstd.gyp" ])
|
||||
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":zstd_config" ]
|
||||
sources = gypi_values.zstd_sources
|
||||
defines = [ "XXH_NAMESPACE=ZSTD_", "ZSTD_MULTITHREAD", "ZSTD_DISABLE_ASM" ]
|
||||
cflags_c = [ "-Wno-unused-function" ]
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
public_configs = [ ":zstd_config" ]
|
||||
sources = gypi_values.zstd_sources
|
||||
defines = [ "XXH_NAMESPACE=ZSTD_", "ZSTD_MULTITHREAD", "ZSTD_DISABLE_ASM" ]
|
||||
cflags_c = [ "-Wno-unused-function" ]
|
||||
|
||||
if (is_posix) {
|
||||
ldflags = [ "-pthread" ]
|
||||
if (is_posix) {
|
||||
ldflags = [ "-pthread" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,5 +82,19 @@ declare_args() {
|
||||
node_use_amaro = true
|
||||
}
|
||||
|
||||
# Link against shared copies of the bundled dependencies instead of building
|
||||
# them, like configure's --shared-* options. The libraries are looked up with
|
||||
# pkg-config, so these are meant for Linux distribution builds.
|
||||
declare_args() {
|
||||
node_shared_brotli = false
|
||||
node_shared_cares = false
|
||||
node_shared_hdr_histogram = false
|
||||
node_shared_http_parser = false
|
||||
node_shared_libuv = false
|
||||
node_shared_nghttp2 = false
|
||||
node_shared_sqlite = false
|
||||
node_shared_zstd = false
|
||||
}
|
||||
|
||||
assert(!node_enable_inspector || node_use_openssl,
|
||||
"node_enable_inspector requires node_use_openssl")
|
||||
@@ -68,18 +68,19 @@ def translate_config(out_dir, config, v8_config):
|
||||
bool_string_to_number(config['node_enable_inspector']),
|
||||
'shlib_suffix': 'dylib' if sys.platform == 'darwin' else 'so',
|
||||
'tsan': bool_string_to_number(config['is_tsan']),
|
||||
# TODO(zcbenz): Shared components are not supported in GN config yet.
|
||||
'node_shared': 'false',
|
||||
'node_shared_brotli': 'false',
|
||||
'node_shared_cares': 'false',
|
||||
'node_shared_http_parser': 'false',
|
||||
'node_shared_libuv': 'false',
|
||||
'node_shared_nghttp2': 'false',
|
||||
'node_shared_brotli': config['node_shared_brotli'],
|
||||
'node_shared_cares': config['node_shared_cares'],
|
||||
'node_shared_hdr_histogram': config['node_shared_hdr_histogram'],
|
||||
'node_shared_http_parser': config['node_shared_http_parser'],
|
||||
'node_shared_libuv': config['node_shared_libuv'],
|
||||
'node_shared_nghttp2': config['node_shared_nghttp2'],
|
||||
'node_shared_nghttp3': 'false',
|
||||
'node_shared_ngtcp2': 'false',
|
||||
'node_shared_openssl': 'false',
|
||||
'node_shared_sqlite': 'false',
|
||||
'node_shared_sqlite': config['node_shared_sqlite'],
|
||||
'node_shared_zlib': 'false',
|
||||
'node_shared_zstd': config['node_shared_zstd'],
|
||||
}
|
||||
}
|
||||
config_gypi['variables'].update(v8_config)
|
||||
|
||||
Reference in new issue
Block a user