Overview of (lib)unarr
masterunarr to provide a CMake-based build system and ongoing maintenance for the unmaintained original project. It is particularly useful for handling archives that require specific filter or solid compression support.repository·master·Indexed 43 days ago
https://github.com/gen2brain/go-unarrGo bindings for the unarr library providing decompression for RAR, TAR, ZIP, and 7z archives. Includes a programmatic Go library and a command-line interface for extracting archive contents.
unarr to provide a CMake-based build system and ongoing maintenance for the unmaintained original project. It is particularly useful for handling archives that require specific filter or solid compression support.(lib)unarr does not currently support:
7z support is limited and must be explicitly enabled at build time using -DENABLE_7Z=ON. This limitation exists due to a performance issue in the ANSI-C based 7z extraction code provided by the LZMA SDK when handling large files with solid compression.
For an embedded build, copy the source code directly into your project and ensure your compiler is C99 compatible. To enable support for specific compression formats using third-party libraries, define the following symbols and ensure the corresponding headers are in your include path:
| Symbol | Required header | Required for (format/method)|
|-------------------|:---------------:|----------------------------|
|HAVE_ZLIB | zlib.h | faster CRC-32 and Deflate |
|HAVE_BZIP2 | bzlib.h | ZIP / Bzip2 |
|HAVE_LIBLZMA | lzma.h | ZIP / LZMA, XZ(LZMA2) |
|HAVE_7Z | 7z.h | 7Z / LZMA, LZMA2, BCJ |
|_7ZIP_PPMD_SUPPPORT| | 7Z / PPMd |To build (lib)unarr from source, use CMake. You can configure the build to produce a static library or enable 7z support. By default, the build system attempts to detect and use system libraries like bzip2, xz/LibLZMA, and zlib. You can explicitly disable system library detection if you prefer to use embedded versions.
# Standard build
mkdir build
cd build
cmake ..
make
# Build as a static library
cmake .. -DBUILD_SHARED_LIBS=OFF
# Build with 7z support enabled
cmake .. -DENABLE_7Z=ON
# Disable system library detection (to use embedded versions)
cmake .. -DUSE_SYSTEM_BZ2=OFF -DUSE_SYSTEM_LZMA=OFF -DUSE_SYSTEM_ZLIB=OFF
# Install the library
make installTo use go-unarr as a dependency in your Go project, use go get.
go get -v github.com/gen2brain/go-unarrYou can install the unarr command-line tool directly using go install. This tool provides decompression capabilities for RAR, TAR, ZIP, and 7z archives.
go install github.com/gen2brain/go-unarr/cmd/unarr@latestzlib is a general-purpose data compression library. It is thread-safe and implements data formats described by RFCs 1950 (zlib format), 1951 (deflate format), and 1952 (gzip format).
Key resources for developers:
zlib.h.test/example.c for a general usage example and test/minigzip.c for a minigzip implementation..zip files built on top of zlib is available in the contrib/minizip directory.To build the shared library libbz2.so and the bzip2-shared client, use the specific Makefile for shared libraries. Note that building shared objects on x86 platforms may result in a 10%-20% performance slowdown because it makes the %ebx register unavailable to gcc.
Important Migration Note: If upgrading from version 0.9.0/0.9.5 to 1.0.X, all library functions have been renamed to avoid namespace pollution (e.g., bzCompress is now BZ2_bzCompress). Consequently, shared libraries created with the 1.0.X Makefile are not compatible with programs written for older versions.
make -f Makefile-libbz2_soTo build the static library libbz2.a and the programs bzip2 and bzip2recover, run make. This process includes six self-tests. If the tests pass, you can install the components.
To install to default system paths (/usr/local/bin, /usr/local/lib, etc.), use:
make install
To install to a custom directory, use the PREFIX variable:
make install PREFIX=/xxx/yyy
To preview the installation commands without executing them, use the -n flag:
# Build and run self-tests
make
# Install to default locations
make install
# Install to a custom prefix
make install PREFIX=/xxx/yyy
# Dry run to see commands before executing
make -n install PREFIX=/xxx/yyyWhile binaries are available on the official website, bzip2 is standard ANSI C and can be compiled with MS Visual C++. Using MS Visual C++ 6, you can build from unmodified sources via nmake.
# Ensure MSVC paths are set (e.g., via VCVARS32.BAT)
nmake -f makefile.mscTo compile the zlib library and run the included test programs on most Unix-like systems, use the following sequence:
./configuremake testmake installPlatform Specifics:
win32/ or contrib/vstudio/.make_vms.com.deflate.c must be compiled without optimization (avoid -O) to prevent test failures due to compiler bugs../configure
make test
make installOnce installed, use the unarr command followed by the source archive path and the destination directory path.
unarr ./example.7z ./example/