Skip to content

Commit

Permalink
build: fix ninja build failure
Browse files Browse the repository at this point in the history
When working on commit 6a09a69
("build: enable cctest to use generated objects") I did not take into
account building with ninja:

$ ./configure
$ tools/gyp_node.py -f ninja
$ ninja -C out/Release
$ ln -fs out/Release/node node

When ninja generated the ninja build files, src files that are
relative to the src directory will be named with a dot instead of a
path separator, for example:

out/Release/obj/src/node/node.o
would instead become:
out/Release/obj/src/node.node.o

This commit adds an additional variable for the type of object separator
used for this case.

Currently the check for if ninja is being used is a normal if statement
as are the following os checks (win and aix). But the win and aix ones
should only be evaluated if the build is not generated by ninja.
This commit turns this logic into an if ninja else statement.

PR-URL: nodejs#12484
Fixes: nodejs#12448
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
  • Loading branch information
danbev authored and Olivier Martin committed May 19, 2017
1 parent 639d0a5 commit b1b6076
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 41 deletions.
19 changes: 8 additions & 11 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
'icu_use_data_file_flag%': 0,

'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',
}],
['OS == "win"', {
'os_posix': 0,
'v8_postmortem_support%': 'false',
Expand All @@ -45,18 +52,8 @@
'v8_postmortem_support%': 'true',
}],
['OS== "mac"', {
'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',
'V8_BASE': '<(PRODUCT_DIR)/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',
Expand Down
72 changes: 42 additions & 30 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -574,19 +574,31 @@
'OBJ_GEN_PATH': '<(OBJ_DIR)/node/gen',
'OBJ_TRACING_PATH': '<(OBJ_DIR)/node/src/tracing',
'OBJ_SUFFIX': 'o',
'OBJ_SEPARATOR': '/',
'conditions': [
['OS=="win"', {
'OBJ_PATH': '<(OBJ_DIR)/node',
'OBJ_GEN_PATH': '<(OBJ_DIR)/node',
'OBJ_TRACING_PATH': '<(OBJ_DIR)/node',
'OBJ_SUFFIX': 'obj',
}],
['OS=="aix"', {
'OBJ_PATH': '<(OBJ_DIR)/node_base/src',
'OBJ_GEN_PATH': '<(OBJ_DIR)/node_base/gen',
'OBJ_TRACING_PATH': '<(OBJ_DIR)/node_base/src/tracing',
}],
],
['GENERATOR=="ninja"', {
'OBJ_PATH': '<(OBJ_DIR)/src',
'OBJ_GEN_PATH': '<(OBJ_DIR)/gen',
'OBJ_TRACING_PATH': '<(OBJ_DIR)/src/tracing',
'OBJ_SEPARATOR': '/node.',
}, {
'conditions': [
['OS=="win"', {
'OBJ_PATH': '<(OBJ_DIR)/node',
'OBJ_GEN_PATH': '<(OBJ_DIR)/node',
'OBJ_TRACING_PATH': '<(OBJ_DIR)/node',
}],
['OS=="aix"', {
'OBJ_PATH': '<(OBJ_DIR)/node_base/src',
'OBJ_GEN_PATH': '<(OBJ_DIR)/node_base/gen',
'OBJ_TRACING_PATH': '<(OBJ_DIR)/node_base/src/tracing',
}],
]}
]
],
},

'includes': [
Expand All @@ -603,24 +615,24 @@
],

'libraries': [
'<(OBJ_GEN_PATH)/node_javascript.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_debug_options.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/async-wrap.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/env.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_buffer.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_i18n.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_url.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/util.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/string_bytes.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/string_search.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/stream_base.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_constants.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_revert.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)/agent.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)/node_trace_buffer.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)/node_trace_writer.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)/trace_event.<(OBJ_SUFFIX)',
'<(OBJ_GEN_PATH)<(OBJ_SEPARATOR)node_javascript.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_debug_options.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)async-wrap.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)env.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_buffer.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_i18n.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_url.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)util.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)string_bytes.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)string_search.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)stream_base.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_constants.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_revert.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)agent.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)node_trace_buffer.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)node_trace_writer.<(OBJ_SUFFIX)',
'<(OBJ_TRACING_PATH)<(OBJ_SEPARATOR)trace_event.<(OBJ_SUFFIX)',
],

'defines': [
Expand Down Expand Up @@ -683,9 +695,9 @@
'copies': [{
'destination': '<(OBJ_DIR)/cctest/src',
'files': [
'<(OBJ_PATH)/node_dtrace_ustack.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_dtrace_provider.<(OBJ_SUFFIX)',
'<(OBJ_PATH)/node_dtrace.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_ustack.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace_provider.<(OBJ_SUFFIX)',
'<(OBJ_PATH)<(OBJ_SEPARATOR)node_dtrace.<(OBJ_SUFFIX)',
]},
],
}],
Expand Down

0 comments on commit b1b6076

Please sign in to comment.