From e9f38a3c78508db53c373bcc9be01584d655a0e3 Mon Sep 17 00:00:00 2001 From: Pooja D P Date: Tue, 24 Nov 2020 22:49:21 -0800 Subject: [PATCH 1/3] build: enable building with shared uvwasi lib Fixes: https://github.com/nodejs/node/issues/35339 --- configure.py | 22 ++++++++++ node.gyp | 111 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 121 insertions(+), 12 deletions(-) diff --git a/configure.py b/configure.py index 50994c8c2772e2..c2361fb03d1cd8 100755 --- a/configure.py +++ b/configure.py @@ -355,6 +355,27 @@ dest='shared_openssl_libpath', help='a directory to search for the shared OpenSSL DLLs') +shared_optgroup.add_argument('--shared-uvwasi', + action='store_true', + dest='shared_uvwasi', + help='linked to a shared uvwasi DLL instead of static linking') + +shared_optgroup.add_argument('--shared-uvwasi-includes', + action='store', + dest='shared_uvwasi_includes', + help='directory containing uvwasi header files') + +shared_optgroup.add_argument('--shared-uvwasi-libname', + action='store', + dest='shared_uvwasi_libname', + default='uvwasi', + help='alternative lib name to link to [default: %default]') + +shared_optgroup.add_argument('--shared-uvwasi-libpath', + action='store', + dest='shared_uvwasi_libpath', + help='a directory to search for the shared uvwasi DLL') + shared_optgroup.add_argument('--shared-zlib', action='store_true', dest='shared_zlib', @@ -1894,6 +1915,7 @@ def make_bin_override(): configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc']) configure_library('cares', output, pkgname='libcares') configure_library('nghttp2', output, pkgname='libnghttp2') +configure_library('uvwasi', output, pkgname='libuvwasi') configure_v8(output) configure_openssl(output) configure_intl(output) diff --git a/node.gyp b/node.gyp index 643c8a43c6ff9c..204826abb01c1b 100644 --- a/node.gyp +++ b/node.gyp @@ -20,6 +20,7 @@ 'node_shared_http_parser%': 'false', 'node_shared_cares%': 'false', 'node_shared_libuv%': 'false', + 'node_shared_uvwasi%': 'false', 'node_shared_nghttp2%': 'false', 'node_shared_ngtcp2%': 'false', 'node_shared_nghttp3%': 'false', @@ -390,7 +391,14 @@ 'dependencies': [ 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', + ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], ], 'msvs_settings': { @@ -573,7 +581,14 @@ ], 'dependencies': [ 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', + ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], ], 'sources': [ @@ -1267,11 +1282,19 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', 'node_dtrace_header', 'node_dtrace_ustack', 'node_dtrace_provider', ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], + ], + 'includes': [ 'node.gypi' ], @@ -1281,9 +1304,17 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', 'test/cctest', ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'include_dirs': [ + 'deps/uvwasi/include', + ], + }], + ], + 'defines': [ 'NODE_ARCH="<(target_arch)"', 'NODE_PLATFORM="<(OS)"', @@ -1311,12 +1342,19 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', 'node_dtrace_header', 'node_dtrace_ustack', 'node_dtrace_provider', ], + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], + ], + 'includes': [ 'node.gypi' ], @@ -1327,10 +1365,17 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', 'test/cctest', ], + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'include_dirs': [ + 'deps/uvwasi/include', + ], + }], + ], + 'defines': [ 'NODE_ARCH="<(target_arch)"', 'NODE_PLATFORM="<(OS)"', @@ -1419,12 +1464,19 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', 'node_dtrace_header', 'node_dtrace_ustack', 'node_dtrace_provider', ], + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], + ], + 'includes': [ 'node.gypi' ], @@ -1435,10 +1487,17 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', 'test/embedding', ], + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'include_dirs': [ + 'deps/uvwasi/include', + ], + }], + ], + 'sources': [ 'src/node_snapshot_stub.cc', 'src/node_code_cache_stub.cc', @@ -1481,7 +1540,14 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', + ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], ], 'includes': [ @@ -1494,7 +1560,14 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', + ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'include_dirs': [ + 'deps/uvwasi/include', + ], + }], ], 'defines': [ @@ -1541,7 +1614,14 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'deps/uvwasi/uvwasi.gyp:uvwasi', + ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ + 'deps/uvwasi/uvwasi.gyp:uvwasi' + ], + }], ], 'includes': [ @@ -1554,7 +1634,14 @@ 'deps/v8/include', 'deps/cares/include', 'deps/uv/include', - 'deps/uvwasi/include', + ], + + 'conditions': [ + [ 'node_shared_uvwasi=="false"', { + 'include_dirs': [ + 'deps/uvwasi/include', + ], + }], ], 'defines': [ 'NODE_WANT_INTERNALS=1' ], From 6bf4f0db087399a0404271f17640ae272fa87cea Mon Sep 17 00:00:00 2001 From: Pooja D P Date: Mon, 30 Nov 2020 22:43:13 -0800 Subject: [PATCH 2/3] fixup: address review comments --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index c2361fb03d1cd8..57bc40f996197b 100755 --- a/configure.py +++ b/configure.py @@ -358,7 +358,7 @@ shared_optgroup.add_argument('--shared-uvwasi', action='store_true', dest='shared_uvwasi', - help='linked to a shared uvwasi DLL instead of static linking') + help='link to a shared uvwasi DLL instead of static linking') shared_optgroup.add_argument('--shared-uvwasi-includes', action='store', From 45d7a19f3f664468f75bb61579371a75fb396b31 Mon Sep 17 00:00:00 2001 From: Teutates <103068388+Teutates@users.noreply.github.com> Date: Mon, 25 Jul 2022 12:47:52 -0400 Subject: [PATCH 3/3] fixup: cleanup after code merge Second merge fix Let's see if this is all that was needed Final final --- configure.py | 1 + node.gyp | 136 --------------------------------------------------- node.gypi | 4 ++ 3 files changed, 5 insertions(+), 136 deletions(-) diff --git a/configure.py b/configure.py index 55a7c6108a9945..ff5e72fc1a9775 100755 --- a/configure.py +++ b/configure.py @@ -357,6 +357,7 @@ shared_optgroup.add_argument('--shared-uvwasi', action='store_true', dest='shared_uvwasi', + default=None, help='link to a shared uvwasi DLL instead of static linking') shared_optgroup.add_argument('--shared-uvwasi-includes', diff --git a/node.gyp b/node.gyp index 4497bbf7ea0bcc..62d98ba2c8ebdd 100644 --- a/node.gyp +++ b/node.gyp @@ -163,14 +163,6 @@ 'deps/histogram/histogram.gyp:histogram', ], - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], - ], - 'msvs_settings': { 'VCLinkerTool': { 'GenerateMapFile': 'true', # /MAP @@ -462,14 +454,6 @@ 'deps/histogram/histogram.gyp:histogram', ], - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], - ], - 'sources': [ 'src/api/async_resource.cc', 'src/api/callback.cc', @@ -927,18 +911,6 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', - 'deps/uvwasi/uvwasi.gyp:uvwasi', - ], - - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], ], 'includes': [ @@ -953,14 +925,6 @@ 'test/cctest', ], - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'include_dirs': [ - 'deps/uvwasi/include', - ], - }], - ], - 'defines': [ 'NODE_ARCH="<(target_arch)"', 'NODE_PLATFORM="<(OS)"', @@ -990,18 +954,6 @@ 'deps/googletest/googletest.gyp:gtest', 'deps/googletest/googletest.gyp:gtest_main', 'deps/histogram/histogram.gyp:histogram', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', - 'deps/uvwasi/uvwasi.gyp:uvwasi', - ], - - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], ], 'includes': [ @@ -1017,14 +969,6 @@ 'test/cctest', ], - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'include_dirs': [ - 'deps/uvwasi/include', - ], - }], - ], - 'defines': [ 'NODE_ARCH="<(target_arch)"', 'NODE_PLATFORM="<(OS)"', @@ -1103,18 +1047,6 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', - 'node_dtrace_header', - 'node_dtrace_ustack', - 'node_dtrace_provider', - 'deps/uvwasi/uvwasi.gyp:uvwasi', - ], - - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], ], 'includes': [ @@ -1130,14 +1062,6 @@ 'test/embedding', ], - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'include_dirs': [ - 'deps/uvwasi/include', - ], - }], - ], - 'sources': [ 'src/node_snapshot_stub.cc', 'test/embedding/embedtest.cc', @@ -1170,50 +1094,6 @@ 'target_name': 'overlapped-checker', 'type': 'executable', - 'dependencies': [ - '<(node_lib_target_name)', - 'deps/histogram/histogram.gyp:histogram', - ], - - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], - ], - - 'includes': [ - 'node.gypi' - ], - - 'include_dirs': [ - 'src', - 'tools/msvs/genfiles', - 'deps/v8/include', - 'deps/cares/include', - 'deps/uv/include', - ], - - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'include_dirs': [ - 'deps/uvwasi/include', - ], - }], - ], - - 'defines': [ - 'NODE_WANT_INTERNALS=1' - ], - 'sources': [ - 'src/node_snapshot_stub.cc', - 'src/node_code_cache_stub.cc', - 'tools/code_cache/mkcodecache.cc', - 'tools/code_cache/cache_builder.cc', - 'tools/code_cache/cache_builder.h', - ], - 'conditions': [ ['OS=="win"', { 'sources': [ @@ -1235,14 +1115,6 @@ '<(node_lib_target_name)', 'deps/histogram/histogram.gyp:histogram', ], - - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'dependencies': [ - 'deps/uvwasi/uvwasi.gyp:uvwasi' - ], - }], - ], 'includes': [ 'node.gypi' @@ -1256,14 +1128,6 @@ 'deps/uv/include', ], - 'conditions': [ - [ 'node_shared_uvwasi=="false"', { - 'include_dirs': [ - 'deps/uvwasi/include', - ], - }], - ], - 'defines': [ 'NODE_WANT_INTERNALS=1' ], 'sources': [ diff --git a/node.gypi b/node.gypi index d24928df8b29c9..10597bc35acdb5 100644 --- a/node.gypi +++ b/node.gypi @@ -196,6 +196,10 @@ ], }], + [ 'node_shared_uvwasi=="false"', { + 'dependencies': [ 'deps/uvwasi/uvwasi.gyp:uvwasi' ], + }], + [ 'node_shared_nghttp2=="false"', { 'dependencies': [ 'deps/nghttp2/nghttp2.gyp:nghttp2' ], }],