build: fix building with ninja on linux

On Linux, `ninja` appears to place `libv8_base.a` inside `OBJ_DIR`, as opposed
to `ninja` on OS X which places it outside of that directory. Furthermore, the
expected `OBJ_DIR` value (`obj.target/`) is actually just `obj/` for `ninja`.
This patch solves both of these issues by setting `OBJ_DIR` and `V8_BASE` to the
correct values for `ninja` on Linux specifically.

PR-URL: https://github.com/nodejs/node/pull/11348
Fixes: https://github.com/nodejs/node/issues/9861
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Kenan Yildirim 2017-02-13 13:31:56 -05:00 committed by James M Snell
parent 4577775a06
commit 70afe9d3ac
2 changed files with 11 additions and 4 deletions

View File

@ -42,12 +42,19 @@
'os_posix': 1,
'v8_postmortem_support%': 'true',
}],
['GENERATOR == "ninja" or OS== "mac"', {
['OS== "mac"', {
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
'V8_BASE': '<(PRODUCT_DIR)/libv8_base.a',
}, {
'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/src/libv8_base.a',
'conditions': [
['GENERATOR=="ninja"', {
'OBJ_DIR': '<(PRODUCT_DIR)/obj',
'V8_BASE': '<(PRODUCT_DIR)/obj/deps/v8/src/libv8_base.a',
}, {
'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/obj.target/deps/v8/src/libv8_base.a',
}],
],
}],
['openssl_fips != ""', {
'OPENSSL_PRODUCT': 'libcrypto.a',

View File

@ -392,7 +392,7 @@
['OS in "linux freebsd" and node_shared=="false"', {
'ldflags': [
'-Wl,--whole-archive,'
'<(PRODUCT_DIR)/obj.target/deps/openssl/'
'<(OBJ_DIR)/deps/openssl/'
'<(OPENSSL_PRODUCT)',
'-Wl,--no-whole-archive',
],