Hermetic Bazel rules for building raylib from a pinned upstream source archive.
This repository currently fetches raylib 5.5 via Bzlmod, verifies it with a pinned SHA-256, and exposes it through //raylib:raylib. A standalone copy-paste consumer example lives under examples/.
- Downloads the pinned
raylibrelease tarball from GitHub - Verifies the archive with a fixed SHA-256
- Builds raylib as a
cc_library - Uses vendored GLFW sources from the raylib release instead of relying on Homebrew or other host package managers
- Provides CI for macOS, Linux, and Windows
- macOS: verified locally with Bazel
9.0.1 - Linux: CI configured
- Windows: CI configured
The rule is intended to be hermetic at the repository-fetch layer: the upstream URL and archive hash are pinned in MODULE.bazel.
- Bazel
9.0.1viabazeliskor a matching local Bazel install - A working C/C++ toolchain
Platform notes:
- Linux needs OpenGL and X11 development libraries available to the toolchain environment
- Windows support is set up for Bazel's Windows toolchains, including MSVC and
clang-clstyle linking - macOS uses Objective-C compilation for raylib's embedded GLFW implementation, which is required by upstream raylib
Build everything:
bazel build //...The standalone consumer example in examples/MODULE.bazel is set up to use the tagged GitHub release source directly:
git_override(
module_name = "bazel_rules_raylib",
remote = "https://github.com/maharshijinandra/bazel_rules_raylib.git",
tag = "v0.1.1",
)You can also use examples/ itself as a standalone consumer workspace:
cd examples
bazel build //:my_gameRun the standalone example:
cd examples
bazel run //:my_game- MODULE.bazel: root module, pinned raylib version, URL, and SHA
- raylib/extensions.bzl: Bzlmod extension entry point
- raylib/repositories.bzl: repository rule that downloads and prepares raylib
- raylib/BUILD.raylib.bazel: generated external repo build definition
- raylib/BUILD.bazel: stable alias target exposed from this repo
- examples/MODULE.bazel: standalone consumer workspace module file
- examples/BUILD.bazel: standalone consumer build file
- examples/main.cc: copy-paste sample program
This repository does not call out to Homebrew, pkg-config, xcrun, or other host discovery tools during repository setup. Instead, it:
- Declares the exact raylib release archive URL
- Pins the archive SHA-256
- Extracts the archive in a repository rule
- Writes a generated
BUILD.bazelfor the fetched source tree
That means the external source inputs are stable and reproducible as long as the pinned archive remains available.
GitHub Actions is configured in .github/workflows/ci.yml to build this repository on:
ubuntu-latestmacos-latestwindows-latest