Index: common.gypi --- common.gypi.orig 2021-10-19 02:48:27.000000000 +0200 +++ common.gypi 2021-10-19 22:18:02.335430000 +0200 @@ -168,7 +168,7 @@ }], ], }, - 'cflags': [ '-O3' ], + 'cflags': [ '-O2' ], 'conditions': [ ['enable_lto=="true"', { 'cflags': ['<(lto)'], @@ -379,7 +379,7 @@ 'ldflags': [ '-pthread' ], }], [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { - 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], + 'cflags': [ '-Wno-unused-parameter', ], 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ], 'defines': [ '__STDC_FORMAT_MACROS' ], 'ldflags': [ '-rdynamic' ], @@ -491,10 +491,7 @@ '-fno-strict-aliasing', ], 'WARNING_CFLAGS': [ - '-Wall', - '-Wendif-labels', - '-W', - '-Wno-unused-parameter', + '-Wno-unused-parameter' ], }, 'target_conditions': [ Index: deps/uv/common.gypi --- deps/uv/common.gypi.orig 2021-10-19 02:48:29.000000000 +0200 +++ deps/uv/common.gypi 2021-10-19 20:22:29.018910000 +0200 @@ -46,7 +46,7 @@ 'Release': { 'defines': [ 'NDEBUG' ], 'cflags': [ - '-O3', + '-O2', ], 'msvs_settings': { 'VCCLCompilerTool': { Index: deps/uv/uv.gyp --- deps/uv/uv.gyp.orig 2021-10-19 02:48:30.000000000 +0200 +++ deps/uv/uv.gyp 2021-10-19 20:22:29.019044000 +0200 @@ -178,7 +178,7 @@ 'src/unix/udp.c', ], 'link_settings': { - 'libraries': [ '-lm' ], + 'libraries': [ '-lz', '-lm' ], 'conditions': [ ['OS=="solaris"', { 'ldflags': [ '-pthreads' ], Index: deps/v8/src/base/numbers/bignum.cc --- deps/v8/src/base/numbers/bignum.cc.orig 2021-10-19 02:48:30.000000000 +0200 +++ deps/v8/src/base/numbers/bignum.cc 2021-10-19 20:22:29.019209000 +0200 @@ -5,6 +5,7 @@ #include "src/base/numbers/bignum.h" #include "src/base/strings.h" +#include namespace v8 { namespace base { Index: deps/v8/src/base/platform/platform-freebsd.cc --- deps/v8/src/base/platform/platform-freebsd.cc.orig 2021-10-19 02:48:30.000000000 +0200 +++ deps/v8/src/base/platform/platform-freebsd.cc 2021-10-19 20:22:29.019319000 +0200 @@ -28,6 +28,7 @@ #include // index #include +#include #undef MAP_TYPE Index: deps/v8/src/base/strings.h --- deps/v8/src/base/strings.h.orig 2021-10-19 02:48:30.000000000 +0200 +++ deps/v8/src/base/strings.h 2021-10-19 20:22:29.019417000 +0200 @@ -8,6 +8,7 @@ #include "src/base/base-export.h" #include "src/base/macros.h" #include "src/base/vector.h" +#include namespace v8 { namespace base { Index: deps/v8/src/wasm/wasm-result.cc --- deps/v8/src/wasm/wasm-result.cc.orig 2021-10-19 02:48:30.000000000 +0200 +++ deps/v8/src/wasm/wasm-result.cc 2021-10-19 20:22:29.019525000 +0200 @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "src/wasm/wasm-result.h" #include "src/base/platform/platform.h" Index: lib/dns.js --- lib/dns.js.orig 2021-10-19 02:48:32.000000000 +0200 +++ lib/dns.js 2021-10-19 20:22:29.019652000 +0200 @@ -169,6 +169,10 @@ req.hostname = hostname; req.oncomplete = all ? onlookupall : onlookup; + /* FreeBSD getaddrinfo(3) knows AI_V4MAPPED, but dislikes it */ + if (process.platform === "freebsd") + hints &= ~(exports.V4MAPPED); + const err = cares.getaddrinfo( req, toASCII(hostname), family, hints, verbatim ); Index: lib/internal/modules/cjs/loader.js --- lib/internal/modules/cjs/loader.js.orig 2021-10-19 02:48:32.000000000 +0200 +++ lib/internal/modules/cjs/loader.js 2021-10-19 20:22:29.019864000 +0200 @@ -1228,7 +1228,10 @@ path.resolve(process.execPath, '..') : path.resolve(process.execPath, '..', '..'); - const paths = [path.resolve(prefixDir, 'lib', 'node')]; + const paths = [ + path.resolve(prefixDir, '..', 'lib', 'node', 'usr'), + path.resolve(prefixDir, '..', 'lib', 'node', 'pkg') + ]; if (homeDir) { ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries')); Index: src/crypto/crypto_aes.cc --- src/crypto/crypto_aes.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_aes.cc 2021-10-19 20:22:29.020008000 +0200 @@ -10,8 +10,8 @@ #include "threadpoolwork-inl.h" #include "v8.h" -#include -#include +#include "openssl/bn.h" +#include "openssl/aes.h" #include Index: src/crypto/crypto_bio.cc --- src/crypto/crypto_bio.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_bio.cc 2021-10-19 20:22:29.020131000 +0200 @@ -25,7 +25,7 @@ #include "allocated_buffer-inl.h" #include "util-inl.h" -#include +#include "openssl/bio.h" #include #include Index: src/crypto/crypto_common.cc --- src/crypto/crypto_common.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_common.cc 2021-10-19 20:22:29.020302000 +0200 @@ -11,14 +11,14 @@ #include "memory_tracker-inl.h" #include "v8.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "openssl/ec.h" +#include "openssl/ecdh.h" +#include "openssl/evp.h" +#include "openssl/pem.h" +#include "openssl/x509v3.h" +#include "openssl/hmac.h" +#include "openssl/rand.h" +#include "openssl/pkcs12.h" #include #include Index: src/crypto/crypto_common.h --- src/crypto/crypto_common.h.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_common.h 2021-10-19 20:22:29.020402000 +0200 @@ -5,8 +5,8 @@ #include "node_crypto.h" #include "v8.h" -#include -#include +#include "openssl/ssl.h" +#include "openssl/x509v3.h" #include #include Index: src/crypto/crypto_context.cc --- src/crypto/crypto_context.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_context.cc 2021-10-19 20:22:29.020594000 +0200 @@ -11,11 +11,11 @@ #include "util.h" #include "v8.h" -#include -#include -#include +#include "openssl/x509.h" +#include "openssl/pkcs12.h" +#include "openssl/rand.h" #ifndef OPENSSL_NO_ENGINE -#include +#include "openssl/engine.h" #endif // !OPENSSL_NO_ENGINE namespace node { Index: src/crypto/crypto_dsa.cc --- src/crypto/crypto_dsa.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_dsa.cc 2021-10-19 20:22:29.020694000 +0200 @@ -7,8 +7,8 @@ #include "threadpoolwork-inl.h" #include "v8.h" -#include -#include +#include "openssl/bn.h" +#include "openssl/dsa.h" #include Index: src/crypto/crypto_keys.h --- src/crypto/crypto_keys.h.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_keys.h 2021-10-19 20:22:29.020806000 +0200 @@ -11,7 +11,7 @@ #include "node_worker.h" #include "v8.h" -#include +#include "openssl/evp.h" #include #include Index: src/crypto/crypto_rsa.cc --- src/crypto/crypto_rsa.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_rsa.cc 2021-10-19 20:22:29.020942000 +0200 @@ -10,8 +10,8 @@ #include "threadpoolwork-inl.h" #include "v8.h" -#include -#include +#include "openssl/bn.h" +#include "openssl/rsa.h" namespace node { Index: src/crypto/crypto_spkac.h --- src/crypto/crypto_spkac.h.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_spkac.h 2021-10-19 20:22:29.021028000 +0200 @@ -6,7 +6,7 @@ #include "env.h" #include "v8.h" -#include +#include "openssl/evp.h" namespace node { namespace crypto { Index: src/crypto/crypto_timing.cc --- src/crypto/crypto_timing.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_timing.cc 2021-10-19 20:22:29.021121000 +0200 @@ -5,7 +5,7 @@ #include "v8.h" #include "node.h" -#include +#include "openssl/crypto.h" namespace node { Index: src/crypto/crypto_tls.h --- src/crypto/crypto_tls.h.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_tls.h 2021-10-19 20:22:29.021233000 +0200 @@ -32,7 +32,7 @@ #include "stream_wrap.h" #include "v8.h" -#include +#include "openssl/ssl.h" #include Index: src/crypto/crypto_util.h --- src/crypto/crypto_util.h.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/crypto/crypto_util.h 2021-10-19 20:22:29.021373000 +0200 @@ -12,15 +12,15 @@ #include "v8.h" #include "string_bytes.h" -#include -#include -#include -#include -#include -#include -#include +#include "openssl/err.h" +#include "openssl/evp.h" +#include "openssl/ec.h" +#include "openssl/kdf.h" +#include "openssl/rsa.h" +#include "openssl/dsa.h" +#include "openssl/ssl.h" #ifndef OPENSSL_NO_ENGINE -# include +# include "openssl/engine.h" #endif // !OPENSSL_NO_ENGINE // The FIPS-related functions are only available // when the OpenSSL itself was compiled with FIPS support. Index: src/inspector_socket_server.cc --- src/inspector_socket_server.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/inspector_socket_server.cc 2021-10-19 20:22:29.021503000 +0200 @@ -20,7 +20,7 @@ bool include_protocol); namespace { -static const uint8_t PROTOCOL_JSON[] = { +static uint8_t PROTOCOL_JSON[] = { #include "v8_inspector_protocol_json.h" // NOLINT(build/include_order) }; Index: src/node_constants.cc --- src/node_constants.cc.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/node_constants.cc 2021-10-19 20:22:29.021668000 +0200 @@ -36,10 +36,10 @@ #if HAVE_OPENSSL -#include -#include +#include "openssl/ec.h" +#include "openssl/ssl.h" #ifndef OPENSSL_NO_ENGINE -#include +#include "openssl/engine.h" #endif // !OPENSSL_NO_ENGINE #endif // HAVE_OPENSSL Index: src/node_metadata.cc --- src/node_metadata.cc.orig 2021-10-19 20:22:29.021798000 +0200 +++ src/node_metadata.cc 2021-10-19 22:18:22.718033000 +0200 @@ -10,9 +10,9 @@ #include "zlib.h" #if HAVE_OPENSSL -#include +#include "openssl/opensslv.h" #if NODE_OPENSSL_HAS_QUIC -#include +#include "openssl/quic.h" #endif #endif // HAVE_OPENSSL Index: src/util.h --- src/util.h.orig 2021-10-19 02:48:32.000000000 +0200 +++ src/util.h 2021-10-19 20:22:29.022009000 +0200 @@ -150,14 +150,23 @@ } \ } while (0) +#undef CHECK_EQ #define CHECK_EQ(a, b) CHECK((a) == (b)) +#undef CHECK_GE #define CHECK_GE(a, b) CHECK((a) >= (b)) +#undef CHECK_GT #define CHECK_GT(a, b) CHECK((a) > (b)) +#undef CHECK_LE #define CHECK_LE(a, b) CHECK((a) <= (b)) +#undef CHECK_LT #define CHECK_LT(a, b) CHECK((a) < (b)) +#undef CHECK_NE #define CHECK_NE(a, b) CHECK((a) != (b)) +#undef CHECK_NULL #define CHECK_NULL(val) CHECK((val) == nullptr) +#undef CHECK_NOT_NULL #define CHECK_NOT_NULL(val) CHECK((val) != nullptr) +#undef CHECK_IMPLIES #define CHECK_IMPLIES(a, b) CHECK(!(a) || (b)) #ifdef DEBUG @@ -185,6 +194,7 @@ #endif +#undef UNREACHABLE #define UNREACHABLE(...) \ ERROR_AND_ABORT("Unreachable code reached" __VA_OPT__(": ") __VA_ARGS__) Index: tools/install.py --- tools/install.py.orig 2021-10-19 02:48:32.000000000 +0200 +++ tools/install.py 2021-10-19 20:22:29.022125000 +0200 @@ -156,10 +156,7 @@ action(['deps/v8/tools/gdbinit'], 'share/doc/node/') action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/') - if 'freebsd' in sys.platform or 'openbsd' in sys.platform: - action(['doc/node.1'], 'man/man1/') - else: - action(['doc/node.1'], 'share/man/man1/') + action(['doc/node.1'], 'man/man1/') if 'true' == variables.get('node_install_npm'): npm_files(action) Index: tools/v8_gypfiles/toolchain.gypi --- tools/v8_gypfiles/toolchain.gypi.orig 2021-10-19 02:48:33.000000000 +0200 +++ tools/v8_gypfiles/toolchain.gypi 2021-10-19 20:22:29.022329000 +0200 @@ -1117,12 +1117,6 @@ ['OS=="solaris"', { 'defines': [ '__C99FEATURES__=1' ], # isinf() etc. }], - ['OS=="freebsd" or OS=="openbsd"', { - 'cflags': [ '-I/usr/local/include' ], - }], - ['OS=="netbsd"', { - 'cflags': [ '-I/usr/pkg/include' ], - }], ['OS=="aix"', { 'defines': [ # Support for malloc(0) @@ -1265,8 +1259,8 @@ # Don't use -O3 with sanitizers. ['asan==0 and msan==0 and lsan==0 \ and tsan==0 and ubsan==0 and ubsan_vptr==0', { - 'cflags': ['-O3'], - 'cflags!': ['-O2'], + 'cflags': ['-O2'], + 'cflags!': ['-O3'], }, { 'cflags': ['-O2'], 'cflags!': ['-O3'], @@ -1313,8 +1307,8 @@ # Don't use -O3 with sanitizers. ['asan==0 and msan==0 and lsan==0 \ and tsan==0 and ubsan==0 and ubsan_vptr==0', { - 'cflags': ['-O3'], - 'cflags!': ['-O2'], + 'cflags': ['-O2'], + 'cflags!': ['-O3'], }, { 'cflags': ['-O2'], 'cflags!': ['-O3'],