alerque/aur

Suggestion for asterisk: use lua package version from system

x5ERZzk opened this issue · 2 comments

Hello,
would it be feasible to configure the build for asterisk to use the lua package version provided by Arch Linux? Currently it uses lua 5.1, but when I build from AUR with only lua (currently: 5.4) package installed it uses exactly this version.
Many thanks for your work!

Thanks for the report. Unfortunately I'm not sure there is anything we can realistically do on the packaging end. The upstream Asterisk build system seems to detect the lowest available version of Lua rather than the highest. While it does sort of work if you build on a system with only a newer Lua, I've seen reports of example configs not working with newer Lua because many of them have 5.1 specific syntax.

Note that the AUR package doesn't actually depend on Lua at all, it is an optional depend because it can function without. For that case you are free to provide whatever Lua you want to try. I assume this report is largely about the pre-built package I provide in the [alerque] repository. For that you do need to match the version of Lua it detected on the build machine. Unfortunately most of my systems have all versions of Lua available, so Asterisk itself is preferring 5.1.

I'll keep this open to look into building on a 5.4 only system, but I have an idea that's going to break some people's configs, possible even the supplied example ones.

Thank you for your valuable input.
Yes, I have experienced breakage within my lua extensions myself - AFAIR every time I have upgraded lua. However all these changes seem logical and necessary for the consistency of the language. Lua 5.1 won't be forever, people will have to eventually update their code. Dependence on the latest lua package also seems to be in the spirit of Arch rolling release model (well, not exactly - on my system there are some packages dependent on lua52).

On my system the order of lua detection looks correct, and with lua52 and lua51 installed it built pbx_lua.so with lua52 dependency.
To build with only lua (currently: 5.4) dependency I have modified configure.ac file and commented out he following lines:

for ver in 5.3 5.2 5.1; do
      AST_EXT_LIB_CHECK([LUA], lua${ver}, [luaL_newstate], lua${ver}/lua.h, [-lm])
      if test "x${PBX_LUA}" = "x1" ; then
              if test x"${LUA_DIR}" = x; then
                      LUA_INCLUDE="${LUA_INCLUDE} -I/usr/include/lua${ver}"
              else
                      LUA_INCLUDE="${LUA_INCLUDE} -I${LUA_DIR}/lua${ver}"
              fi
              break;
      fi
done

then I ran ./bootstrap.sh to regenerate the ./configure script as described in https://wiki.asterisk.org/wiki/display/AST/Build+System+Architecture .

In my opinion the best solution would be to provide two packages - one built for lua51 and the second one for lua.
But I suppose I am asking for too much :) All of this is not a big problem for me - asterisk compiles fast enough on my machine and I can handle a bit of manual maintenance.
So please do whatever you feel is right and of course only if you have some spare time to do it.
Thank you again very much for maintaining your repository.