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
Next Next commit
build: allow unbundling of Node.js dependencies
  • Loading branch information
codebytere committed Nov 18, 2024
commit 3d1216a02b5722d2a78ae454d8f223566abff48b
6 changes: 6 additions & 0 deletions node.gni
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ declare_args() {

# Build with Amaro (TypeScript utils).
node_use_amaro = true

# Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
use_system_cares = false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Ada?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say it's a small user group because Ada uses C++ types that are not ABI-compatible between LLVM libc++ (linked statically by Chromium as default) and libstdc++ (used as the system one by most distros). use_custom_libcxx=false is very broken, and pretty much the only distros I know of using it currently are Chimera Linux (which uses libc++ as system, and patches libc++ to keep Chromium working), Debian, and openSUSE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's educational. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: openSUSE uses use_custom_libcxx=false for Electron (which i maintain), but not for Chromium (which i don't, and don't have resources to).

It's much more important that it stays usable for Electron, since requiring a custom C++ implementation would also require changes in packaging every Electron application we ship that has native modules.

use_system_nghttp2 = false
use_system_llhttp = false
use_system_histogram = false
}

assert(!node_enable_inspector || node_use_openssl,
Expand Down
26 changes: 24 additions & 2 deletions unofficial.gni
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ template("node_gn_build") {
"deps/brotli",
"deps/cares",
"deps/histogram",
Comment thread
codebytere marked this conversation as resolved.
Resolved
"deps/llhttp",
"deps/nbytes",
"deps/nghttp2",
"deps/ngtcp2",
Expand All @@ -179,7 +178,17 @@ template("node_gn_build") {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}

if (use_system_llhttp) {
libs += [ "llhttp" ]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This passes -lllhttp to the linker, but does not add its header location to include_dirs - pkg-config can resolve it under the name libllhttp

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selfisekai - to clarify, should this instead be:

if (use_system_llhttp) {
   if (is_linux) {
      pkg_config("llhttp") {
        packages = [ "libllhttp" ]
      }
   }
   libs += [ "llhttp" ]
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libs += [ ":llhttp" ], LGTM otherwise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be pkg_config on libllhttp

} else {
deps += [ "deps/llhttp" ]
}
if (use_system_histogram) {
libs += [ "hdr_histogram" ]
include_dirs += [ "/usr/include/hdr" ]
Comment on lines +184 to +185

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also should be pkg_config on hdr_histogram

} else {
deps += [ "deps/histogram" ]
}
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
}
Expand All @@ -206,6 +215,19 @@ template("node_gn_build") {
sources += node_inspector.node_inspector_sources +
node_inspector.node_inspector_generated_sources
}
if (is_linux) {
import("//build/config/linux/pkg_config.gni")
if (use_system_cares) {
pkg_config("cares") {
packages = [ "libcares" ]
}
}
if (use_system_nghttp2) {
pkg_config("nghttp2") {
packages = [ "libnghttp2" ]
}
}
}
}

executable(target_name) {
Expand Down