Skip to content

Latest commit

 

History

History
96 lines (66 loc) · 3.21 KB

File metadata and controls

96 lines (66 loc) · 3.21 KB

bazel_rules_raylib

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/.

What This Repo Does

  • Downloads the pinned raylib release 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

Status

  • 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.

Requirements

  • Bazel 9.0.1 via bazelisk or 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-cl style linking
  • macOS uses Objective-C compilation for raylib's embedded GLFW implementation, which is required by upstream raylib

Build

Build everything:

bazel build //...

Use The Release

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_game

Run the standalone example:

cd examples
bazel run //:my_game

Repository Layout

How Hermeticity Works Here

This repository does not call out to Homebrew, pkg-config, xcrun, or other host discovery tools during repository setup. Instead, it:

  1. Declares the exact raylib release archive URL
  2. Pins the archive SHA-256
  3. Extracts the archive in a repository rule
  4. Writes a generated BUILD.bazel for the fetched source tree

That means the external source inputs are stable and reproducible as long as the pinned archive remains available.

CI

GitHub Actions is configured in .github/workflows/ci.yml to build this repository on:

  • ubuntu-latest
  • macos-latest
  • windows-latest