This is a CMake-based project to build and package Lua and LuaRocks. As the official Lua binaries repository is not updated very frequently, and the compilation process for Windows binaries is not straightforward for non-C developers, you can use this project to build an updated version of Lua.
The installer is used by the DEVCOM.Lua
winget package. You can
install it with the following command:
winget install --id DEVCOM.Lua
- C compiler (Microsoft Visual C++ or Clang)
- CMake
- Ninja
- ImageMagick
- GhostScript
- WiX v3
You can install the first five components with the following winget commands:
winget install --id LLVM.LLVM
winget install --id Kitware.CMake
winget install --id Ninja-build.Ninja
winget install --id ImageMagick.ImageMagick
winget install --id ArtifexSoftware.GhostScript
WiX v3 is available at https://github.com/wixtoolset/wix3/releases/. It requires .NET Framework 3.5 that can be installed with the following command:
Start-Process `
-FilePath pwsh `
-ArgumentList "-Command `"& {Enable-WindowsOptionalFeature -Online -FeatureName NetFx3}`"" `
-Wait `
-Verb RunAs
Update your path environment with setx
(supposing you installed the tools in
their default directories):
setx PATH ($(Get-ItemProperty -Path HKCU:\Environment -Name Path).Path + `
"$env:ProgramFiles\LLVM\bin")
Check if PATH
was set correctly:
Get-Command clang
Get-Command cmake
Get-Command ninja
Get-Command magick
Get-Command gswin64
You may need to restart your Windows session if you can't find ninja
even
after restarting your terminal.
Use the following commands to generate the installation package in both ZIP and MSI formats:
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --target package
You need Internet access to execute the build process to download the Lua source code and LuaRocks binaries.
For convenience, you can use the Build-Lua.ps1
script to run these commands.
If successful, the ZIP and MSI files will be available in the build
directory.