fix: clang variable configuration in generated node headers (#44201)
* fix: clang variable configuration in generated node headers Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: restore value in common.gypi Co-authored-by: deepak1556 <hop2deep@gmail.com> * chore: update patches --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
parent
868a713208
commit
7182bc2359
3 changed files with 29 additions and 0 deletions
|
@ -50,3 +50,4 @@ fix_add_property_query_interceptors.patch
|
||||||
src_use_supported_api_to_get_stalled_tla_messages.patch
|
src_use_supported_api_to_get_stalled_tla_messages.patch
|
||||||
build_don_t_redefine_win32_lean_and_mean.patch
|
build_don_t_redefine_win32_lean_and_mean.patch
|
||||||
build_compile_with_c_20_support.patch
|
build_compile_with_c_20_support.patch
|
||||||
|
build_restore_clang_as_default_compiler_on_macos.patch
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: deepak1556 <hop2deep@gmail.com>
|
||||||
|
Date: Fri, 11 Oct 2024 15:01:25 +0900
|
||||||
|
Subject: build: restore clang as default compiler on macOS
|
||||||
|
|
||||||
|
Refs https://github.com/nodejs/node/commit/6e0a2bb54c5bbeff0e9e33e1a0c683ed980a8a0f
|
||||||
|
configures the value at build time which doesn't work in Electron
|
||||||
|
as it depends on the environment in which the headers got generated from which
|
||||||
|
cannot reflect the value per platform. It works for Node.js since
|
||||||
|
node-gyp will use the result of `process.config` that reflects the environment
|
||||||
|
in which the binary got built.
|
||||||
|
|
||||||
|
diff --git a/common.gypi b/common.gypi
|
||||||
|
index 2eb62610db2f0ebf68fa9a55ffba98291ecfe451..3ec08ee144b586d05c4e49c2251416734cbc02c5 100644
|
||||||
|
--- a/common.gypi
|
||||||
|
+++ b/common.gypi
|
||||||
|
@@ -125,6 +125,7 @@
|
||||||
|
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
|
||||||
|
}],
|
||||||
|
['OS=="mac"', {
|
||||||
|
+ 'clang%': 1,
|
||||||
|
'obj_dir%': '<(PRODUCT_DIR)/obj.target',
|
||||||
|
'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
|
||||||
|
}],
|
|
@ -61,6 +61,10 @@ def main(target_file, target_cpu):
|
||||||
v['node_module_version'] = int(args['node_module_version'])
|
v['node_module_version'] = int(args['node_module_version'])
|
||||||
# Used by certain versions of node-gyp.
|
# Used by certain versions of node-gyp.
|
||||||
v['build_v8_with_gn'] = 'false'
|
v['build_v8_with_gn'] = 'false'
|
||||||
|
# Enable clang conditionally based on target platform
|
||||||
|
# in common.gypi
|
||||||
|
if 'clang' in v:
|
||||||
|
del v['clang']
|
||||||
|
|
||||||
with open(target_file, 'w+', encoding='utf-8') as file_out:
|
with open(target_file, 'w+', encoding='utf-8') as file_out:
|
||||||
file_out.write(pprint.pformat(config, indent=2))
|
file_out.write(pprint.pformat(config, indent=2))
|
||||||
|
|
Loading…
Reference in a new issue