Installation¶
You need three things:
- A C toolchain (
cc,make,cmake,git). hcc is written in C, and at compile time it callsccto assemble and link your program. - hcc, built from source. There are no prebuilt packages.
- SDL2, SDL2_image and OpenGL development libraries, for the window examples and image loading.
hello-world,draw-basicandfont-textwork without them.
1. Dependencies¶
On current Arch, sdl2-compat provides the SDL2 API on top of SDL3. The examples work with it unchanged.
OpenGL ships with macOS as a framework, so there's nothing to install for it. Apple deprecated OpenGL in 2018 but still includes 4.1 core, which is enough for everything here.
In an admin PowerShell:
Reboot, open the Ubuntu shell, and follow the Debian/Ubuntu tab. Windows 11 and recent Windows 10 builds include WSLg, which displays Linux GUI windows on your desktop. Run glxinfo -B inside WSL (sudo apt install mesa-utils) to check that OpenGL works.
2. hcc¶
The build scripts can clone, build and install hcc for you. By default it goes into ~/.local, so you don't need root:
git clone https://github.com/YatoVoid/holyc-graphics-guide.git
cd holyc-graphics-guide
./scripts/build-linux.sh --install-hcc # or build-macos.sh
This pins hcc to the commit the examples were tested against. Make sure ~/.local/bin is on your PATH:
To build hcc by hand, or to understand what the script does, see Build hcc from source.
3. Check everything¶
This builds all thirteen examples, checks that each example's --ppm mode draws exactly the image recorded in scripts/checksums.txt (the OpenGL ones only when they run on Mesa's llvmpipe; elsewhere that comparison is skipped), checks the samples beep plays the same way, and starts each window program for three seconds to make sure it doesn't crash. Add --no-gl on machines without a working OpenGL driver.
Next: Quick start.