Skip to content

Instantly share code, notes, and snippets.

@Egor-Skriptunoff
Last active July 26, 2022 22:11
Show Gist options
  • Select an option

  • Save Egor-Skriptunoff/30c9a12665d77e33e35499ff2664fcd5 to your computer and use it in GitHub Desktop.

Select an option

Save Egor-Skriptunoff/30c9a12665d77e33e35499ff2664fcd5 to your computer and use it in GitHub Desktop.

Revisions

  1. Egor-Skriptunoff revised this gist Mar 15, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion how_to_build_luajit_for_windows.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,9 @@

    - Execute the following commands in this console window:
    `cd /d C:\Temp\`
    `git clone https://luajit.org/git/luajit.git`
    `git clone https://luajit.org/git/luajit.git`
    `cd luajit`
    `git checkout v2.1`

    - Close the console window.
    Now you have LuaJIT 2.1 sources in the folder `C:\Temp\luajit\`
  2. Egor-Skriptunoff created this gist May 22, 2021.
    54 changes: 54 additions & 0 deletions how_to_build_luajit_for_windows.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    # How to build 64-bit LuaJIT 2.1 binaries for Windows


    1. **Download the latest LuaJIT sources**

    - Create temporary folder for LuaJIT sources.
    I assume you would use `C:\Temp\` folder.

    - Download and install [Portable "Git for Windows"](https://github.com/git-for-windows/git/releases/download/v2.31.1.windows.1/PortableGit-2.31.1-64-bit.7z.exe)

    - Run `git-cmd.exe`, a console window will open.

    - Execute the following commands in this console window:
    `cd /d C:\Temp\`
    `git clone https://luajit.org/git/luajit.git`

    - Close the console window.
    Now you have LuaJIT 2.1 sources in the folder `C:\Temp\luajit\`

    - You can uninstall "Git for Windows" application now.
    It's portable, so just remove its folder.

    2. **Build LuaJIT binaries using MinGW64**

    - Download and install [MSYS2](https://repo.msys2.org/distrib/x86_64/msys2-x86_64-20210419.exe).
    It is recommended to install MSYS2 in the default destination folder `C:\msys64\`,
    but you may choose another path consisting of English letters without spaces.

    - After installation is complete, a MSYS2 console window will open.
    Execute the following command in this MSYS2 console window:
    `pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make`
    When asked `Proceed with installation? [Y/n]`, answer `Y` and press `Enter`.

    - Close this MSYS2 console window and open a new one by clicking the `MSYS2 MinGW 64-bit` menu item in Windows Start menu.
    Execute the following commands in the new MSYS2 window:
    `cd /c/Temp/luajit/`
    `mingw32-make CFLAGS=-DLUAJIT_ENABLE_LUA52COMPAT`

    - Close the MSYS2 console window.

    - You can uninstall MSYS2 application now at `Control Panel` -> `Programs and Features`.

    3. **Take LuaJIT binaries**

    - Open folder `C:\Temp\luajit\src\`
    Sort files by "Date Modified".

    - Find 2 files: `luajit.exe` and `lua51.dll` among the most recently modified.

    - Take these 2 files and put them to the folder where Lua binaries should be on your system.

    - You can remove LuaJIT sources now.
    Delete folder `C:\Temp\luajit\`