Commit 2c28d96
committed
fix: disable LTO/ThinLTO via gyp -D flags for Node 26 Windows builds
The previous attempt at this fix (a222989) put `enable_lto: false` and
`enable_thin_lto: false` in binding.gyp's `variables` block. That didn't
actually work — node-gyp's create-config-gypi.js seeds config.gypi from
`process.config` of the Node binary running the build, and the resulting
config.gypi lives in a separate gyp scope from binding.gyp. binding.gyp
variables can't override config.gypi variables that way.
The real path: set npm_config_enable_thin_lto/enable_lto in the build
environment. node-gyp loops through unrecognized npm_config_* opts and
forwards them as `-D<name>=<value>` gyp defines, which take precedence
over both config.gypi and binding.gyp.
Wire that into scripts/ci/windows/build.ps1 so the build matrix runs are
fixed. The binding.gyp change is reverted since it wasn't doing anything.
This still leaves end-user source installs (e.g. consumers pnpm-adding
node-libcurl on Node 26 Windows with no prebuilt available) broken —
those users would need to set the same env vars themselves. A follow-up
should set GYP_DEFINES from our preinstall script so the workaround
applies transparently for them too.1 parent a222989 commit 2c28d96
3 files changed
Lines changed: 21 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 17 | + | |
33 | 18 | | |
34 | 19 | | |
35 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
165 | 183 | | |
166 | 184 | | |
167 | 185 | | |
168 | 186 | | |
169 | 187 | | |
| 188 | + | |
170 | 189 | | |
171 | 190 | | |
172 | 191 | | |
| |||
0 commit comments