fetch-luau recipe and the committed Luau foreign binding package (#78) #90

Merged
crowmaki merged 2 commits from luau-runtime-78 into main 2026-09-06 02:34:59 +00:00
Owner

Closes #78

What

  • just fetch-luau downloads the pinned Luau source tarball, hash-verifies the decompressed tar against luau_hashes in the justfile, configures it with CMake and Ninja on clang++ with LUAU_EXTERN_C=ON, builds Luau.Common, Luau.Ast, Luau.Bytecode, Luau.Compiler and Luau.VM, checks that lua_pcall, luau_load and luau_compile export with C linkage, and installs under .tools/luau/<version>/. A second run reports "already present"; force=1 rebuilds.
  • plugins/luau/lua is a hand-written foreign import package for the Luau C API subset the Plugin will use: state creation and close, compile, load, pcall, stack access, tables, userdata with metatables, light userdata, thread data and the VM callbacks. It pins LUAU_VERSION and LUAU_SOURCE_SHA256; the recipe refuses if the Odin hash disagrees with the justfile table. The package type-checks with .tools/luau absent.
  • tests/luau joins the suite list with a smoke test (compile, pcall, read a global back) plus load rejection, a runtime error through pcall, a C callback recovering host state from thread data, and a userdata method call through a metatable.
  • The justfile header and the AGENTS.md build section list fetch-luau.

Toolchain notes baked into the recipe

  • Luau's objects default to the dynamic CRT while Odin links the static one, so the recipe passes LUAU_STATIC_CRT=ON. This also keeps the bytecode luau_compile mallocs freeable with libc.free from Odin.
  • clang++ compiles against whichever MSVC STL headers it finds and Odin links whichever MSVC libraries it finds. On a machine where those differ, a newer header referenced an STL symbol the older libcpmt lacked, so the recipe builds with _USE_STD_VECTOR_ALGORITHMS=0.

Verification

  • just fetch-luau twice (build, then "already present"), and once with force=1.
  • just check with and without .tools/luau present.
  • just test: all six suites pass, including the new luau suite.
Closes #78 ## What - `just fetch-luau` downloads the pinned Luau source tarball, hash-verifies the decompressed tar against `luau_hashes` in the justfile, configures it with CMake and Ninja on clang++ with `LUAU_EXTERN_C=ON`, builds `Luau.Common`, `Luau.Ast`, `Luau.Bytecode`, `Luau.Compiler` and `Luau.VM`, checks that `lua_pcall`, `luau_load` and `luau_compile` export with C linkage, and installs under `.tools/luau/<version>/`. A second run reports "already present"; `force=1` rebuilds. - `plugins/luau/lua` is a hand-written `foreign import` package for the Luau C API subset the Plugin will use: state creation and close, compile, load, `pcall`, stack access, tables, userdata with metatables, light userdata, thread data and the VM callbacks. It pins `LUAU_VERSION` and `LUAU_SOURCE_SHA256`; the recipe refuses if the Odin hash disagrees with the justfile table. The package type-checks with `.tools/luau` absent. - `tests/luau` joins the suite list with a smoke test (compile, `pcall`, read a global back) plus load rejection, a runtime error through `pcall`, a C callback recovering host state from thread data, and a userdata method call through a metatable. - The justfile header and the AGENTS.md build section list `fetch-luau`. ## Toolchain notes baked into the recipe - Luau's objects default to the dynamic CRT while Odin links the static one, so the recipe passes `LUAU_STATIC_CRT=ON`. This also keeps the bytecode `luau_compile` mallocs freeable with `libc.free` from Odin. - clang++ compiles against whichever MSVC STL headers it finds and Odin links whichever MSVC libraries it finds. On a machine where those differ, a newer header referenced an STL symbol the older `libcpmt` lacked, so the recipe builds with `_USE_STD_VECTOR_ALGORITHMS=0`. ## Verification - `just fetch-luau` twice (build, then "already present"), and once with `force=1`. - `just check` with and without `.tools/luau` present. - `just test`: all six suites pass, including the new `luau` suite.
crowmaki deleted branch luau-runtime-78 2026-09-06 02:34:59 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar!90
No description provided.