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

219 lines
6.6 KiB
Diff

diff --git a/common.gypi b/common.gypi
index 5bffe1c6..63bc0dbb 100644
--- a/common.gypi
+++ b/common.gypi
@@ -158,7 +158,7 @@
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
- ['clang==1', {
+ ['OS == "msvc" and clang==1', {
'msbuild_toolset': 'ClangCL',
}],
],
@@ -249,7 +249,7 @@
'cflags': [ '-fPIC', '-I<(android_ndk_path)/sources/android/cpufeatures' ],
'ldflags': [ '-fPIC' ]
}],
- ['clang==1', {
+ ['OS == "msvc" and clang==1', {
'msbuild_toolset': 'ClangCL',
}],
],
@@ -504,6 +504,11 @@
'NOMINMAX',
],
}],
+ ['OS == "win" and OS != "msvc"', {
+ 'cflags': [ '-Wno-nullability-completeness' ],
+ 'cflags_cc': [ '-fno-strict-aliasing' ],
+ 'ldflags': [ '-pthread' ],
+ }],
[ 'OS in "linux freebsd openbsd solaris aix os400 openharmony"', {
'cflags': [ '-pthread' ],
'ldflags': [ '-pthread' ],
diff --git a/deps/llhttp/llhttp.gyp b/deps/llhttp/llhttp.gyp
index c7b8800a..b6703471 100644
--- a/deps/llhttp/llhttp.gyp
+++ b/deps/llhttp/llhttp.gyp
@@ -10,6 +10,11 @@
{
'target_name': 'llhttp',
'type': 'static_library',
+ 'conditions': [
+ [ 'target_arch!="arm64"', {
+ 'cflags_c': [ '-mssse3' ],
+ }],
+ ],
'include_dirs': [ '.', 'include' ],
'direct_dependent_settings': {
'include_dirs': [ 'include' ],
diff --git a/deps/ncrypto/ncrypto.gyp b/deps/ncrypto/ncrypto.gyp
index cf9b7c6c..f4004798 100644
--- a/deps/ncrypto/ncrypto.gyp
+++ b/deps/ncrypto/ncrypto.gyp
@@ -16,6 +16,11 @@
},
'sources': [ '<@(ncrypto_sources)' ],
'conditions': [
+ ['OS!="msvc"', {
+ 'cflags': [
+ '-Wno-deprecated-declarations',
+ ],
+ }],
['node_shared_openssl=="false"', {
'dependencies': [
'../openssl/openssl.gyp:openssl'
diff --git a/deps/ngtcp2/ngtcp2.gyp b/deps/ngtcp2/ngtcp2.gyp
index ca64d167..84add94b 100644
--- a/deps/ngtcp2/ngtcp2.gyp
+++ b/deps/ngtcp2/ngtcp2.gyp
@@ -111,6 +111,7 @@
'defines': ['HAVE_UNISTD_H']
}],
['OS=="win"', {
+ 'cflags_c': [ '-mssse3' ],
'defines': [
'WIN32',
'_WINDOWS',
diff --git a/deps/uv/include/uv/win.h b/deps/uv/include/uv/win.h
index a88bf29e..5e20606c 100644
--- a/deps/uv/include/uv/win.h
+++ b/deps/uv/include/uv/win.h
@@ -279,7 +279,7 @@ typedef struct {
DWORD tls_index;
} uv_key_t;
-#define UV_ONCE_INIT { 0, NULL }
+#define UV_ONCE_INIT { 0, INIT_ONCE_STATIC_INIT }
typedef struct uv_once_s {
unsigned char unused;
diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c
index 57061bf8..ba6ac88a 100644
--- a/deps/uv/src/win/util.c
+++ b/deps/uv/src/win/util.c
@@ -509,7 +509,7 @@ unsigned int uv_available_parallelism(void) {
DWORD_PTR procmask;
DWORD_PTR sysmask;
int count;
- int i;
+ unsigned int i;
/* TODO(bnoordhuis) Use GetLogicalProcessorInformationEx() to support systems
* with > 64 CPUs? See https://github.com/libuv/libuv/pull/3458
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index 540445f1..823e6564 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -194,6 +194,19 @@
},
'conditions': [
[ 'OS=="win"', {
+ 'conditions': [
+ ['OS!="msvc"', {
+ 'type': 'static_library',
+ 'conditions': [
+ ['clang==0', {
+ 'cflags': [
+ '-Wno-cast-function-type',
+ '-Wno-maybe-uninitialized',
+ ],
+ }],
+ ],
+ }],
+ ],
'defines': [
'_WIN32_WINNT=0x0602',
'_GNU_SOURCE',
diff --git a/node.gyp b/node.gyp
index fc14d6e5..a3e2ef44 100644
--- a/node.gyp
+++ b/node.gyp
@@ -462,14 +462,14 @@
# Putting these explicitly here so not to depend on `common.gypi`.
# `common.gypi` need to be more general because it is used to build userland native addons.
# Refs: https://github.com/nodejs/node-gyp/issues/1118
- 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
+ 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-unused-variable', '-Wno-deprecated-declarations', ],
'xcode_settings': {
'WARNING_CFLAGS': [
'-Wall',
'-Wendif-labels',
'-W',
'-Wno-unused-parameter',
- '-Werror=undefined-inline',
+ '-Wno-undefined-inline',
'-Werror=extra-semi',
'-Werror=ctad-maybe-unsupported',
],
@@ -574,6 +574,9 @@
'WARNING_CFLAGS': [ '-Werror' ],
},
}],
+ [ 'OS=="win" and OS!="msvc"', {
+ 'sources': [ 'src/res/node.rc' ],
+ }],
[ 'node_intermediate_lib_type=="static_library" and '
'node_shared=="true" and OS in "aix os400"', {
# For AIX, shared lib is linked by static lib and .exp. In the
@@ -584,7 +587,7 @@
}, {
'dependencies': [ '<(node_lib_target_name)' ],
'conditions': [
- ['OS=="win" and node_shared=="true"', {
+ ['OS=="msvc" and node_shared=="true"', {
'dependencies': ['generate_node_def'],
'msvs_settings': {
'VCLinkerTool': {
@@ -618,7 +621,7 @@
'-Wl,--no-whole-archive',
],
}],
- [ 'OS=="win"', {
+ [ 'OS=="msvc"', {
'sources': [ 'src/res/node.rc' ],
}],
],
@@ -1470,7 +1473,7 @@
},
]
}], # end aix section
- ['OS=="win" and node_shared=="true"', {
+ ['OS=="msvc" and node_shared=="true"', {
'targets': [
{
'target_name': 'gen_node_def',
diff --git a/node.gypi b/node.gypi
index a851fbbc..0b1d13c2 100644
--- a/node.gypi
+++ b/node.gypi
@@ -28,11 +28,14 @@
'conditions': [
[ 'clang==1', {
'cflags': [
- '-Werror=undefined-inline',
+ '-Wno-undefined-inline',
'-Werror=extra-semi',
'-Werror=ctad-maybe-unsupported',
],
}],
+ [ 'clang==0', {
+ 'cflags_cc': [ '-Wno-template-id-cdtor' ],
+ }],
[ '"<(_type)"=="executable"', {
'msvs_settings': {
'VCManifestTool': {
@@ -77,7 +80,10 @@
'<(_msvs_precompiled_header)',
'<(_msvs_precompiled_source)',
],
- }]
+ }],
+ ['node_shared_openssl=="true"', {
+ 'libraries': [ '-lcrypt32' ],
+ }],
]
}, { # POSIX
'defines': [ '__POSIX__' ],