1 #ifndef SRC_NODE_METADATA_H_ 2 #define SRC_NODE_METADATA_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include <string> 7 #include "node_version.h" 8 9 namespace node { 10 11 // if this is a release build and no explicit base has been set 12 // substitute the standard release download URL 13 #ifndef NODE_RELEASE_URLBASE 14 #if NODE_VERSION_IS_RELEASE 15 #define NODE_RELEASE_URLBASE "https://nodejs.org/download/release/" 16 #endif // NODE_VERSION_IS_RELEASE 17 #endif // NODE_RELEASE_URLBASE 18 19 #if defined(NODE_RELEASE_URLBASE) 20 #define NODE_HAS_RELEASE_URLS 21 #endif 22 23 #define NODE_VERSIONS_KEYS_BASE(V) \ 24 V(node) \ 25 V(v8) \ 26 V(uv) \ 27 V(zlib) \ 28 V(brotli) \ 29 V(ares) \ 30 V(modules) \ 31 V(nghttp2) \ 32 V(napi) \ 33 V(llhttp) \ 34 35 #if HAVE_OPENSSL 36 #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) 37 #else 38 #define NODE_VERSIONS_KEY_CRYPTO(V) 39 #endif 40 41 #ifdef NODE_HAVE_I18N_SUPPORT 42 #define NODE_VERSIONS_KEY_INTL(V) \ 43 V(cldr) \ 44 V(icu) \ 45 V(tz) \ 46 V(unicode) 47 #else 48 #define NODE_VERSIONS_KEY_INTL(V) 49 #endif // NODE_HAVE_I18N_SUPPORT 50 51 #define NODE_VERSIONS_KEYS(V) \ 52 NODE_VERSIONS_KEYS_BASE(V) \ 53 NODE_VERSIONS_KEY_CRYPTO(V) \ 54 NODE_VERSIONS_KEY_INTL(V) 55 56 class Metadata { 57 public: 58 Metadata(); 59 Metadata(Metadata&) = delete; 60 Metadata(Metadata&&) = delete; 61 Metadata operator=(Metadata&) = delete; 62 Metadata operator=(Metadata&&) = delete; 63 64 struct Versions { 65 Versions(); 66 67 #ifdef NODE_HAVE_I18N_SUPPORT 68 // Must be called on the main thread after 69 // i18n::InitializeICUDirectory() 70 void InitializeIntlVersions(); 71 #endif // NODE_HAVE_I18N_SUPPORT 72 73 #define V(key) std::string key; 74 NODE_VERSIONS_KEYS(V) 75 #undef V 76 }; 77 78 struct Release { 79 Release(); 80 81 std::string name; 82 #if NODE_VERSION_IS_LTS 83 std::string lts; 84 #endif // NODE_VERSION_IS_LTS 85 86 #ifdef NODE_HAS_RELEASE_URLS 87 std::string source_url; 88 std::string headers_url; 89 #ifdef _WIN32 90 std::string lib_url; 91 #endif // _WIN32 92 #endif // NODE_HAS_RELEASE_URLS 93 }; 94 95 Versions versions; 96 const Release release; 97 const std::string arch; 98 const std::string platform; 99 }; 100 101 // Per-process global 102 namespace per_process { 103 extern Metadata metadata; 104 } 105 106 } // namespace node 107 108 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 109 #endif // SRC_NODE_METADATA_H_ 110