# Lua53 Port Maintenance



## dinsdale (Sep 12, 2017)

Hi,

I'm looking at picking up the Lua53 port and it seems there is quite a bit going in in there. I typically have been avoiding the port and building it myself on 12-Current (Arm and TrueOS). My patches are usually pretty minor to get the tarball from the Lua site running. 

I'm on the Lua-l mailing list and have also been discussing the state of the standard makefile. There is a freebsd target, but it doesn't work and I will try and fix that upstream. 

I also have some questions about some of the things I'm seeing in the port makefile and was wondering if anybody has any background:

- There is a section of comment in the Makefile at lines 47-56:

```
# Cope with the lack of support for Lua 5.2 in bsd.lua.mk.  These
# overrides, which are required below, should be removed once bsd.lua.mk
# understands this lua version.
LUA_PREFIX?=   ${PREFIX}
LUA_SUBDIR?=   lua${PKGNAMESUFFIX}
LUA_INCDIR?=   ${LUA_PREFIX}/include/${LUA_SUBDIR}
LUA_LIBDIR?=   ${LUA_PREFIX}/lib
```
I'm not really sure what that means. From what I can tell, the bsd.lua.mk file has been moved as Mk/Uses/lua.mk and that file seems to handle all versions of lua just fine? I have noted this because modifying that file will be important for lua54 (which is not far off I don't think). 

- pthread - The Makefile links to pthread. Do we really want to do that? A discussion about a fedora package concluded that was a bad idea.
http://lua-users.org/lists/lua-l/2017-08/msg00021.html
http://lua-users.org/lists/lua-l/2017-08/msg00028.html

I've never needed it and there are ways to get threading in Lua. Even better, there are packages that use kqueues like cqueues and luasys. 

- There is a post patch replacement of rand for random in lmathlib.c. Someone on lua-l pointed out that the replacement on line 32 is unreachable code if `LUA_USE_POSIX` is defined. The Port Makefile uses `LUA_USE_LINUX` (grrrr. working on that upstream), which includes `LUA_USE_POSIX`. Ergo, the replacement is unnecessary.

- There is a post patch replacement of editline for readline. I have briefly looked over the files and think that these replacements are at the head of the files and can easily be put into a patch. This is especially true as the code is stable and only referenced in stable apis in the entry/egress points to the system. I think this should be converted to a proper patch so it's more easily recognizable and maintainable (IMHO). 

- Finally, I'd like to reach across the floor to the other BSDs and OpenIndiana about getting the BSD support for Lua cleaned up. I don't know if there is a good (read easy, low impact on me) way of doing that. Any suggestions would be great. 

Cheers, 
Dinsdale


----------



## xavi (Sep 12, 2017)

dinsdale said:


> Finally, I'd like to reach across the floor to the other BSDs and OpenIndiana about getting the BSD support for Lua cleaned up. I don't know if there is a good (read easy, low impact on me) way of doing that. Any suggestions would be great.



I don't use Lua, but I do have plans to at some point as it seems to be an interesting language. So, thank you for doing this. Hopefully at some point I'll reap the benefit of your work. And just in case you're not already aware, there's a talk at EuroBSDCon this year entitled 'Lua in NetBSD: Scripting the Operating System with a Dynamic, Programming Language' by Marc Balmer. It might be worth pinging Marc for assistance. You can find some information about the talk on this page: https://2017.eurobsdcon.org/talk-speakers/


----------

