GloatHub
Gloat (cross-)compiles Clojure code to Go code, native binaries and shared libraries for 25 platforms including WebAssembly
The Compilation Pipeline¶
foo.clj β
foo.go β
foo / foo.so / foo.wasm
Gloat takes your Clojure source code and compiles it through multiple stages to produce standalone executables, WebAssembly modules, or shared libraries; for 20+ OS/Architecture combinations.
Each intermediate format can be output for inspection or further processing.
Key Features¶
Zero Dependencies
All tools (Go, Glojure, Babashka, etc) auto-install on first use. No manual setup required.
Cross-Compile
Build for Linux, macOS, Windows, FreeBSD, and more. Multiple architectures: amd64, arm64, 386.
WebAssembly
Compile to Wasm for browser or WASI environments. Run your code anywhere.
Shared Libraries
Create .so/.dylib/.dll files with C headers. Integrate with nearly any programming language via FFI using the Glojure or let-go engines.
Transparent Pipeline
Output any intermediate format (Clojure, Glojure, Go). Understand and debug every step.
Portable Builds
Generate standalone Go project directories. Build anywhere with just Make.
Quick Example¶
# Compile to native binary
gloat hello.clj
# Cross-compile for Windows
gloat app.clj -o app.exe -p windows/amd64
# Create WebAssembly module
gloat program.clj -o program.wasm
# Output intermediate formats
gloat code.clj -t glj # See generated Glojure
gloat code.clj -t go # See generated Go
# Format and syntax highlight Clojure
gloat -F code.clj # Format with zprint (default)
GLOAT_FMT='cljfmt fix -' gloat -F code.clj
gloat -C code.clj # Syntax highlight with ANSI colors
gloat -FCw40 code.clj # Format at width 40, then highlight
# Source input defaults to stdin when omitted
cat code.clj | gloat -FC
# Create a Go build directory
gloat code.clj -o code/
make -C code/ build # Compile to binary
Get Started¶
Ready to compile your Clojure code?