lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Am 10.09.2017 um 08:44 schrieb Russell Haley <>:


I am going over the official FreeBSD Lua53 Ports collection files and
wanted to share my thoughts. [groans from the audience] These ports
collections contain the files that are used to patch and build
packages on FreeBSD and are also used to power the binary build
system. Some Ports are better than others and some fall into
disrepair. I have agreed to (attempt) to take on the Lua53 port. The
source files can be found here: [1][2]

Great that you taking care of the Lua 5.3 port.  My first remark is, that the
port does not apply the fixes found on  Maybe
you can fix that.

My synopsis so far is this: From what I can tell, the default Lua
makefile doesn't work on FreeBSD when the freebsd target is called.
Not surprisingly, the FreeBSD port effectively doesn't use the
makefile from the lua tarball. It is heavily patched and it doesn't
seem to use the FreeBSD target.

I think it is fine to use your own Makefile (we do the same in our projects),
but if you find issues with the Makefile distributed with Lua, maybe post
it on the list, so upstream can eventually fix it.

To continue, I have some observations about the "port", some of which
I think are worth bringing up here:

- files/patch-src__Makefile - This patch adds support for *.so files.
Can I ask why there is no built in target for shared objects files in
Lua? I am probably missing something. I checked the tarball and git. I
also tried to look this subject up on the archives but couldn't find
anything. The patch file is here:

Lua is so small, it is usually statically linked.  And then, even the use of
the dynamic linker in Lua is optional, afaict.

- In the main makefile for the port, there are two post-patch
replacements that happen. One is replacing readline with libeditline.
Editline seems to be a default library for FreeBSD if man pages are an
indication: This is
noted more for interest as I think this library plus the patch that
duane provided lends weight to the idea of Lua adding it's own library
and dumping readline altogether.

Isn't readline GPL?  So I understand FreeBSD using sth different.

- The second post patch seems to change rand to random. My question
is: Is this patch necessary, does it affect other platforms, and
should it be pushed upstream?

random() is mentioned as being a "bad random number generator" in the
man page, so why not change it to something really random, if it absolutely
needs be changed?

Also to consider, there are now a number of patches listed for 5.3.4
on the bugs list. My assumption is that those are not in the official
tarball, but ARE in the head revision of the GitHub repo? I'm trying
to find the shortest path to a clean port file so my question is:
would it be easier to manually assemble the patches and continue
including a file and patching the tarball, or is there some merit to
switching over and downloading from GitHub based on a commit?

The patches should definitely make it into the port, they fix real, existing

In conclusion, the failure of the freebsd target in my tests and the
heavy modification to the base makefile leads me to think it might be
worthwhile to switch to GitHub and use the base makefile to
springboard a separate FreeBSD  makefile altogether. Thoughts?

That makes no sense, to create a secondary Lua  repository, it only
means you will have to keep stuff in sync with  Also keep in
mind, that Lua is open source, but it is not developed in the open.

I would pull the tarball from, and have the patches from as local patches.

To be pointed, I think the freebsd target in the Lua makefile should
be fixed or removed. However, this is a separate discussion that
should be had around some of the other build change possibilities in
other threads (see the thread titled "Building Lua 5.3 from on

I am all for fixing.  I am sure upstream will apply this fixes, if they make
sense to them.

Thanks and goodnight,


Thanks for taking care of Lua on FreeBSD; that is appreciated.

- mb

[1] *Note, you must click on the "view" link to see the files
[2] There is a reference to an external file which I have
not found, but found (a point for
those trying to trace).