[vlc-devel] [PATCH v2 5/6] contrib: lua: autodetect lua >= 5.1

Steve Lhomme robux4 at ycbcr.xyz
Wed Nov 18 09:43:35 CET 2020


On 2020-11-16 11:05, Alexandre Janniaux wrote:
> Hi,
> 
> On Mon, Nov 16, 2020 at 07:56:06AM +0100, Steve Lhomme wrote:
>> On 2020-11-14 16:30, Alexandre Janniaux wrote:
>>> When building on ArchLinux currently, the contrib was built even if
>>> lua5.3 is installed. As at least Archlinux and Debian are exposing both
>>> a luaX.Y.pc and lua.pc file for the latest supported version of lua,
>>> detecting that the system version is correct through lua.pc should
>>> also ensure that the latest compatible version is installed and used
>>> instead.
>>>
>>> The other checks are still needed as you can for example install lua5.2
>>> (which will expose a lua5.2.pc file but no lua.pc file) without having
>>> to install lua (5.3).
>>>
>>> It is worth noticing that being able to use lua >= 5.1 doesn't mean any
>>> version of lua >= 5.1 would be compatible. The source code is completely
>>> compliant to those version and native builds will have no issues with
>>> using a more recent version, but cross-compilation environment for 32bit
>>> environment from a 64bit one won't and need the appropriate version to
>>> be installed.
>>
>> I think that's the whole point. We only want to compile with Lua 5.2. If Lua
>> 8.12 is available on the system we are not going to use it properly.
> 
> We don't do that for other libraries. The point is to run with the one
> you link against. If maintainers link against an invalid lua version
> then it would fail just like if you update a library that is not
> compatible with VLC.
> 
> The error could be at runtime for lua though, instead of loading time,
> because a script would fail, which could movtivate a pinned version on
> the maintainer, but this is irrelevant in the contrib rules: order
> doesn't matter here.
> 
> However, it's correctly handled within the configure script: if you
> compile with lua5.2 available, it will always use the lua5.2 version,
> and same with lua5.1. If you compile against liblua, it will use liblua
> regardless of the version >= 5.1 like other libraries we use.

OK, I didn't realize the configure script allowed versions above 5.2. So 
as long as the version checking/requirements are coherent between the 
contrib and the configure that's fine with me.

> Note that typically the header/library probe is not checking the
> version already, so currently not only it would use my lua library on
> the system, but in addition it would compile the contrib and use the
> headers in contrib, leading to linkage errors.
> 
> Regards,
> --
> Alexandre Janniaux
> Videolabs
> 
> 
>>> ---
>>>    contrib/src/lua/rules.mak | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/contrib/src/lua/rules.mak b/contrib/src/lua/rules.mak
>>> index 491353b484..c64eb6299d 100644
>>> --- a/contrib/src/lua/rules.mak
>>> +++ b/contrib/src/lua/rules.mak
>>> @@ -28,6 +28,9 @@ endif
>>>    # Feel free to add autodetection if you need to...
>>>    PKGS += lua luac
>>>    PKGS_ALL += luac
>>> +ifeq ($(call need_pkg,"lua >= 5.1"),)
>>> +PKGS_FOUND += lua luac
>>> +endif
>>>    ifeq ($(call need_pkg,"lua5.2"),)
>>>    PKGS_FOUND += lua luac
>>>    endif
>>> --
>>> 2.29.2
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list