Re: [Vala] Binding 7zip library ?



On Tue, 2013-08-27 at 08:46 +0200, raum no-log org wrote:
I had a look to libarchive... It seems libarchive 3.0 could handle 7Zip
format (for reading) but unfortunately there is only a vapi file for
version 2...

I've read some pages about "how to generate vapi" but I didnt success...

Should I try to write by hand a vapi file ?

libarchive is not GObject-based, so it's not possible to generate a vapi
automatically.  Writing it by hand is your only option.

libarchive 3 is compatible with previous versions, so there is no need
to create a new VAPI.  Just add what you need to the existing bindings.


Thanks

On Mon, 2013-08-26 at 11:27 +0200, raum no-log org wrote:
Hello,

I've downloaded and build 7Zip library and I've these files compiled
(under Windows using MingW32, with prefix /opt) :

/src/lib7zip-1.6.5/Lib7Zip/lib7zip.a
/src/lib7zip-1.6.5/Lib7Zip/lib7zip.dll
/src/lib7zip-1.6.5/Lib7Zip/lib7zip.h

"make install" command didn't copy these files under /opt/bin,
/opt/include, /opt/library

The 7zip SDK really designed to be embedded within your project, not
used as a shared library.

I've copied manually in the correct directory but tests programs output
:
# test7zip.exe
initialize fail!

So I think I've made a mistake somewhere... But how to test it with a
vala
test program ? I need to build a vapi file ? something like that ?

Yes, you would need to create VAPI.  I looked at the 7zip SDK API quite
recently and I don't think creating a VAPI would be an easy task.  The
API is a bit of a mess.

I'm not sure what your use case is.  If you need to read and write *.7z
files you might want to look at libarchive?I'm not sure whether they
support 7zip or not, but if they do then it would be a much easier way
to go since it already has a VAPI.

If you just want to compress stuff you might want to take a look at a
project I've been working on called Squash [1], which does have Vala
bindings.  It is an abstraction layer for compression libraries (not
archivers?that's what libarchive is for), and it supports most of the
algorithms 7zip uses.

I do plan to write a Squash plugin for the 7zip SDK eventually [2], and
if you really need PPMD, BCJ, or BCJ2 (Squash already supports LZMA,
LZMA2, bzip2, and DEFLATE) I can take a look at that sooner rather than
later, but keep in mind that it will not support *.7z archives.

Also, if you're not tied to 7zip, you may want to look at FreeArc [3].
I don't remember if they have an API you could use or not, but the PPM
compression is better, and the other algorithms are great [4].  Or, if
all you care about is compression ratio, ZPAQ [5] (for which there is a
Squash plugin) is amazing.


-Evan

[1] http://quixdb.github.io/squash/
[2] https://github.com/quixdb/squash/issues/31
[3] http://freearc.org/
[4] http://compressionratings.com/i_freearc.html
[5] http://mattmahoney.net/dc/zpaq.html







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]