0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 12:02:18 +02:00
libsignal/binding.gyp
Jordan Rose ddce4ee3a4 Make it clear to node-gyp which action arguments are paths
On Windows, node-gyp tries to be helpful by changing forward slashes
to backslashes and making paths relative to the source root rather
than the build directory, and indeed we rely on that. However, it has
to guess what's a path and what isn't. Previously, we worked around
that by manually stripping the prepended "..\", but the node-gyp
maintainers suggested a better workaround of using joined arguments
instead (`--foo=bar` instead of `--foo bar`).
2021-09-21 10:28:11 -07:00

45 lines
2.0 KiB
Python

#
# Copyright (C) 2020 Signal Messenger, LLC.
# SPDX-License-Identifier: AGPL-3.0-only
#
{
'conditions': [
['OS=="mac"', {'variables': {'NODE_OS_NAME': 'darwin', 'CARGO_TARGET_SUFFIX': 'apple-darwin'}},
'OS=="win"', {'variables': {'NODE_OS_NAME': 'win32', 'CARGO_TARGET_SUFFIX': 'pc-windows-msvc'}},
'OS=="linux"', {'variables': {'NODE_OS_NAME': 'linux', 'CARGO_TARGET_SUFFIX': 'unknown-linux-gnu'}},
{'variables': {'NODE_OS_NAME': '<(OS)'}}],
['target_arch=="ia32"', {'variables': {'CARGO_ARCH': 'i686'}},
'target_arch=="x64"', {'variables': {'CARGO_ARCH': 'x86_64'}},
'target_arch=="arm64"', {'variables': {'CARGO_ARCH': 'aarch64'}}]
],
'targets': [
{
'target_name': 'libsignal_client_<(NODE_OS_NAME)_<(target_arch).node',
'type': 'none',
'actions': [
{
'action_name': 'node/build_node_bridge.py',
'action': [
'python3',
'node/build_node_bridge.py',
# Use separated arguments for paths, joined arguments for non-paths.
'--out-dir', '<(PRODUCT_DIR)/',
'--os-name=<(NODE_OS_NAME)',
'--configuration=<(CONFIGURATION_NAME)',
'--cargo-build-dir', '<(INTERMEDIATE_DIR)/rust',
'--cargo-target=<(CARGO_ARCH)-<(CARGO_TARGET_SUFFIX)',
'--node-arch=<(target_arch)'
],
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/<(_target_name)',
# This really needs to be environment-variable-sensitive, but node-gyp doesn't support that. Cargo will still save work if possible.
'<(PRODUCT_DIR)/nonexistent-file-to-force-rebuild'
]
}
]
}
]
}