On Mon, Jul 31, 2006 at 09:58:28PM -0700, Tim Kientzle <[EMAIL PROTECTED]> 
wrote:
> It should be pretty simple.  Look at
> archive_read_support_format_compress() for an
> example.  (The gzip/bzip2 examples are a little
> more complex because of how those libraries work.)
> 
> You'll need to define archive_read_support_compression_lzma(),
> which just registers a 'bid' function and an 'init' function.
> The 'bid' function checks whether this is an lzma stream.
> The 'init' function then sets up three function pointers:
>    compression_read_ahead : This returns a pointer/size to
> the next block of uncompressed data.  (The block should be
> as large as the requested size.)
>    compression_read_consume : This informs the decompressor
> that some of the data has been used.
>    compression_finish : clean up.
> 
> You can ignore compression_skip; it is used only by
> compression_none.
> 
> The decompressor calls a->client_reader to get blocks
> of data and calls a->client_closer when it hits the
> end of the stream (or when compression_finish is called).
> 
> The hardest part is getting the buffer management right.
> The compression layer has to track positions in the
> compressed data (blocks from the client_reader) and
> uncompressed data (as the format layer calls
> compression_read_consume).

Hi Tim,

First, sorry for the extremely slow answer. This message was now sitting
in my inbox for 2 years, but finally today I gave it a try, and you had
reason, it was pretty simple.

Here is the result:

http://frugalware.org/~vmiklos/patches/libarchive-add-lzma-read-support-using-liblzmadec.patch

The patch is against version 2.5.5.

> I looked through the lzma code and it looks like a pretty
> simple job.  The hardest part is figuring out how to get
> an lzma library.  Because the lzma code is GPL, I cannot
> include it with libarchive; I haven't seen an lzma standalone
> library, either, just the 7zip program source.

About the license war, I think this is not an issue. See the lzma
license at:

        http://www.7-zip.org/sdk.html

It's availalbe under LGPL, so you can link to it in libarchive, while
keeping libarchive's BSD license. IANAL, but that's how I understand it.

I left one FIXME in the code, the FreeBSD CVS/SVN ID, I don't know how
that works, but I'm sure it's trivial for you. :-)

To sum up, please have a look at it, I would be happy if one day it
could be part of the vanilla libarchive. ;-)

Thanks!

Attachment: pgpl8cDGEmfJ4.pgp
Description: PGP signature

_______________________________________________
Frugalware-devel mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-devel

Reply via email to