diff options
| -rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch | 93 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs_14.16.1.bb | 34 |
2 files changed, 74 insertions, 53 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch index b5142dc9c1..c6fc2dcd76 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch +++ b/meta-oe/recipes-devtools/nodejs/nodejs/0002-Using-native-binaries.patch | |||
| @@ -8,64 +8,55 @@ Subject: [PATCH] Using native binaries | |||
| 8 | tools/v8_gypfiles/v8.gyp | 11 ++++------- | 8 | tools/v8_gypfiles/v8.gyp | 11 ++++------- |
| 9 | 2 files changed, 6 insertions(+), 9 deletions(-) | 9 | 2 files changed, 6 insertions(+), 9 deletions(-) |
| 10 | 10 | ||
| 11 | diff --git a/node.gyp b/node.gyp | ||
| 12 | index 8f4dc518..d9389190 100644 | ||
| 13 | --- a/node.gyp | 11 | --- a/node.gyp |
| 14 | +++ b/node.gyp | 12 | +++ b/node.gyp |
| 15 | @@ -446,7 +446,7 @@ | 13 | @@ -487,6 +487,7 @@ |
| 16 | '<(SHARED_INTERMEDIATE_DIR)/node_code_cache.cc', | 14 | 'action_name': 'run_mkcodecache', |
| 15 | 'process_outputs_as_sources': 1, | ||
| 16 | 'inputs': [ | ||
| 17 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 18 | '<(mkcodecache_exec)', | ||
| 17 | ], | 19 | ], |
| 18 | 'action': [ | 20 | 'outputs': [ |
| 19 | - '<@(_inputs)', | 21 | @@ -512,6 +513,7 @@ |
| 20 | + 'mkcodecache', | 22 | 'action_name': 'node_mksnapshot', |
| 21 | '<@(_outputs)', | 23 | 'process_outputs_as_sources': 1, |
| 24 | 'inputs': [ | ||
| 25 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 26 | '<(node_mksnapshot_exec)', | ||
| 22 | ], | 27 | ], |
| 23 | }, | 28 | 'outputs': [ |
| 24 | @@ -471,7 +471,7 @@ | ||
| 25 | '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc', | ||
| 26 | ], | ||
| 27 | 'action': [ | ||
| 28 | - '<@(_inputs)', | ||
| 29 | + 'node_mksnapshot', | ||
| 30 | '<@(_outputs)', | ||
| 31 | ], | ||
| 32 | }, | ||
| 33 | diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp | ||
| 34 | index a506a67d..c91f7dde 100644 | ||
| 35 | --- a/tools/v8_gypfiles/v8.gyp | 29 | --- a/tools/v8_gypfiles/v8.gyp |
| 36 | +++ b/tools/v8_gypfiles/v8.gyp | 30 | +++ b/tools/v8_gypfiles/v8.gyp |
| 37 | @@ -140,7 +140,8 @@ | 31 | @@ -220,6 +220,7 @@ |
| 38 | '<@(torque_outputs)', | 32 | { |
| 39 | ], | 33 | 'action_name': 'run_torque_action', |
| 40 | 'action': [ | 34 | 'inputs': [ # Order matters. |
| 41 | - '<@(_inputs)', | 35 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', |
| 42 | + 'torque', | 36 | '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)', |
| 43 | + '<@(torque_files)', | 37 | '<@(torque_files)', |
| 44 | '-o', '<(torque_output_root)/torque-generated', | ||
| 45 | '-v8-root', '<(V8_ROOT)' | ||
| 46 | ], | 38 | ], |
| 47 | @@ -247,9 +248,7 @@ | 39 | @@ -351,6 +352,7 @@ |
| 48 | '<(generate_bytecode_builtins_list_output)', | 40 | { |
| 41 | 'action_name': 'generate_bytecode_builtins_list_action', | ||
| 42 | 'inputs': [ | ||
| 43 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 44 | '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)', | ||
| 49 | ], | 45 | ], |
| 50 | 'action': [ | 46 | 'outputs': [ |
| 51 | - 'python', | 47 | @@ -533,6 +535,7 @@ |
| 52 | - '<(V8_ROOT)/tools/run.py', | 48 | ], |
| 53 | - '<@(_inputs)', | 49 | }, |
| 54 | + 'bytecode_builtins_list_generator', | 50 | 'inputs': [ |
| 55 | '<@(_outputs)', | 51 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', |
| 52 | '<(mksnapshot_exec)', | ||
| 56 | ], | 53 | ], |
| 57 | }, | 54 | 'outputs': [ |
| 58 | @@ -1396,9 +1395,7 @@ | 55 | @@ -1448,6 +1451,7 @@ |
| 59 | '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc', | 56 | { |
| 57 | 'action_name': 'run_gen-regexp-special-case_action', | ||
| 58 | 'inputs': [ | ||
| 59 | + '<(PRODUCT_DIR)/v8-qemu-wrapper.sh', | ||
| 60 | '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)', | ||
| 60 | ], | 61 | ], |
| 61 | 'action': [ | 62 | 'outputs': [ |
| 62 | - 'python', | ||
| 63 | - '<(V8_ROOT)/tools/run.py', | ||
| 64 | - '<@(_inputs)', | ||
| 65 | + 'gen-regexp-special-case', | ||
| 66 | '<@(_outputs)', | ||
| 67 | ], | ||
| 68 | }, | ||
| 69 | -- | ||
| 70 | 2.20.1 | ||
| 71 | |||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_14.16.1.bb b/meta-oe/recipes-devtools/nodejs/nodejs_14.16.1.bb index 32bdd713b5..aef83cc31c 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs_14.16.1.bb +++ b/meta-oe/recipes-devtools/nodejs/nodejs_14.16.1.bb | |||
| @@ -4,9 +4,9 @@ LICENSE = "MIT & BSD & Artistic-2.0" | |||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=85bf260d8b6de1588f57abc5dc66587c" | 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=85bf260d8b6de1588f57abc5dc66587c" |
| 5 | 5 | ||
| 6 | DEPENDS = "openssl" | 6 | DEPENDS = "openssl" |
| 7 | DEPENDS_append_class-target = " nodejs-native" | 7 | DEPENDS_append_class-target = " qemu-native" |
| 8 | 8 | ||
| 9 | inherit pkgconfig python3native | 9 | inherit pkgconfig python3native qemu |
| 10 | 10 | ||
| 11 | COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*" | 11 | COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*" |
| 12 | COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*" | 12 | COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*" |
| @@ -93,6 +93,35 @@ python do_unpack() { | |||
| 93 | shutil.rmtree(d.getVar('S') + '/deps/zlib', True) | 93 | shutil.rmtree(d.getVar('S') + '/deps/zlib', True) |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | # V8's JIT infrastructure requires binaries such as mksnapshot and | ||
| 97 | # mkpeephole to be run in the host during the build. However, these | ||
| 98 | # binaries must have the same bit-width as the target (e.g. a x86_64 | ||
| 99 | # host targeting ARMv6 needs to produce a 32-bit binary). Instead of | ||
| 100 | # depending on a third Yocto toolchain, we just build those binaries | ||
| 101 | # for the target and run them on the host with QEMU. | ||
| 102 | python do_create_v8_qemu_wrapper () { | ||
| 103 | """Creates a small wrapper that invokes QEMU to run some target V8 binaries | ||
| 104 | on the host.""" | ||
| 105 | qemu_libdirs = [d.expand('${STAGING_DIR_HOST}${libdir}'), | ||
| 106 | d.expand('${STAGING_DIR_HOST}${base_libdir}')] | ||
| 107 | qemu_cmd = qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST', True), | ||
| 108 | qemu_libdirs) | ||
| 109 | wrapper_path = d.expand('${B}/v8-qemu-wrapper.sh') | ||
| 110 | with open(wrapper_path, 'w') as wrapper_file: | ||
| 111 | wrapper_file.write("""#!/bin/sh | ||
| 112 | |||
| 113 | # This file has been generated automatically. | ||
| 114 | # It invokes QEMU to run binaries built for the target in the host during the | ||
| 115 | # build process. | ||
| 116 | |||
| 117 | %s "$@" | ||
| 118 | """ % qemu_cmd) | ||
| 119 | os.chmod(wrapper_path, 0o755) | ||
| 120 | } | ||
| 121 | |||
| 122 | do_create_v8_qemu_wrapper[dirs] = "${B}" | ||
| 123 | addtask create_v8_qemu_wrapper after do_configure before do_compile | ||
| 124 | |||
| 96 | # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi | 125 | # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi |
| 97 | do_configure () { | 126 | do_configure () { |
| 98 | export LD="${CXX}" | 127 | export LD="${CXX}" |
| @@ -110,6 +139,7 @@ do_configure () { | |||
| 110 | 139 | ||
| 111 | do_compile () { | 140 | do_compile () { |
| 112 | export LD="${CXX}" | 141 | export LD="${CXX}" |
| 142 | install -Dm 0755 ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh | ||
| 113 | oe_runmake BUILDTYPE=Release | 143 | oe_runmake BUILDTYPE=Release |
| 114 | } | 144 | } |
| 115 | 145 | ||
