Skip to content

Conversation

@luau-project
Copy link
Contributor

Description

This PR has two purposes:

  1. fixes the development rockspec (lua-zlib-scm-0.rockspec) for MinGW / MinGW-w64 on Windows, and simplifies the build on Unix or MSVC on Windows;
  2. adds macos-14 and windows-2025 to the test matrix.

Changes on lua-zlib-scm-0.rockspec

  1. The entry libdirs = { "$(ZLIB_LIBDIR)" } was added to the default build rule. This change allows to build lua-zlib with zlib installed at custom places on both Unix and Windows through the command
luarocks make lua-zlib-scm-0.rockspec ZLIB_DIR=/path/to/zlib

Note

The old setting only linked with zlib from system directories (/usr/lib and /usr/local/lib).

  1. The platform-override entry for mingw solves the linking problem for both MinGW / MinGW-w64 on Windows. Here, I applied a clever trick: on Windows, MinGW / MinGW-w64 can link libraries by the feeding the DLL to the linker. Then, grounded on the fact that a standard zlib installation always emits a DLL named libzlib1.dll or zlib1.dll, the build rules of LuaRocks allows it to link lua-zlib with zlib via the DLL.

Changes on .github/workflows/test.yml

  1. added macos-14 and windows-2025 to the test matrix;
  2. building zlib 1.3.1 from source code on Windows;
  3. caching zlib tarballs to avoid flooding (DOS) zlib website https://zlib.net;
  4. builds of (PUC-Rio) Lua 5.4, 5.3, 5.2 and 5.1 uses MSVC toolchain on Windows;
  5. builds of LuaJIT and OpenResty uses the standard MinGW-w64 toolchain provided by GitHub on Windows.

Notes

  1. If any user complains about not being able to build lua-zlib with MinGW / MinGW-w64 through lua-zlib-scm-0.rockspec, most likely it is related to a misconfiguration of LuaRocks. Also, anytime it happens, feel free to mention me through a @ , because I think I can help;
  2. Even though it is not present in the workflow, I tested the changed rockspec with multiple MinGW / MinGW-w64 providers (GitHub provider, MSYS2 provider, sourceforge provider), and they are all working fine;
  3. In my opinion, it might be a good time to push a new rockspec to https://luarocks.org/ based on lua-zlib-scm-0.rockspec.

@luau-project
Copy link
Contributor Author

Fixes #73

Copy link
Owner

@brimworks brimworks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@brimworks brimworks merged commit 74bc25e into brimworks:master Mar 30, 2025
19 checks passed
@luau-project luau-project deleted the mingw-w64-windows branch March 30, 2025 13:06
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.

2 participants