stdenv: enable multithreading for xz
decompression
(only if the implementation supports it) This speeds up the decompression of huge tar.xz tarballs (e.g. chromium) on high core count systems.
This commit is contained in:
parent
6c5458cf32
commit
80627bfe8f
1 changed files with 5 additions and 1 deletions
|
@ -1057,7 +1057,11 @@ _defaultUnpack() {
|
||||||
case "$fn" in
|
case "$fn" in
|
||||||
*.tar.xz | *.tar.lzma | *.txz)
|
*.tar.xz | *.tar.lzma | *.txz)
|
||||||
# Don't rely on tar knowing about .xz.
|
# Don't rely on tar knowing about .xz.
|
||||||
xz -d < "$fn" | tar xf - --warning=no-timestamp
|
# Additionally, we have multiple different xz binaries with different feature sets in different
|
||||||
|
# stages. The XZ_OPT env var is only used by the full "XZ utils" implementation, which supports
|
||||||
|
# the --threads (-T) flag. This allows us to enable multithreaded decompression exclusively on
|
||||||
|
# that implementation, without the use of complex bash conditionals and checks.
|
||||||
|
XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn" | tar xf - --warning=no-timestamp
|
||||||
;;
|
;;
|
||||||
*.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
|
*.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
|
||||||
# GNU tar can automatically select the decompression method
|
# GNU tar can automatically select the decompression method
|
||||||
|
|
Loading…
Reference in a new issue