src: fix dynamically linked zlib version

Report the version of the dynamically linked zlib if built with
`configure --shared-zlib` instead of the hardcoded version that
corresponds to the bundled version of zlib in `deps`.

PR-URL: https://github.com/nodejs/node/pull/51007
Refs: https://github.com/nodejs/node/pull/50910
Refs: https://github.com/nodejs/node/pull/50158
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
This commit is contained in:
Richard Lau authored and GitHub committed 2023-12-04 17:30:58 +00:00
1 parent d4bcdd89c7
commit 7b3eb311a7
2 files changed
+10

No files matched your search

+1
View File
@@ -141,6 +141,7 @@
} ],
[ 'node_shared_zlib=="false"', {
'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
'defines': [ 'NODE_BUNDLED_ZLIB' ],
'conditions': [
[ 'force_load=="true"', {
'xcode_settings': {
+9
View File
@@ -15,7 +15,12 @@
#include "uv.h"
#include "uvwasi.h"
#include "v8.h"
#ifdef NODE_BUNDLED_ZLIB
#include "zlib_version.h"
#else
#include <zlib.h>
#endif // NODE_BUNDLED_ZLIB
#if HAVE_OPENSSL
#include <openssl/opensslv.h>
@@ -79,7 +84,11 @@ Metadata::Versions::Versions() {
node = NODE_VERSION_STRING;
v8 = v8::V8::GetVersion();
uv = uv_version_string();
#ifdef NODE_BUNDLED_ZLIB
zlib = ZLIB_VERSION;
#else
zlib = zlibVersion();
#endif // NODE_BUNDLED_ZLIB
ares = ARES_VERSION_STR;
modules = NODE_STRINGIFY(NODE_MODULE_VERSION);
nghttp2 = NGHTTP2_VERSION;