0001-add-qemu-wrapper-support.patch 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From fa09fa3ad6a21ae0b35fb860f76d1762e5f29972 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <aduskett@gmail.com>
  3. Date: Mon, 27 Sep 2021 12:55:09 -0700
  4. Subject: [PATCH] add qemu-wrapper support
  5. V8's JIT infrastructure requires binaries such as mksnapshot and mkpeephole to
  6. be run in the host during the build. However, these binaries must have the
  7. same bit-width as the target (e.g. a x86_64 host targeting ARMv6 needs to
  8. produce a 32-bit binary). To work around this issue, cross-compile the
  9. binaries for the target and run them on the host with QEMU, much like
  10. gobject-introspection.
  11. However, for the host-variant we do not want to use a
  12. qemu-wrapper, so add @MAYBE_WRAPPER@ to the needed files and sed the path to
  13. the qemu-wrapper on target builds, and remove @MAYBE_WRAPPER@ entirely on
  14. host-builds.
  15. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  16. ---
  17. node.gyp | 4 ++--
  18. tools/v8_gypfiles/v8.gyp | 8 ++++----
  19. 2 files changed, 6 insertions(+), 6 deletions(-)
  20. diff --git a/node.gyp b/node.gyp
  21. index 8ba0dfeb..c77f6f7d 100644
  22. --- a/node.gyp
  23. +++ b/node.gyp
  24. @@ -491,7 +491,7 @@
  25. 'action_name': 'run_mkcodecache',
  26. 'process_outputs_as_sources': 1,
  27. 'inputs': [
  28. - '<(mkcodecache_exec)',
  29. + @MAYBE_WRAPPER@ '<(mkcodecache_exec)',
  30. ],
  31. 'outputs': [
  32. '<(SHARED_INTERMEDIATE_DIR)/node_code_cache.cc',
  33. @@ -516,7 +516,7 @@
  34. 'action_name': 'node_mksnapshot',
  35. 'process_outputs_as_sources': 1,
  36. 'inputs': [
  37. - '<(node_mksnapshot_exec)',
  38. + @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)',
  39. ],
  40. 'outputs': [
  41. '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
  42. diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
  43. index 48ec392b..f9bb0fbe 100644
  44. --- a/tools/v8_gypfiles/v8.gyp
  45. +++ b/tools/v8_gypfiles/v8.gyp
  46. @@ -220,7 +220,7 @@
  47. {
  48. 'action_name': 'run_torque_action',
  49. 'inputs': [ # Order matters.
  50. - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
  51. + @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
  52. '<@(torque_files)',
  53. ],
  54. 'outputs': [
  55. @@ -351,7 +351,7 @@
  56. {
  57. 'action_name': 'generate_bytecode_builtins_list_action',
  58. 'inputs': [
  59. - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
  60. + @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
  61. ],
  62. 'outputs': [
  63. '<(generate_bytecode_builtins_list_output)',
  64. @@ -533,7 +533,7 @@
  65. ],
  66. },
  67. 'inputs': [
  68. - '<(mksnapshot_exec)',
  69. + @MAYBE_WRAPPER@ '<(mksnapshot_exec)',
  70. ],
  71. 'outputs': [
  72. '<(INTERMEDIATE_DIR)/snapshot.cc',
  73. @@ -1448,7 +1448,7 @@
  74. {
  75. 'action_name': 'run_gen-regexp-special-case_action',
  76. 'inputs': [
  77. - '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)',
  78. + @MAYBE_WRAPPER@ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)',
  79. ],
  80. 'outputs': [
  81. '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc',
  82. --
  83. 2.31.1