Skip to content

[package] luajit: add option to enable LUAJIT_ENABLE_LUA52COMPAT #29976

@skhaz

Description

@skhaz

The LuaJIT recipe doesn't expose LUAJIT_ENABLE_LUA52COMPAT as a package option. This flag enables useful Lua 5.2 features like __len, __pairs, and __ipairs metamethods for tables, which are needed for proxy/reactive table patterns.

Right now, the only way to enable it as a consumer is passing -c 'luajit/*:tools.build:cflags=["-DLUAJIT_ENABLE_LUA52COMPAT"]' on every conan install invocation, which means duplicating it across Makefiles, CI workflows, etc. There's no way to set this from a consumer conanfile.py since conf is read-only in recipes.

It would be great to have something like:

options = {"shared": [True, False], "fPIC": [True, False], "lua52compat": [True, False]}
default_options = {"shared": False, "fPIC": True, "lua52compat": False}

The build-side change is straightforward — on Unix it's XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT in the Makefile, and on Windows it's passing lua52compat as an argument to msvcbuild.bat (which already supports it).

This would let consumers simply do:

def configure(self):
    self.options["luajit"].lua52compat = True

instead of having to chase every conan install call site.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions