Hongxu Jia 32da6bfb0e
nodejs: support cross compile without qemu user conditionally
Due to the scope of supported BSPs by qemu-user is limited, such
as a segment fault on armv9 after qemu apply commit [target/arm:
Convert LDAPR/STLR (imm) to decodetree][1]
```
|tmp-glibc/work/neoversen2-crypto-wrs-linux/nodejs/20.5.1/node-v20.5.1/out/
Release/v8-qemu-wrapper.sh: line 7: 3179613 Segmentation fault      (core dumped)
PSEUDO_UNLOAD=1 qemu-aarch64 -r 5.15 -L tmp-glibc/work/neoversen2-crypto-wrs-linux/
nodejs/20.5.1/recipe-sysroot -E LD_LIBRARY_PATH=tmp-glibc/work/neoversen2-crypto-wrs-linux/
nodejs/20.5.1/recipe-sysroot/usr/lib64:tmp-glibc/work/neoversen2-crypto-wrs-linux/
nodejs/20.5.1/recipe-sysroot/usr/lib64 "$@"
```

Upstream nodejs have cross compile support, but it needs host and target
have same bit width (e.g. a x86_64 host targeting arrch64 to produce a
64-bit binary). So:
1. If host and target have different bit width, build with QEMU user as usual;

2. If host and target have same bit width, enable notejs cross compile support:
- The build tools of nodejs is GYP[2], set CC_host, CFLAGS_host,
  CXX_host, CXXFLAGS_host, LDFLAGS_host, AR_host for host build
  which is separated with target build [3]
- Satisfy layer compatibility, set GYP variables in prefuncs of do_configure,
  do_compile and do_install other than in recipe parsing
- Add missing native packages to fix library missing on host build
- Rework libatomic.patch, explicitly link to libatomic for clang
  conditionally

[1] 2521b6073b
[2] https://github.com/nodejs/node-gyp
[3] https://github.com/nodejs/node-gyp/blob/main/gyp/docs/UserDocumentation.md#cross-compiling

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2024-08-22 08:02:27 -07:00
..
2024-02-09 09:52:12 -08:00
2024-06-27 09:19:06 -07:00
2024-08-13 22:34:53 -07:00
2024-02-03 22:03:04 -08:00
2023-02-01 09:28:47 -08:00
2024-02-29 18:47:47 -08:00
2024-02-09 09:52:12 -08:00
2024-05-23 08:44:44 -07:00
2023-12-29 09:04:17 -08:00
2024-01-08 19:54:42 -08:00
2024-07-28 00:00:31 -07:00
2023-12-21 08:20:34 -08:00
2024-02-09 09:52:12 -08:00
2024-02-09 09:52:12 -08:00
2023-11-17 11:38:27 -08:00
2023-03-17 07:06:55 -07:00
2023-06-14 09:41:35 -07:00
2024-07-25 07:58:08 -07:00
2024-07-15 16:36:12 -07:00
…
2024-02-09 09:52:12 -08:00
2024-07-15 16:36:12 -07:00
2024-05-30 08:42:01 -07:00
2024-02-09 09:52:12 -08:00
2024-06-07 09:11:54 -07:00
2024-02-20 08:46:30 -08:00
2024-01-08 19:54:41 -08:00
2024-05-02 07:32:54 -07:00
2023-12-29 09:04:18 -08:00
2024-01-08 19:54:45 -08:00
2024-04-19 14:31:31 -07:00