build_allow_unbundling_of_node_js_dependencies.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Shelley Vohr <[email protected]>
  3. Date: Sun, 17 Nov 2024 22:33:19 +0100
  4. Subject: build: allow unbundling of Node.js dependencies
  5. Linux distributions have guidelines on using distro-provided dependencies,
  6. rather than compiling them in statically.
  7. This PR this enables downstream packagers to unbundle these dependencies.
  8. We don't need to do this for zlib, as the existing gn workflow uses the same
  9. //third_party/zlib, so unbundling zlib with Chromium tools in
  10. //build/linux/unbundle works already. This adds support for some of the others.
  11. Upstreamed at https://github.com/nodejs/node/pull/55903
  12. diff --git a/unofficial.gni b/unofficial.gni
  13. index 08a4ed939fb1482a897def94128282fdfd63dc62..23367db388ce9e83e123d4c6e8c6325266dd52dc 100644
  14. --- a/unofficial.gni
  15. +++ b/unofficial.gni
  16. @@ -153,7 +153,6 @@ template("node_gn_build") {
  17. ":run_node_js2c",
  18. "deps/cares",
  19. "deps/histogram",
  20. - "deps/llhttp",
  21. "deps/nbytes",
  22. "deps/nghttp2",
  23. "deps/postject",
  24. @@ -184,7 +183,17 @@ template("node_gn_build") {
  25. configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
  26. configs += [ "//build/config/gcc:symbol_visibility_default" ]
  27. }
  28. -
  29. + if (use_system_llhttp) {
  30. + libs += [ "llhttp" ]
  31. + } else {
  32. + deps += [ "deps/llhttp" ]
  33. + }
  34. + if (use_system_histogram) {
  35. + libs += [ "hdr_histogram" ]
  36. + include_dirs += [ "/usr/include/hdr" ]
  37. + } else {
  38. + deps += [ "deps/histogram" ]
  39. + }
  40. if (v8_enable_i18n_support) {
  41. deps += [ "//third_party/icu" ]
  42. }
  43. @@ -211,6 +220,19 @@ template("node_gn_build") {
  44. sources += node_inspector.node_inspector_sources +
  45. node_inspector.node_inspector_generated_sources
  46. }
  47. + if (is_linux) {
  48. + import("//build/config/linux/pkg_config.gni")
  49. + if (use_system_cares) {
  50. + pkg_config("cares") {
  51. + packages = [ "libcares" ]
  52. + }
  53. + }
  54. + if (use_system_nghttp2) {
  55. + pkg_config("nghttp2") {
  56. + packages = [ "libnghttp2" ]
  57. + }
  58. + }
  59. + }
  60. }
  61. executable(target_name) {