Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/node_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include <nghttp3/version.h>
#endif

#if defined(__GLIBC__) && !defined(__UCLIBC__)
#include <gnu/libc-version.h> /* gnu_get_libc_version() */
#endif

#ifdef NODE_HAVE_I18N_SUPPORT
#include <unicode/timezone.h>
#include <unicode/ulocdata.h>
Expand Down Expand Up @@ -99,6 +103,21 @@ Metadata::Versions::Versions() {
openssl = GetOpenSSLVersion();
#endif

#ifdef __GLIBC__
glibcCompiler = __GLIBC__ + "." + __GLIBC_MINOR__;
#endif /* __GLIBC__ */

#ifndef _WIN32
#ifdef RTLD_DEFAULT
const char* (*libc_version)();
*(reinterpret_cast<void**>(&libc_version)) =
dlsym(RTLD_DEFAULT, "gnu_get_libc_version");
if (libc_version != nullptr) {
glibcRuntime = (*libc_version)();
}
#endif /* RTLD_DEFAULT */
#endif /* _WIN32 */

#ifdef NODE_HAVE_I18N_SUPPORT
icu = U_ICU_VERSION;
unicode = U_UNICODE_VERSION;
Expand Down
14 changes: 14 additions & 0 deletions src/node_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ namespace node {
#define NODE_VERSIONS_KEY_CRYPTO(V)
#endif

#ifdef __GLIBC__
#define NODE_VERSIONS_KEY_GLIBC_COMPILER(V) V(glibcCompiler)
#else
#define NODE_VERSIONS_KEY_GLIBC_COMPILER(V)
#endif /* __GLIBC__ */

#ifndef _WIN32
#define NODE_VERSIONS_KEY_GLIBC_RUNTIME(V) V(glibcRuntime)
#else
#define NODE_VERSIONS_KEY_GLIBC_RUNTIME(V)
#endif /* _WIN32 */

#ifdef NODE_HAVE_I18N_SUPPORT
#define NODE_VERSIONS_KEY_INTL(V) \
V(cldr) \
Expand All @@ -66,6 +78,8 @@ namespace node {
#define NODE_VERSIONS_KEYS(V) \
NODE_VERSIONS_KEYS_BASE(V) \
NODE_VERSIONS_KEY_CRYPTO(V) \
NODE_VERSIONS_KEY_GLIBC_COMPILER(V) \
NODE_VERSIONS_KEY_GLIBC_RUNTIME(V) \
NODE_VERSIONS_KEY_INTL(V) \
NODE_VERSIONS_KEY_QUIC(V)

Expand Down