build: document system deps, add check-deps, auto-glob web modules
- README: rewrite Build section for the hand-written Makefile (make / make DEBUG=1 / run / test / bench). Add a "System dependencies" table with the X11+GL dev packages per distro (apt/dnf/pacman/zypper/apk), since a clone won't build without them and the error is otherwise cryptic. Fix stale ./bin/Debug paths to ./bin/Release. - Makefile: add `make check-deps` — probes for the required X11/GL dev headers and prints the install command for the detected distro on failure (via /etc/os-release). - build_web.sh: auto-discover app modules from src/*.c (drop the hardcoded APP_MODULES list that had to be hand-synced), matching the desktop Makefile. Excludes the desktop platform backends. Remove the stale rspektrum.make reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -61,37 +61,67 @@ format.
|
||||
|
||||
## Building
|
||||
|
||||
The build is driven by a checked-in Makefile. `premake5` is **not** required to
|
||||
build — only to regenerate the makefiles.
|
||||
You need only **`make` and a C compiler** (`gcc` or `clang`) plus the X11/OpenGL
|
||||
**development** headers (see below). raylib is vendored in this repo and compiled
|
||||
from source — there is no separate raylib install step, no `premake`, no network
|
||||
access required. A plain clone builds:
|
||||
|
||||
```bash
|
||||
make -f rspektrum.make config=debug_x64 # -> bin/Debug/rspektrum
|
||||
make -f rspektrum.make config=release_x64 # -> bin/Release/rspektrum
|
||||
make # release -> bin/Release/rspektrum (-O3 -ffast-math, AVX2/FMA)
|
||||
make DEBUG=1 # debug -> bin/Debug/rspektrum (-g, no optimization)
|
||||
make run # build + launch
|
||||
make test # build + run the DSP correctness tests
|
||||
make bench # FFT benchmark over mlnl_samples.wav
|
||||
make clean
|
||||
```
|
||||
|
||||
Web (WebAssembly) build:
|
||||
Useful overrides: `make CC=clang`, or `make ARCH=-march=native` to tune for your
|
||||
own CPU (the default `-march=x86-64-v3` targets any ~2013+ x86-64 chip; drop it
|
||||
with `make ARCH=` for an older CPU).
|
||||
|
||||
### System dependencies
|
||||
|
||||
The compiler needs the X11 and OpenGL **dev** headers (the runtime libs are
|
||||
already present on any desktop; only the `-dev`/`-devel` packages are usually
|
||||
missing). The X11 extension libraries (Xrandr, Xinerama, Xcursor, Xi) are opened
|
||||
at runtime via `dlopen`, but their **headers** are still required to compile.
|
||||
|
||||
If `make` stops with an error like `fatal error: X11/Xlib.h: No such file` or
|
||||
`GL/gl.h: No such file`, install the dev packages for your distribution:
|
||||
|
||||
| Distro | Command |
|
||||
|--------|---------|
|
||||
| **Debian / Ubuntu / Mint** | `sudo apt install build-essential libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev` |
|
||||
| **Fedora / RHEL / Rocky** | `sudo dnf install gcc make libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel mesa-libGL-devel` |
|
||||
| **Arch / Manjaro** | `sudo pacman -S base-devel libx11 libxrandr libxinerama libxcursor libxi mesa` |
|
||||
| **openSUSE** | `sudo zypper install gcc make libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel Mesa-libGL-devel` |
|
||||
| **Alpine** | `sudo apk add build-base libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev mesa-dev` |
|
||||
|
||||
On Debian/Ubuntu the single metapackage `xorg-dev` pulls in all of the X11 `-dev`
|
||||
packages above, if you'd rather not list them.
|
||||
|
||||
Run `make check-deps` to probe for the required headers before building — it
|
||||
prints the install hint for your platform if anything is missing.
|
||||
|
||||
### Web (WebAssembly) build
|
||||
|
||||
```bash
|
||||
./build_web.sh # emscripten; emits the WebAssembly bundle
|
||||
./build_web.sh # emscripten; emits the WebAssembly bundle to bin/web/
|
||||
```
|
||||
|
||||
> The release build enables `-O2`, which turns on extra warnings
|
||||
> (`-Wformat-truncation`) that the debug build doesn't. Build release before
|
||||
> declaring a change clean.
|
||||
|
||||
---
|
||||
|
||||
## Usage (desktop GUI)
|
||||
|
||||
```bash
|
||||
./bin/Debug/rspektrum [input.wav]
|
||||
./bin/Release/rspektrum [input.wav]
|
||||
```
|
||||
|
||||
Load a file by passing it on the command line, dragging a `.wav` onto the window,
|
||||
or pressing **O** for the file browser. Try the bundled sample:
|
||||
|
||||
```bash
|
||||
./bin/Debug/rspektrum mlnl_samples.wav # in-repo WAV with an embedded mLnL chunk
|
||||
./bin/Release/rspektrum mlnl_samples.wav # in-repo WAV with an embedded mLnL chunk
|
||||
```
|
||||
|
||||
### Controls
|
||||
|
||||
Reference in New Issue
Block a user