Skip to content

Commit

Permalink
build(scripts/pack-next): Add support for compressing debuginfo with …
Browse files Browse the repository at this point in the history
…zlib
  • Loading branch information
bgw committed Jan 8, 2025
1 parent 6e6a330 commit d2075c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/pack-next.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ async function main() {
await packWithTar(packagePath, NEXT_SWC_TARBALL)
break
case 'objcopy-zstd':
case 'objcopy-zlib':
if (process.platform !== 'linux') {
throw new Error('objcopy-zstd is only supported on Linux')
throw new Error('objcopy-{zstd,zlib} is only supported on Linux')
}
const format = PACK_NEXT_COMPRESS == 'objcopy-zstd' ? 'zstd' : 'zlib'
await Promise.all(
(await nextSwcBinaries()).map((bin) =>
execAsyncWithOutput(
'Compressing debug symbols in next-swc native binary',
['objcopy', '--compress-debug-sections=zstd', '--', bin]
['objcopy', `--compress-debug-sections=${format}`, '--', bin]
)
)
)
Expand All @@ -119,7 +121,8 @@ async function main() {
break
default:
throw new Error(
"PACK_NEXT_COMPRESS must be one of 'strip', 'objcopy-zstd', or 'none'"
"PACK_NEXT_COMPRESS must be one of 'strip', 'objcopy-zstd', " +
"'objcopy-zlib', or 'none'"
)
}
}
Expand Down

0 comments on commit d2075c8

Please sign in to comment.