@@ -189,14 +189,28 @@ my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
189189print " Checking if you have 7z...\n " ;
190190my $output_7z = ` 7z 2>&1` ;
191191my $have_7z = defined $output_7z && $output_7z =~ / 7-Zip/ ;
192+ my ($cmd7z , $have_pigz );
193+
194+ if (!$have_7z ) {
195+ print " Checking if you have pigz...\n " ;
196+ my $output_pz = ` pigz --help 2>&1` ;
197+ $have_pigz = defined $output_pz && $output_pz =~ / Usage: pigz/ ;
198+ } else {
199+ # 4 threads
200+ $cmd7z = ' 7z a -mx9 -bd -si -mmt4 ' ;
201+ }
192202
193203print " Checking if you have advdef...\n " ;
194204my $output_advdef = ` advdef --version 2>&1` ;
195205my $have_advdef = defined $output_advdef && $output_advdef =~ / advancecomp/ ;
196206
197207if ($have_7z ) {
198208 print " Creating and compressing the tar.gz file with 7z...\n " ;
199- $cmd = " tar cf - $reldir | 7z a -tgzip -mx9 -bd -si $reldir .tar.gz" ;
209+ $cmd = " tar cf - $reldir | $cmd7z -tgzip $reldir .tar.gz" ;
210+ system ($cmd ) == 0 or die " $cmd failed" ;
211+ } elsif ($have_pigz ) {
212+ print " Creating and compressing the tar.gz file with pigz...\n " ;
213+ $cmd = " tar cf - $reldir | pigz -9 -- $reldir .tar.gz" ;
200214 system ($cmd ) == 0 or die " $cmd failed" ;
201215} else {
202216 print " Creating and compressing the tar.gz file...\n " ;
@@ -212,7 +226,8 @@ if ($have_7z) {
212226if ($opts {b }) {
213227 if ($have_7z ) {
214228 print " Creating and compressing the tar.bz2 file with 7z...\n " ;
215- $cmd = " tar cf - $reldir | 7z a -tbzip2 -mx9 -bd -si $reldir .tar.bz2" ;
229+ # 4 threads
230+ $cmd = " tar cf - $reldir | $cmd7z -tbzip2 $reldir .tar.bz2" ;
216231 system ($cmd ) == 0 or die " $cmd failed" ;
217232 } else {
218233 print " Creating and compressing the tar.bz2 file...\n " ;
@@ -223,7 +238,8 @@ if ($opts{b}) {
223238
224239if ($opts {x }) {
225240 print " Creating and compressing the tar.xz file with xz...\n " ;
226- $cmd = " tar cf - $reldir | xz -z -c > $reldir .tar.xz" ;
241+ # -T0 use as many threads as there are processor cores
242+ $cmd = " tar cf - $reldir | xz -T0 -z -c > $reldir .tar.xz" ;
227243 system ($cmd ) == 0 or die " $cmd failed" ;
228244}
229245
0 commit comments