flan/vendor/raylib/headers
Joseph Ferano 85ef56f657 The bindings are committed, and regeneration is what checks them
generated.flan carries the 253 declarations the importer reads out of raylib's
header, so a build needs libraylib linkable and no header at all. The opt-in
no longer decides how many bindings a package has — every build now gets all
425, they are greppable, and they diff when raylib moves.

What that gives up is the build-time check, so `flan generate-c` is the only
thing that writes the file and it compares first: every defstruct against the
header's record, every hand-written declare-c against the header's signature,
and it writes nothing when they disagree. Against the 5.1-dev header on this
machine that is ten real differences and no write.

The 172 hand-written lines stay, and not out of caution. Everything the
generator emits agrees with the header by construction, so diffing generated
output against its own source is a tautology; the hand-written lines were
transcribed by a person, so they are the only thing here a header can
contradict. All ten of those differences came from them.

`bindings` beside `headers` is what survives regeneration, because a hand-edit
to a committed generated file does not. Two directives: `exclude` drops
raylib's three allocator entry points, and `name` gives the 19 generated
predicates the `?` spelling the hand-written ones already use.
2026-09-13 08:07:40 +07:00

53 lines
2.8 KiB
Plaintext

# C headers this package reads function signatures out of. One per line: a
# path, then any clang flags that header needs. A relative path is against
# this directory, ${NAME} expands from the environment, and a leading `?`
# means "if it is there" — an optional line with nothing behind it is simply
# not read.
#
# What this is for, now that the bindings are committed. generated.flan holds
# every declaration the importer produced, in the repository, so a build needs
# libraylib linkable and no header at all. This line is read by two things:
#
# 1. `flan generate-c vendor/raylib`, which is the only way generated.flan
# is written. It reads the header named here, compares the package
# against it, and refuses to write when they disagree — so it is not
# possible to regenerate the bindings without comparing them to the
# library they claim to bind.
#
# 2. an ordinary build, when the variable happens to be set. Every C symbol
# is bound already — by hand in raylib.flan or by generation in
# generated.flan — so the importer generates nothing and the header read
# is purely the check. That check is now over all 425 declarations rather
# than the 172 hand-written ones, because the generated file is a package
# file like any other and is checked like one.
#
# Why it is still optional. A build needs libraylib linkable and *not*
# raylib-devel installed, which is a property worth keeping; requiring a header
# would take it from everyone to give the check to whoever has one. Before the
# bindings were committed this marker also decided how many bindings a build
# got, which was the real cost of it being opt-in; it no longer decides that,
# and all it now withholds is a check that regeneration has already run once.
# Same shape as ${FLAN_RAYLIB_WEB} in `link`, and for the same reason.
#
# The version must match the shared library `link` names — 5.5, libraylib.so.550.
# Reading one version's header while linking another's library is exactly the
# silent disagreement this exists to prevent, and it is caught rather than
# described: against a 5.1-dev header, regeneration reports ten differences
# that are all real and writes nothing.
#
# export FLAN_RAYLIB_H=/path/to/raylib-5.5/src/raylib.h
#
# vendor/raylib/build-web.sh already clones that exact tag to build the browser
# archive, so a tree that has built for web has the matching header at
# vendor/raylib/web/raylib-5.5/src/raylib.h.
#
# To see what regeneration would produce without writing anything:
#
# flan import-c $FLAN_RAYLIB_H vendor/raylib/raylib.flan
#
# What shapes the generated half — which functions are skipped, and what they
# are called — is `bindings` beside this file. See its comments for why a
# committed generated file needs a config at all.
#
?${FLAN_RAYLIB_H}