Standalone Cross Platform (Windows / Linux)) File Compression for C / C ++?

I am looking for (preferably) a small open source library in C or C ++ that I can include in my licensed MIT projects (hosted in google code). I am a C / C ++ hobby programmer, so I am not so advanced, but I only know what I need to develop plugins for an application called "SA-MP" (works on Windows and Linux). What I'm ready to do is an automatic installer that should be able to decompress compressed files (possibly .zip, but any other method of file compression will do!).

I was looking for such a library, but they should always have some additional dll for windows or some other linux files - this is not what I am looking for, as end users may not know how to install the plugin with the necessary components.

I also looked at the base compression library and it seems that it does not have file compression, but simply algorithms. So with this I was not lucky.

To make the text higher:

  • No external settings, additional libraries that are necessary, are allowed if they can be related to my C / C ++ project.
  • Can compress whole directories and unpack them.
  • Works with windows and linux.
  • It can be used safely with a MIT license (optional, recommended)
+2
source share
2 answers

What happened to zlib (this is the obvious first thing to pay attention to, everyone uses this) or libzip (first click freshmeat )?

  • zlib: the library itself provides compression, but there is an example implementation of the zip format that you can use. The "zlib license" is a slightly modified MIT / X license, so it must be compatible. It's trivial to create as part of your application.
  • libzip: supports zip format. BSD revised license; you must support it, but basically it is equivalent to a MIT / X license. You can also link statically.

In general, there are no technical reasons why you will need to dynamically link something. You will not do it. However, there is a legal reason for LGPL-licensed libraries, since LGPL stops at the boundary of dynamic objects, so static linking also does different LGPL code.

+3
source

As for compression libraries, there are several alternatives with low and very low dependencies. Zlib is really the first thing that comes to mind, but it’s fair to say that only its source tree is quite β€œcrowded”. At the same time, I think it does not depend on anything special.

Much simpler, but also much easier, you will find alternatives such as LZ4 , where the entire source code is populated with a single file and external dependencies are limited to stdlib, etc.

You will probably have more difficulty finding a portable library that scans directories, since such things tend to be OS-specific. I was thinking about Shelwien Shar , but it can be tied to Windows.

0
source

Source: https://habr.com/ru/post/1397559/


All Articles