diff options
author | André Draszik <git@andred.net> | 2019-11-13 09:58:11 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-13 07:17:03 -0800 |
commit | 08956bdd8962ca44eeea3772ea6be8061d1f5735 (patch) | |
tree | 48949015cc03f6df2a777c6863410cab5d63efac | |
parent | 81a25727052080507c40e547656b43b87a965b6b (diff) | |
download | meta-openembedded-08956bdd8962ca44eeea3772ea6be8061d1f5735.tar.gz |
nodejs: ensure to use correct compiler & flags always
NodeJS comes with an embedded, patched, version of gyp.
Normally, gyp supports compiling for the build machine, e.g.
native tools that need to be compiled to run during the build,
and for the host, using different variables, e.g. CC and
CC.host, etc.
Most of this has been patched out in the NodeJS version of gyp,
and essentially it only supports compiling using one compiler -
${CC}. This modification excludes LDFLAGS for native tools, and
those still evaluate LDFLAGS.host (only).
While this modified behaviour is OK for the OE use-case of building
native and target tools separately, it means that this recipe can
not work as-is with standard gyp, and wrong LDFLAGS are being used
for some of the tools compiled (torque) in either case.
By setting the make variables that gyp-generated makefiles inspect,
we support use of unpatched gyp, and we ensure that all tools
are compiled with correct LDFLAGS in either case.
This now also allows us to drop the patch that had been applied to
work-around this problem.
Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch | 24 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb | 13 |
2 files changed, 12 insertions, 25 deletions
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch deleted file mode 100644 index f6569cd57..000000000 --- a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | The target LDFLAGS have been ignored. Tools like torque | ||
2 | have been loaded from system libraries, even if a native | ||
3 | one was the target. | ||
4 | |$ ldd torque | ||
5 | | libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 | ||
6 | | libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 | ||
7 | | libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 | ||
8 | | libicui18n.so.63 => not found | ||
9 | | libicuuc.so.63 => not found | ||
10 | ... | ||
11 | |||
12 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | ||
13 | |||
14 | diff -Naur node-v10.15.1/deps/v8/gypfiles/toolchain.gypi node-v10.15.1/deps/v8/gypfiles/toolchain.gypi | ||
15 | --- node-v10.15.1/deps/v8/gypfiles/toolchain.gypi 2019-03-18 15:01:39.000000000 +0100 | ||
16 | +++ node-v10.15.1/deps/v8/gypfiles/toolchain.gypi 2019-03-18 15:04:08.628361308 +0100 | ||
17 | @@ -1106,6 +1106,7 @@ | ||
18 | 'cflags': [ '-fno-strict-aliasing' ], | ||
19 | }], | ||
20 | ], # conditions | ||
21 | + 'ldflags+': [ '$(LDFLAGS)' ], | ||
22 | }], | ||
23 | ['OS=="solaris"', { | ||
24 | 'defines': [ '__C99FEATURES__=1' ], # isinf() etc. | ||
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb index 4013c6931..9af0d998c 100644 --- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb +++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb | |||
@@ -19,7 +19,6 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \ | |||
19 | file://0001-Disable-running-gyp-files-for-bundled-deps.patch \ | 19 | file://0001-Disable-running-gyp-files-for-bundled-deps.patch \ |
20 | file://0004-Make-compatibility-with-gcc-4.8.patch \ | 20 | file://0004-Make-compatibility-with-gcc-4.8.patch \ |
21 | file://0005-Link-atomic-library.patch \ | 21 | file://0005-Link-atomic-library.patch \ |
22 | file://0006-Use-target-ldflags.patch \ | ||
23 | " | 22 | " |
24 | SRC_URI_append_class-target = " \ | 23 | SRC_URI_append_class-target = " \ |
25 | file://0002-Using-native-torque.patch \ | 24 | file://0002-Using-native-torque.patch \ |
@@ -58,6 +57,18 @@ PACKAGECONFIG[libuv] = "--shared-libuv,,libuv" | |||
58 | PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" | 57 | PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2" |
59 | PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" | 58 | PACKAGECONFIG[zlib] = "--shared-zlib,,zlib" |
60 | 59 | ||
60 | # We don't want to cross-compile during target compile, | ||
61 | # and we need to use the right flags during host compile, | ||
62 | # too. | ||
63 | EXTRA_OEMAKE = "\ | ||
64 | CC.host='${CC}' \ | ||
65 | CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \ | ||
66 | CXX.host='${CXX}' \ | ||
67 | CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \ | ||
68 | LDFLAGS.host='${LDFLAGS}' \ | ||
69 | AR.host='${AR}' \ | ||
70 | " | ||
71 | |||
61 | # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi | 72 | # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi |
62 | do_configure () { | 73 | do_configure () { |
63 | rm -rf ${S}/deps/openssl | 74 | rm -rf ${S}/deps/openssl |