libarchive: added xz>=5.2 write filter multithread support by yours truly.

This commit is contained in:
Juan RP 2015-01-07 14:15:57 +01:00
parent 14c8fcdaf2
commit 9daa11d9e6
2 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,39 @@
Use lzma_stream_encoder_mt() to enable xz parallel compression in the
xz write filter.
--xtraeme
--- libarchive/archive_write_add_filter_xz.c.orig 2015-01-07 13:19:20.106417631 +0100
+++ libarchive/archive_write_add_filter_xz.c 2015-01-07 13:24:20.097461789 +0100
@@ -103,6 +103,7 @@ struct private_data {
lzma_stream stream;
lzma_filter lzmafilters[2];
lzma_options_lzma lzma_opt;
+ lzma_mt lzma_mt;
int64_t total_in;
unsigned char *compressed;
size_t compressed_buffer_size;
@@ -151,6 +152,13 @@ common_setup(struct archive_write_filter
}
f->data = data;
data->compression_level = LZMA_PRESET_DEFAULT;
+ data->lzma_mt.check = LZMA_CHECK_CRC64;
+ data->lzma_mt.filters = data->lzmafilters;
+ data->lzma_mt.preset = data->compression_level;
+ data->lzma_mt.threads = lzma_cputhreads();
+ if (data->lzma_mt.threads == 0)
+ data->lzma_mt.threads = 1;
+
f->open = &archive_compressor_xz_open;
f->close = archive_compressor_xz_close;
f->free = archive_compressor_xz_free;
@@ -226,8 +234,7 @@ archive_compressor_xz_init_stream(struct
data->stream.next_out = data->compressed;
data->stream.avail_out = data->compressed_buffer_size;
if (f->code == ARCHIVE_FILTER_XZ)
- ret = lzma_stream_encoder(&(data->stream),
- data->lzmafilters, LZMA_CHECK_CRC64);
+ ret = lzma_stream_encoder_mt(&(data->stream), &data->lzma_mt);
else if (f->code == ARCHIVE_FILTER_LZMA)
ret = lzma_alone_encoder(&(data->stream), &data->lzma_opt);
else { /* ARCHIVE_FILTER_LZIP */

View File

@ -1,13 +1,13 @@
# Template file for 'libarchive'
pkgname=libarchive
version=3.1.2
revision=13
revision=14
bootstrap=yes
build_style=gnu-configure
configure_args="$(vopt_enable acl) $(vopt_enable acl xattr)
$(vopt_with expat) $(vopt_with lzo lzo2) $(vopt_with ssl openssl)
--without-xml2 --without-nettle --disable-rpath ac_cv_func_lchmod=no"
makedepends="zlib-devel bzip2-devel liblzma-devel
makedepends="zlib-devel bzip2-devel liblzma-devel>=5.2
$(vopt_if acl acl-devel) $(vopt_if expat expat-devel)
$(vopt_if lzo lzo-devel) $(vopt_if ssl 'libressl-devel>=2.1.2')"
short_desc="Library to read/write several different streaming archive formats"