Argo, a generator for compressed files in self-extracting C code.
  • C 87.1%
  • Shell 4.2%
  • PowerShell 3.7%
  • Python 3.1%
  • Makefile 1.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Lucy Ada Randall c3f5ba9ae7
Some checks failed
test / linux (push) Failing after 31s
test / linux-musl (push) Failing after 2s
test / haiku (push) Failing after 3s
test / macos (push) Has been cancelled
test / mingw (push) Has been cancelled
test / msvc (push) Has been cancelled
test: fix extracted-path check in run.ps1
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.
2026-08-15 03:03:53 -07:00
.github/workflows support directory paths in archives 2026-08-15 03:00:33 -07:00
test test: fix extracted-path check in run.ps1 2026-08-15 03:03:53 -07:00
tools test: fix extracted-path check in run.ps1 2026-08-15 03:03:53 -07:00
.gitignore chore: ignore test/work_argo generated archive dir 2026-08-15 01:01:02 -07:00
banned.h ci: use clang/llvm everywhere; audit banned.h in-source 2026-08-15 01:30:14 -07:00
compress.c support directory paths in archives 2026-08-15 03:00:33 -07:00
LICENSE add MIT license headers to all source files 2026-07-13 20:06:24 -07:00
Makefile ci: install linker on alpine; use /Fo //Fe for MSVC objects 2026-08-15 01:34:12 -07:00
README.md v1.4.0: MSVC/Windows support, cross-platform CI, robustness improvements 2026-07-13 20:25:43 -07:00
RELEASE_NOTES.md docs: release notes for v1.5.0 2026-08-15 01:13:56 -07:00
template.c test: fix extracted-path check in run.ps1 2026-08-15 03:03:53 -07:00

Argo — Self-Extracting C Archives

test

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

  1. LZMA2 compression with a range-coded, probability-model entropy coder and multithreaded chunked encoding
  2. Legacy fallback: LZ77/LZ78 match-finder for data where LZMA2 would expand
  3. Base85 encoding of the compressed stream using a C-string-safe alphabet (avoids " and \)
  4. 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.