Skip to content

Commit 74e7fb0

Browse files
committed
fix(smol-builder): standardize brotli2c naming to socketsecurity_ prefix
Update patch and build script to use consistent socketsecurity_ naming: - Rename socket_brotli2c → socketsecurity_brotli2c in patch - Update target name, executable name, and source file references - Remove workaround copy logic that renamed the file This eliminates name duplication in object files (socket_brotli2c.socket_brotli2c.o) and aligns with our socketsecurity_ prefix standard.
1 parent 95e3a55 commit 74e7fb0

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

packages/node-smol-builder/patches/004-socketsecurity_brotli2c_build_v24.10.0.patch

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# @node-versions: v24.10.0+
2-
# @description: Enable socket_brotli2c build tool for Brotli compression
3-
# @requires: tools/socket_brotli2c.cc
2+
# @description: Enable socketsecurity_brotli2c build tool for Brotli compression
3+
# @requires: tools/socketsecurity_brotli2c.cc
44
#
5-
# Adds the socket_brotli2c build target to node.gyp, which compiles the
6-
# Socket Brotli compression tool used to convert Brotli-compressed data
5+
# Adds the socketsecurity_brotli2c build target to node.gyp, which compiles the
6+
# Socket Security Brotli compression tool used to convert Brotli-compressed data
77
# into C++ byte arrays for embedding in the Node.js binary.
88
#
9-
# This patch also modifies the node_js2c action to use socket_brotli2c
9+
# This patch also modifies the node_js2c action to use socketsecurity_brotli2c
1010
# instead of the standard js2c tool, ensuring Brotli-compressed binary
1111
# data is output as byte arrays rather than string literals.
1212
#
1313
# This enables Brotli compression of JavaScript built-in modules for
1414
# approximately 3.36 MB binary size reduction.
1515
#
16-
# CRITICAL: socket_brotli2c does NOT define NODE_JS2C_USE_STRING_LITERALS because
16+
# CRITICAL: socketsecurity_brotli2c does NOT define NODE_JS2C_USE_STRING_LITERALS because
1717
# Brotli-compressed binary data must be output as byte arrays, not string literals.
1818
#
1919
# PATCH CREATION PROCESS:
2020
# This patch was created using standard unified diff format (not git format).
2121
# Steps:
2222
# 1. Clone Node.js v24.10.0
2323
# 2. Modify node.gyp to:
24-
# - Add socket_brotli2c target
25-
# - Add socket_brotli2c_exec variable
26-
# - Modify node_js2c action to use socket_brotli2c_exec
24+
# - Add socketsecurity_brotli2c target
25+
# - Add socketsecurity_brotli2c_exec variable
26+
# - Modify node_js2c action to use socketsecurity_brotli2c_exec
2727
# 3. Generate patch with: diff -u original.gyp modified.gyp
2828
# 4. Validate with: patch -p1 --dry-run < patch-file
2929
#
@@ -33,7 +33,7 @@
3333
],
3434
'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)',
3535
'node_js2c_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_js2c<(EXECUTABLE_SUFFIX)',
36-
+ 'socket_brotli2c_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)socket_brotli2c<(EXECUTABLE_SUFFIX)',
36+
+ 'socketsecurity_brotli2c_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)socketsecurity_brotli2c<(EXECUTABLE_SUFFIX)',
3737
'conditions': [
3838
['GENERATOR == "ninja"', {
3939
'node_text_start_object_path': 'src/large_pages/node_text_start.node_text_start.o'
@@ -42,7 +42,7 @@
4242
'process_outputs_as_sources': 1,
4343
'inputs': [
4444
- '<(node_js2c_exec)',
45-
+ '<(socket_brotli2c_exec)',
45+
+ '<(socketsecurity_brotli2c_exec)',
4646
'<@(library_files)',
4747
'<@(deps_files)',
4848
'config.gypi'
@@ -51,7 +51,7 @@
5151
],
5252
'action': [
5353
- '<(node_js2c_exec)',
54-
+ '<(socket_brotli2c_exec)',
54+
+ '<(socketsecurity_brotli2c_exec)',
5555
'<@(_outputs)',
5656
'lib',
5757
'config.gypi',
@@ -60,7 +60,7 @@
6060
]
6161
},
6262
+ {
63-
+ 'target_name': 'socket_brotli2c',
63+
+ 'target_name': 'socketsecurity_brotli2c',
6464
+ 'type': 'executable',
6565
+ 'toolsets': ['host'],
6666
+ 'defines!': ['NODE_JS2C_USE_STRING_LITERALS'],
@@ -69,7 +69,7 @@
6969
+ 'src',
7070
+ ],
7171
+ 'sources': [
72-
+ 'tools/socket_brotli2c.cc',
72+
+ 'tools/socketsecurity_brotli2c.cc',
7373
+ 'tools/executable_wrapper.h',
7474
+ 'src/embedded_data.h',
7575
+ 'src/embedded_data.cc',

packages/node-smol-builder/scripts/build.mjs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,6 @@ async function copyBuildAdditions() {
293293
`✅ Copied ${ADDITIONS_DIR.replace(`${ROOT_DIR}/`, '')}/ → ${NODE_DIR}/`,
294294
)
295295

296-
// Fix: The patch file references tools/socket_brotli2c.cc but the additions
297-
// directory has tools/socketsecurity_brotli2c.cc. Copy the file to the expected name.
298-
const socketBrotli2cSource = join(NODE_DIR, '003-compression-tools', 'socketsecurity_brotli2c.cc')
299-
const socketBrotli2cDest = join(NODE_DIR, 'tools', 'socket_brotli2c.cc')
300-
301-
if (existsSync(socketBrotli2cSource)) {
302-
await fs.copyFile(socketBrotli2cSource, socketBrotli2cDest)
303-
logger.log(`✅ Copied socket_brotli2c.cc to tools/ (patch expects this name)`)
304-
}
305-
306296
// Fix: The brotli header needs to be in src/ for node_builtins.cc to find it.
307297
const brotliHeaderSource = join(NODE_DIR, '001-brotli-integration', 'socketsecurity_brotli_builtin_loader.h')
308298
const brotliHeaderDest = join(NODE_DIR, 'src', 'socketsecurity_brotli_builtin_loader.h')

0 commit comments

Comments
 (0)