Skip to content

Add Lua bytecode compilation and production package builds - #28

Merged
jurgelenas merged 1 commit into
masterfrom
build
Aug 14, 2026
Merged

jurgelenas merged 1 commit into
masterfrom
build

Conversation

@jurgelenas

Copy link
Copy Markdown
Owner

Scripts shipped as source are compiled by the radio on first load, which costs RAM and startup time, and there was no way to produce a release artifact. Wrap EdgeTX's edgetx-luac WebAssembly module (upstream PR #7275) in a WAMR runtime and build four things on top of it:

  • dev luac: compile a single script
  • dev build --out: a package directory with .luac next to every .lua, installable via pkg install
  • dev build --compress: an SD-card zip laid out at install destinations with no manifest, for artifact storage
  • pkg install/update --pre-compile: bytecode installed alongside sources

Compilation never touches the SD card. --pre-compile runs the same build into a local TempDir and copies the finished tree across in one pass, so a script that fails to compile aborts before the card, the store, or the file list is touched. Sources ship next to the bytecode because the radio still discovers widgets by their .lua (EdgeTX#5230), and generated .luac files take their source's timestamp so the radio prefers them instead of recompiling.

The module is downloaded on first use and cached; its output is byte-identical to the .luac the simulator and radio generate themselves, verified against six ELRS widget scripts.

Scripts shipped as source are compiled by the radio on first load, which
costs RAM and startup time, and there was no way to produce a release
artifact. Wrap EdgeTX's edgetx-luac WebAssembly module (upstream PR #7275)
in a WAMR runtime and build four things on top of it:

- dev luac: compile a single script
- dev build --out: a package directory with .luac next to every .lua,
  installable via pkg install
- dev build --compress: an SD-card zip laid out at install destinations
  with no manifest, for artifact storage
- pkg install/update --pre-compile: bytecode installed alongside sources

Compilation never touches the SD card. --pre-compile runs the same build
into a local TempDir and copies the finished tree across in one pass, so
a script that fails to compile aborts before the card, the store, or the
file list is touched. Sources ship next to the bytecode because the radio
still discovers widgets by their .lua (EdgeTX#5230), and generated .luac
files take their source's timestamp so the radio prefers them instead of
recompiling.

The module is downloaded on first use and cached; its output is
byte-identical to the .luac the simulator and radio generate themselves,
verified against six ELRS widget scripts.
@jurgelenas
jurgelenas merged commit 0142300 into master Aug 14, 2026
2 of 3 checks passed
@jurgelenas
jurgelenas deleted the build branch August 14, 2026 19:25
@jurgelenas

Copy link
Copy Markdown
Owner Author

closes #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant