Skip to content

rockspec: propagate CMake options#82

Merged
ligurio merged 1 commit intomasterfrom
ligurio/gh-xxxx-define-dirs-rockspec
Apr 7, 2026
Merged

rockspec: propagate CMake options#82
ligurio merged 1 commit intomasterfrom
ligurio/gh-xxxx-define-dirs-rockspec

Conversation

@ligurio
Copy link
Copy Markdown
Owner

@ligurio ligurio commented Mar 27, 2026

@ligurio ligurio force-pushed the ligurio/gh-xxxx-define-dirs-rockspec branch from 288a07e to 09a22e4 Compare March 27, 2026 12:22
ligurio added a commit to ligurio/oss-fuzz that referenced this pull request Mar 27, 2026
Will gone after merging
ligurio/luzer#82
@ligurio ligurio force-pushed the ligurio/gh-xxxx-define-dirs-rockspec branch from 48c0b51 to 9231e3c Compare March 27, 2026 12:33
ligurio added a commit to ligurio/oss-fuzz that referenced this pull request Mar 27, 2026
Will gone after merging
ligurio/luzer#82
@ligurio ligurio force-pushed the ligurio/gh-xxxx-define-dirs-rockspec branch 4 times, most recently from c9c1315 to 6c4c5ed Compare March 27, 2026 15:25
ligurio added a commit to ligurio/oss-fuzz that referenced this pull request Mar 27, 2026
Will gone after merging
ligurio/luzer#82
ligurio added a commit to ligurio/oss-fuzz that referenced this pull request Mar 27, 2026
Will gone after merging
ligurio/luzer#82
ligurio added a commit to ligurio/oss-fuzz that referenced this pull request Mar 27, 2026
Will gone after merging
ligurio/luzer#82
ligurio added a commit to ligurio/oss-fuzz that referenced this pull request Mar 27, 2026
Will gone after merging
ligurio/luzer#82
Copy link
Copy Markdown
Collaborator

@Buristan Buristan left a comment

Choose a reason for hiding this comment

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

LGTM, with a minor nit below.

Sometimes one need to compile a luzer module with a non-system Lua

Typo: s/need/needs/

@ligurio ligurio force-pushed the ligurio/gh-xxxx-define-dirs-rockspec branch from d4cdf45 to a752226 Compare April 6, 2026 16:58
@ligurio
Copy link
Copy Markdown
Owner Author

ligurio commented Apr 6, 2026

The patch can be tested with patch below:

--- a/luzer-scm-1.rockspec
+++ b/luzer-scm-1.rockspec
@@ -2,7 +2,7 @@ package = "luzer"
 version = "scm-1"
 source = {
     url = "git+https://github.com/ligurio/luzer",
-    branch = "master",
+    branch = "ligurio/gh-xxxx-define-dirs-rockspec",
 }
 
 description = {
luarocks install --lua-version 5.1 --verbose --tree=lua_modules luzer-scm-1.rockspec ENABLE_LUAJIT=ON LUAJIT_FRIENDLY_MODE=ON

@ligurio ligurio requested a review from Buristan April 6, 2026 17:01
@ligurio ligurio changed the title rockspec: define directories with headers and lib rockspec: rockspec: propagate CMake options Apr 6, 2026
@ligurio ligurio changed the title rockspec: rockspec: propagate CMake options rockspec: propagate CMake options Apr 6, 2026
@ligurio ligurio force-pushed the ligurio/gh-xxxx-define-dirs-rockspec branch 7 times, most recently from 8111c89 to 7c4e79f Compare April 7, 2026 10:38
Sometimes one needs to build a luzer module using rockspec with
a non-system Lua library and headers or set other CMake options
before building. The patch adds variables for the rockspec to set
the following CMake options via environment variables:
ENABLE_LUAJIT, LUAJIT_FRIENDLY_MODE and OSS_FUZZ:

luarocks install --tree=lua_modules luzer-scm-1.rockspec \
  ENABLE_LUAJIT=ON LUAJIT_FRIENDLY_MODE=ON

The patch also renames CMake variables used for setting a custom
Lua library and Lua include directory: LUA_LIBRARIES to
CMAKE_LUA_LIBRARIES and LUA_INCLUDE_DIR to CMAKE_LUA_INCLUDE_DIR.
This is needed because with empty environment variables
LUA_LIBRARIES and LUA_INCLUDE_DIR passed to luarocks breaks CMake
module for finding Lua package:

CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) (Required is at least version "5.1")
Call Stack (most recent call first):
  /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.28/Modules/FindLua.cmake:236 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:49 (find_package)

After renaming these options can be specified for luarocks.
The patch also sorts variables in alphabetical order.

Needed for google/oss-fuzz#14610
@ligurio ligurio force-pushed the ligurio/gh-xxxx-define-dirs-rockspec branch from 7c4e79f to 6f9c893 Compare April 7, 2026 10:43
@ligurio ligurio merged commit 2a58b8a into master Apr 7, 2026
18 checks passed
@ligurio ligurio deleted the ligurio/gh-xxxx-define-dirs-rockspec branch April 7, 2026 10:45
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