luasocket icon indicating copy to clipboard operation
luasocket copied to clipboard

feature: MSYS2 support on src/makefile

Open luau-project opened this issue 7 months ago • 8 comments

Description

The changes in the src/makefile allows to build luasocket on MSYS2 shells with the compiler toolchain for each environment:

  • mingw32
  • mingw64
  • ucrt64
  • clang32
  • clang64
  • clangarm64

How to test the changes

Initial setup of tools (only once)

  1. Go to https://www.msys2.org/, download the installer and install MSYS2;
  2. Type ucrt64 on Windows start menu to open a MSYS2 shell for the ucrt64 environment listed above;
  3. Update core system packages
    pacman -Syuu
    
  4. Sync package database
    pacman -Syuu
    
  5. Install useful linux tools, git, a C compiler and Lua 5.1:
    pacman -S --needed base-devel git mingw-w64-ucrt-x86_64-cc mingw-w64-ucrt-x86_64-lua51
    
  6. Change to /tmp directory and clone my branch
    cd /tmp && git clone --branch=msys2-makefile https://github.com/luau-project/luasocket
    
  7. Leave the shell opened for the test

Test

  1. In the same shell above, build luasocket for ucrt64 environment:
    make -C luasocket/src PLAT=msys2ucrt64 LUAV=5.1 all
    
  2. Install the library:
    make -C luasocket/src PLAT=msys2ucrt64 LUAV=5.1 install
    
  3. Run a simple test
    lua5.1 luasocket/test/hello.lua
    
  4. Enjoy.

[!NOTE]

Lua C modules get installed at /ucrt64/lib/lua/5.1 and .lua files at /ucrt64/share/lua/5.1 for the ucrt64 environment, in case you want to remove them.

Extra

If you guys want, I can contribute a Github workflow to test luasocket on MSYS2 tools.

luau-project avatar Jul 07 '24 16:07 luau-project