- C 87.1%
- Shell 4.2%
- PowerShell 3.7%
- Python 3.1%
- Makefile 1.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
PowerShell stringifies a FileInfo as its absolute path, so the check looked in test/work/D:\a\Argo\...; extraction itself succeeded. Directories are created upfront in main() before the extractor threads, so drop the redundant per-file mkpath in the extractor. |
||
| .github/workflows | ||
| test | ||
| tools | ||
| .gitignore | ||
| banned.h | ||
| compress.c | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| RELEASE_NOTES.md | ||
| template.c | ||
Argo — Self-Extracting C Archives
Argo is a compression tool that creates self-extracting C source archives.
The output is a single .c file that decompresses and restores the original files when compiled and run.
The archive file is guaranteed to be no larger than the original files combined.
Usage
cc -o ccompress compress.c && ./ccompress compress.c Makefile -o Argo.c
cc -o extract Argo.c && ./extract
The compressor (ccompress) reads any number of input files and produces Argo.c.
The resulting C file is compiled and executed to reproduce the original files.
Recommended flags for the generated archive (produces smaller binaries):
cc -Os -ffast-math -march=native -lpthread Argo.c -o extract && ./extract
On MSVC:
cl /O1 /fp:fast Argo.c /Fe:extract.exe
How it works
- LZMA2 compression with a range-coded, probability-model entropy coder and multithreaded chunked encoding
- Legacy fallback: LZ77/LZ78 match-finder for data where LZMA2 would expand
- Base85 encoding of the compressed stream using a C-string-safe alphabet (avoids
"and\) - The decoder (
lz+b8) is embedded in the generated C file alongside a threaded file extractor
The generated archive decompresses and extracts files using POSIX threads (pthreads) on Linux/macOS/MinGW, and single-threaded extraction on MSVC.
Requirements
- A C23 compiler (GCC, Clang) for the compressor
- The generated archive compiles with any C99-or-later compiler (GCC, Clang, MSVC, MinGW) on Linux, macOS, or Windows
Building
make
Testing
make test
Or run the full test suite:
test/run.sh # Linux, macOS, MinGW
pwsh test/run.ps1 # MSVC on Windows
The CI pipeline (test.yml) runs tests across 5 environments: Linux (glibc), Alpine Linux (musl), macOS, MinGW (msys2), and MSVC.
Version
./ccompress --version
License
MIT — see LICENSE for details.