Skip to content

Commit 11ae4e6

Browse files
joyeecheungaduh95
authored andcommitted
sea: add --build-sea to generate SEA directly with Node.js binary
Instead of relying on a WASM build of postject to perform the injection, add LIEF as dependency and generate the SEA directly from core via a new CLI option --build-sea which takes the SEA config. This simplifies SEA generation for users and makes it easier to debug/maintain the SEA building process. PR-URL: nodejs#61167 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 7cf913f commit 11ae4e6

40 files changed

+2039
-137
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,15 @@
153153
/test/parallel/test-runner-* @nodejs/test_runner
154154

155155
# Single Executable Applications
156+
/deps/LIEF @nodejs/single-executable
156157
/deps/postject @nodejs/single-executable
157158
/doc/api/single-executable-applications.md @nodejs/single-executable
158159
/doc/contributing/maintaining/maintaining-single-executable-application-support.md @nodejs/single-executable
159160
/src/node_sea* @nodejs/single-executable
160161
/test/fixtures/postject-copy @nodejs/single-executable
161162
/test/sea @nodejs/single-executable
162163
/tools/dep_updaters/update-postject.sh @nodejs/single-executable
164+
/tools/dep_updaters/update-lief.sh @nodejs/single-executable
163165

164166
# Permission Model
165167
/doc/api/permissions.md @nodejs/security-wg

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ tools/*/*.i.tmp
145145
# Ignore dependencies fetched by tools/v8/fetch_deps.py
146146
/deps/.cipd
147147
!deps/LIEF/**
148+
deps/LIEF/*.vcxproj*
149+
deps/LIEF/*.sln
148150

149151
# === Rules for Windows vcbuild.bat ===
150152
/temp-vcbuild

LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,8 @@ The externally maintained libraries used by Node.js are:
12621262
SOFTWARE.
12631263
"""
12641264

1265-
- postject, located at test/fixtures/postject-copy, is licensed as follows:
1265+
- postject, located at test/fixtures/postject-copy and used as a basis for
1266+
src/node_sea_bin.cc, is licensed as follows:
12661267
"""
12671268
Postject is licensed for use as follows:
12681269

configure.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,12 @@
898898
default=None,
899899
help='do not install the bundled Amaro (TypeScript utils)')
900900

901+
parser.add_argument('--without-lief',
902+
action='store_true',
903+
dest='without_lief',
904+
default=None,
905+
help='build without LIEF (Library for instrumenting executable formats)')
906+
901907
parser.add_argument('--without-npm',
902908
action='store_true',
903909
dest='without_npm',
@@ -1689,6 +1695,14 @@ def configure_node(o):
16891695
o['variables']['single_executable_application'] = b(not options.disable_single_executable_application)
16901696
if options.disable_single_executable_application:
16911697
o['defines'] += ['DISABLE_SINGLE_EXECUTABLE_APPLICATION']
1698+
o['variables']['node_use_lief'] = 'false'
1699+
else:
1700+
if (options.without_lief is not None):
1701+
o['variables']['node_use_lief'] = b(not options.without_lief)
1702+
elif flavor in ('mac', 'linux', 'win'):
1703+
o['variables']['node_use_lief'] = 'true'
1704+
else:
1705+
o['variables']['node_use_lief'] = 'false'
16921706

16931707
o['variables']['node_with_ltcg'] = b(options.with_ltcg)
16941708
if flavor != 'win' and options.with_ltcg:

0 commit comments

Comments
 (0)