Skip to content

Commit

Permalink
refactor; and handle all non-windows platforms as 'unix'
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys authored and Trott committed Aug 18, 2018
1 parent eb76e9f commit 0437cef
Showing 1 changed file with 17 additions and 27 deletions.
44 changes: 17 additions & 27 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
# the executable and rename it back to node.exe later
'product_name': '<(node_core_target_name)-win',
}],
[ 'OS=="mac" or OS=="linux"', {
[ 'OS!="win"', {
# On Unix builds, the build may replace the executable while it is
# running. To avoid this, we provide a different PRODUCT_NAME for
# the executable and rename it back to node later
Expand Down Expand Up @@ -906,52 +906,43 @@
]
},
{
# When building executable in Mac OS/X, in order to avoid overwriting
# the executable while it it running, build it with a different name
# and then rename it back to node.
'target_name': 'rename_node_bin_unix',
'target_name': 'rename_node_bin',
'type': 'none',
'dependencies': [
'<(node_core_target_name)',
],
'conditions': [
[ 'OS=="mac" or OS=="linux"', {
# When using shared lib to build executable in Windows, in order to
# avoid filename collision, the executable name is node-win.exe. Need
# to rename it back to node.exe
[ 'OS=="win" and node_intermediate_lib_type=="shared_library"', {
'actions': [
{
'action_name': 'rename_node_bin_unix',
'action_name': 'rename_node_bin_win',
'inputs': [
'<(PRODUCT_DIR)/<(node_core_target_name)-unix'
'<(PRODUCT_DIR)/<(node_core_target_name)-win.exe'
],
'outputs': [
'<(PRODUCT_DIR)/<(node_core_target_name)',
'<(PRODUCT_DIR)/<(node_core_target_name).exe',
],
'action': [
'mv', '<@(_inputs)', '<@(_outputs)',
],
},
],
} ],
]
},
{
# When using shared lib to build executable in Windows, in order to avoid
# filename collision, the executable name is node-win.exe. Need to rename
# it back to node.exe
'target_name': 'rename_node_bin_win',
'type': 'none',
'dependencies': [
'<(node_core_target_name)',
],
'conditions': [
[ 'OS=="win" and node_intermediate_lib_type=="shared_library"', {
# When building executable on Unix operating systems, in order to
# avoid overwriting the executable while it it running, build it with
# a different name and then rename it back to node.
[ 'OS!="win"', {
'actions': [
{
'action_name': 'rename_node_bin_win',
'action_name': 'rename_node_bin_unix',
'inputs': [
'<(PRODUCT_DIR)/<(node_core_target_name)-win.exe'
'<(PRODUCT_DIR)/<(node_core_target_name)-unix'
],
'outputs': [
'<(PRODUCT_DIR)/<(node_core_target_name).exe',
'<(PRODUCT_DIR)/<(node_core_target_name)',
],
'action': [
'mv', '<@(_inputs)', '<@(_outputs)',
Expand All @@ -967,8 +958,7 @@

'dependencies': [
'<(node_lib_target_name)',
'rename_node_bin_win',
'rename_node_bin_unix',
'rename_node_bin',
'deps/gtest/gtest.gyp:gtest',
'node_js2c#host',
'node_dtrace_header',
Expand Down

0 comments on commit 0437cef

Please sign in to comment.