- C++ 34.7%
- Zig 32.4%
- C 30.2%
- Shell 1.9%
- Objective-C 0.7%
- Other 0.1%
| .forgejo/workflows | ||
| compat/linux/include/xcb | ||
| libs/dawn/include | ||
| patches/dawn | ||
| src | ||
| tools | ||
| vendor | ||
| .gitignore | ||
| .gitmodules | ||
| build.zig | ||
| build.zig.zon | ||
| LICENSE | ||
| README.md | ||
| SOURCE_LOCK.md | ||
egpu
egpu is WetGrape's source-first fork of zig-gamedev/zgpu.
It keeps the public Zig API while replacing downloaded prebuilt Dawn archives with a reproducible build from pinned sources.
What is different
- No
webgpu_dawn-*-prebuiltdependency exists inbuild.zig.zon. - Dawn C/C++ is compiled by Zig 0.16.0 (
zig cc/zig c++). - Dawn, zpool and system SDK inputs are pinned source mirrors under
git.wetgrape.su/mirrors. zig buildbuilds Dawn first and combines its static libraries withzig ar; the install contains siblingzdawnanddawnarchives (never a nested archive).- CI builds and packages all supported cross targets; tag builds publish artifacts.
- A deterministic source bundle contains expanded submodules, so the actual build can run without network access.
No upstream prebuilt Dawn archive is used as an input or fallback.
Supported targets
x86_64-linux-gnuaarch64-linux-gnux86_64-windows-gnux86_64-macos.12.0.0-noneaarch64-macos.12.0.0-none
Prerequisites
- Zig 0.16.0
- CMake 3.10.2 or newer
- Ninja
- Python 3 (Dawn's source generators)
git,tar,sha256sum, andzstd- Linux native build: X11, XCB, XRandR, Xinerama, XCursor, Xi, Wayland and xkbcommon development headers
On Ubuntu 24.04:
apt-get install cmake ninja-build python3 pkg-config zstd binutils \
libx11-dev libx11-xcb-dev libxrandr-dev libxinerama-dev \
libxcursor-dev libxi-dev libwayland-dev wayland-protocols libxkbcommon-dev
Connected source checkout, then offline build
The bootstrap step downloads sources only and pins every checkout:
git clone https://git.wetgrape.su/WetGrape/egpu.git
cd egpu
./tools/bootstrap-sources.sh
After bootstrap, disconnect the network. These commands do not fetch anything:
zig build -Doptimize=ReleaseFast
zig build test -Doptimize=ReleaseFast
Cross-build examples:
zig build -Dtarget=aarch64-linux-gnu -Doptimize=ReleaseFast
zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
zig build -Dtarget=aarch64-macos.12.0.0-none -Doptimize=ReleaseFast
Fully expanded offline source bundle
On a connected machine:
./tools/bootstrap-sources.sh
./tools/make-source-bundle.sh dist/egpu-source.tar.zst
sha256sum -c dist/egpu-source.tar.zst.sha256
Move only the .tar.zst and checksum to the offline builder, then:
sha256sum -c egpu-source.tar.zst.sha256
tar --zstd -xf egpu-source.tar.zst
cd egpu-source
zig build -Dtarget=x86_64-linux-gnu -Doptimize=ReleaseFast
The source bundle is not a binary build artifact: it contains source code, generated source checked into Dawn, headers, and text linker stubs only. Unused system_sdk binaries (libX11.so, dxguid.lib, CoreImage.metallib) are explicitly excluded; Linux/Windows linkage comes from the target system and Zig's source-built MinGW runtime.
Consumer build.zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
const egpu = b.dependency("egpu", .{});
exe.root_module.addImport("zgpu", egpu.module("root"));
exe.linkLibrary(egpu.artifact("zdawn"));
// Propagates the generated source-built Dawn archive path.
@import("egpu").addLibraryPathsTo(exe);
}
Source and patch policy
- Upstream
zgpuhistory is retained. - Source mirrors are read-only pull mirrors in the
mirrorsorganization. - WetGrape-specific changes live only in
WetGrape/egpu. patches/dawn/contains small, reviewable compatibility patches applied to a private build-cache copy of the pinned Dawn checkout; builds never modifyvendor/dawn.- The same patch path works in expanded bundles without Git metadata, and independent target builds cannot race on shared source files.
- CI and local builds fail if a required source directory is absent; there is no prebuilt fallback.
See SOURCE_LOCK.md for exact revisions and provenance.
License
The original zgpu code is MIT licensed; see LICENSE. Vendored/mirrored dependencies retain their own license files.