MINGW-packages/mingw-w64-nodejs/0201-v8-buildflags-fixes.patch
2025-07-13 10:57:51 +03:00

138 lines
4.3 KiB
Diff

diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn
index 9a2b2cdd..1162718a 100644
--- a/deps/v8/BUILD.gn
+++ b/deps/v8/BUILD.gn
@@ -1598,14 +1598,16 @@ config("toolchain") {
if (v8_current_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
- if (is_win) {
+ if (is_msvc) {
# Ensure no surprising artifacts from 80bit double math with x86.
cflags += [ "/arch:SSE2" ]
+ } else {
+ cflags += [ "-msse2" ]
}
}
if (v8_current_cpu == "x64") {
defines += [ "V8_TARGET_ARCH_X64" ]
- if (is_win) {
+ if (is_msvc) {
# Increase the initial stack size. The default is 1MB, this is 2MB. This
# applies only to executables and shared libraries produced by V8 since
# ldflags are not pushed to dependants.
@@ -1637,7 +1639,7 @@ config("toolchain") {
}
if (v8_no_inline) {
- if (is_win) {
+ if (is_msvc) {
cflags += [ "/Ob0" ]
} else {
cflags += [
@@ -1671,6 +1673,14 @@ config("toolchain") {
cflags += [ "-Wctad-maybe-unsupported" ]
}
+ if (is_mingw) {
+ cflags += [
+ # Disable warnings on unused variables
+ "-Wno-unused-variable",
+ "-Wno-deprecated-this-capture",
+ ]
+ }
+
if (is_clang && use_cppgc_clang_plugin && clang_use_chrome_plugins) {
# The plugin is built directly into clang, so there's no need to load it
# dynamically.
@@ -1732,6 +1742,11 @@ config("toolchain") {
# Disable dangling pointer warnings, which are often false positives when
# using scopes.
"-Wno-dangling-pointer",
+ ],
+ cflags_cc = [
+ # Disable some more warnings on gcc c++20
+ "-Wno-deprecated-declarations",
+ "-Wno-template-id-cdtor",
]
}
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index 9b2917e4..fc97594f 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -41,6 +41,11 @@
}, {
'is_win': 0,
}],
+ ['OS == "msvc"', { # Dummy OS, to differentiate between MSVC and MinGW
+ 'is_msvc': 1,
+ }, {
+ 'is_msvc': 0,
+ }],
['OS == "fuchsia"', {
'is_fuchsia': 1,
}, {
diff --git a/tools/v8_gypfiles/toolchain.gypi b/tools/v8_gypfiles/toolchain.gypi
index 1c44c94b..bcd3448e 100644
--- a/tools/v8_gypfiles/toolchain.gypi
+++ b/tools/v8_gypfiles/toolchain.gypi
@@ -106,7 +106,7 @@
'target_defaults': {
'cflags!': ['-Wall', '-Wextra'],
'conditions': [
- ['clang==0 and OS!="win"', {
+ ['clang==0 and OS!="msvc"', {
'cflags': [
# In deps/v8/BUILD.gn: if (!is_clang && !is_win) { cflags += [...] }
'-Wno-strict-overflow',
@@ -122,8 +122,12 @@
# On by default in Clang and V8 requires it at least for arm64.
'-flax-vector-conversions',
],
+ 'cflags_cc': [
+ '-Wno-deprecated-declarations',
+ '-Wno-template-id-cdtor',
+ ],
}],
- ['clang==1 or OS!="win"', {
+ ['clang==1 or OS!="msvc"', {
'cflags_cc': [
# In deps/v8/BUILD.gn: if (is_clang || !is_win) { cflags += [...] }
'-Wno-invalid-offsetof',
@@ -141,6 +145,12 @@
},
},
}],
+ ['clang==1 and OS!="msvc"', {
+ 'cflags_cc': [
+ '-Wno-unused-variable',
+ '-Wno-deprecated-this-capture',
+ ],
+ }],
['v8_target_arch=="arm"', {
'defines': [
'V8_TARGET_ARCH_ARM',
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index 32f00097..b84ca86d 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -70,7 +70,7 @@
'type': 'none',
'toolsets': ['host', 'target'],
'conditions': [
- ['OS == "win" and (clang != 1 or use_ccache_win != 1)', {
+ ['OS == "msvc" and (clang != 1 or use_ccache_win != 1)', {
'direct_dependent_settings': {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
@@ -515,7 +515,7 @@
'abseil.gyp:abseil',
]
}],
- ['OS=="win" and clang==1', {
+ ['OS=="msvc" and clang==1', {
'actions': [
{
'action_name': 'asm_to_inline_asm',