Page MenuHomeFreeBSD

Uses/ - add flavor support and other options

Authored by on Jul 29 2018, 1:41 AM.
  • Restricted Project
Referenced Files
Unknown Object (File)
Sat, Feb 24, 9:11 AM
Unknown Object (File)
Tue, Feb 20, 8:40 AM
Unknown Object (File)
Thu, Feb 8, 6:00 PM
Unknown Object (File)
Jan 20 2024, 5:51 AM
Unknown Object (File)
Jan 17 2024, 1:32 PM
Unknown Object (File)
Jan 12 2024, 4:38 PM
Unknown Object (File)
Dec 31 2023, 7:49 PM
Unknown Object (File)
Dec 29 2023, 5:20 AM



This adds flavor support to USES=lua, plus some additional options.

The intent is to allow the following:

  1. Lua modules like devel/lua-stdlib-* can be changed to use flavors to keep their dependencies straight, and some helper definitions in make it easier for them to keep their documentation subdirs separate
  2. The lang/lua ports themselves could be changed to use USES=lua:envcore,NN to centralize the definitions of all the LUA_* variables in one place, rather than duplicating them between and lang/luaNN/Makefile
  3. Applications that use Lua probably wouldn't want to use the flavors option, but can now use LUA_FLAVOR when declaring dependencies on libs
  4. More version range options are supported, e.g. USES=lua:52-54 or USES=lua:-53

A functional change is that this version makes no attempt to look at what versions of Lua are already installed - that seems to me to be a very bad idea.

In the process, the following specific changes to ports were needed (or at least highly desirable):

  1. All ports with the lua version included in their name were renamed even if only one version was supported (e.g. lua51-mpd). Ports with version-specific slaves, such as luasocket, were folded into a single port with flavors.

Affected: archivers/lua51-zlib (renamed lua-zlib)
Affected: audio/lua51-mpd (renamed lua-mpd)
Affected: converters/lua51-iconv (renamed lua-iconv)
Affected: devel/lua51-bitop (renamed lua-bitop)
Affected: devel/lua51-cjson (renamed lua-cjson)
Affected: devel/lua51-libevent (renamed lua-libevent)
Affected: devel/luafilesystem-51 (now luafilesystem@lua51)
Affected: net/lualdap-51 (now lualdap@lua51)
Affected: net/luasocket-51 (now luasocket@lua51)
Affected: net/luasocket-53 (now luasocket@lua53)
Affected: security/luasec-51 (now luasec@lua51)
Affected: textproc/luaexpat-51 (now luaexpat@lua51)

  1. Ports that actually failed to build when the lua version was not 5.2 (the current default) had the USES tag updated to explicitly specify 5.2 (or whatever version range applied)

Affected: astro/celestia, audio/aqualung, lang/lua-ada, net/freeswitch, net/lualdap, security/cardpeek, www/volta

  1. Ports for lua modules were changed to use LUA_DOCSDIR, when needed, to install docs into subdirs specific to the lua version.

Affected: audio/lua-mpd
Affected: devel/lua-stdlib
Affected: devel/luafilesystem
Affected: graphics/lua-gd
Affected: net/luasocket

  1. Ports that had OPTIONS for different lua versions were changed to use flavors instead.

Affected: databases/lua-sqlite3, databases/luadbi

  1. Package name prefix added where needed.

Affected: databases/luasql-mysql (and its slaves, luasql-*)

Individual ports:

converters/lua-iconv: Un-deprecate, because the only thing keeping it broken is the failure to update in a timely fashion.

devel/swig30: Downgraded dependency on lua to a build-only dependency (it's not needed at runtime unless the client is also using lua, in which case the client should have its own build dep)

devel/lua-lgi: Take maintainership

math/plplot: fix build with LUA option by adding build dep on swig30

Test Plan

Tested by globally enabling option LUA and disabling LUAJIT, then building (with poudriere, on 12-stable amd64) every port that showed a dependency on lua.

Examined the build logs and package output of key packages and did not see any problems.

Exp-run requested and passed, see #245038

Diff Detail

rP FreeBSD ports repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

233–237 ↗(On Diff #45976)

I am not sure why this test. If you are building lang/luaXY, PORTNAME is lua anyway.

233–237 ↗(On Diff #45976)

You're right, that's unnecessary.

Remove an unnecessary conditional as pointed out by mat.

Remove some not-very-helpful commentary.

I am testing this patch with LuaRocks (as noted in above). I removed all the OPTIONS that I had created which used flavors and added lua:51-54 to my USES:

USES=		gmake uniquefiles lua:51-54

When I attempt to build I get the following error:

russellh@gbsd2 ~/f/p/d/lua-luarocks> make FLAVOR=53
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: warning: String comparison operator should be either == or !=
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: Malformed conditional (${_LUA_MIN_VERSION} <= ${:U54} && ${_LUA_MAX_VERSION} >= ${:U54})
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: warning: String comparison operator should be either == or !=
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: Malformed conditional (${_LUA_MIN_VERSION} <= ${:U53} && ${_LUA_MAX_VERSION} >= ${:U53})
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: warning: String comparison operator should be either == or !=
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: Malformed conditional (${_LUA_MIN_VERSION} <= ${:U52} && ${_LUA_MAX_VERSION} >= ${:U52})
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: warning: String comparison operator should be either == or !=
make: "/usr/home/russellh/freebsd/ports/Mk/Uses/" line 149: Malformed conditional (${_LUA_MIN_VERSION} <= ${:U51} && ${_LUA_MAX_VERSION} >= ${:U51})
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/russellh/freebsd/ports/devel/lua-luarocks

What have I done wrong? It doesn't matter what value I put in the make FLAVOR= command

Also, could this patch be modified to support LuaJIT?

Any breakage is probably my fault - I need to pick this one up again and work on it some more.

As for luajit, there's a problem with proliferation at the moment - it looks like there are two separate live forks now in addition to the original (moribund) project.

19 ↗(On Diff #46437)

I'd be tempted to remove noflavors, since it's the default -- I don't picture too many scenarios where one can/would need to override an earlier specified flavors.

This one includes the changes to the actual ports, plus fixes to a few issues in edited the summary of this revision. (Show Details) edited the test plan for this revision. (Show Details)

Rebase and include fixes.

Note, I'm not 100% sure that all of the portversion bumps are needed, and I'm likewise not 100% sure that there aren't more portversion bumps needed. Almost all of the changes do not actually affect the packages, as far as I can tell.

From discussion just after I posted this, it sounds like math/plplot actually needs a PORTREVISION bump not included in this patch.

Could you change all envcore to simply core, and make it simply say "used when building lua itself".

183 ↗(On Diff #69844)
.  if ${FLAVOR}
201 ↗(On Diff #69844)
246 ↗(On Diff #69844)
249 ↗(On Diff #69844)
16 ↗(On Diff #69844)

Why 51-53, we do not have a 5.0 or a 5.4, and when we get a 5.4, it would be nice to have this build with it. (And maybe restricted if it does not build, but we do not know that yet.)

21 ↗(On Diff #69844)

is ?= still needed?

13 ↗(On Diff #69844)

is ?= still needed?

18 ↗(On Diff #69844)

is ?= still needed?

26 ↗(On Diff #69844)

Has the source magically changed and it now contains 5.2 instead of 5.1?

5 ↗(On Diff #69844)


16 ↗(On Diff #69844)

Why ?=? The slave port has been removed, no?

52–53 ↗(On Diff #69844)

This looks a bit iffy, should it not have a lua:51 here?

14 ↗(On Diff #69844)

No need for ?= any more.

22 ↗(On Diff #69844)

?= not needed.

19 ↗(On Diff #69844)

?= not needed.

183 ↗(On Diff #69844)


(.if !empty(FOO) is pretty common, and .if ${FOO} is ambiguous about whether a string or numeric comparison is intended.)

16 ↗(On Diff #69844)

That one previously had specific options for lua51, lua52, lua53, so this was just a case of not changing the status quo.

26 ↗(On Diff #69844)

The source contains 5.2. The previous REINPLACE_CMD did nothing as a result, which meant that it would only build on 5.2 and not other versions. (This was actually spotted by swills as part of his current crusade against no-op REINPLACE_CMD.)

52–53 ↗(On Diff #69844)

It may be iffy, but it's also not changed by this patch, so that's probably a question for the maintainer. It appears it is using some lua + lpeg script at build time that isn't necessarily related to the run-time plugin support?

183 ↗(On Diff #69844)

Unless I am mistaken, there are no variables containing numerics here.

16 ↗(On Diff #69844)

Well, you did not do this for the other ports that had options, I do not see the need for this one to be special.

52–53 ↗(On Diff #69844)

Yeah, but does it work with and without LUAJIT?

249 ↗(On Diff #69844)

It turns out that that doesn't work, because LUA_DOCSUBDIR may not be defined at all, and if it's not, then a "Malformed conditional" error results.

52–53 ↗(On Diff #69844)


Rebase. Fix most of mat's requests. Make the usage of LUA_VER / LUA_VER_STR a bit more consistent. Allow for the option of lua:build,run if needed. edited the summary of this revision. (Show Details)

Rebase. Un-deprecate lua-iconv, because the only thing keeping it broken is the failure to update in a timely manner.

Fix rebase error that caused a deleted file (lua51-iconv/Makefile) to be revived due to a conflicting trunk commit.

This revision was not accepted when it landed; it landed in state Needs Review.May 18 2020, 8:03 AM
Closed by commit rP531700: USES=lua gained flavors. (authored by mat). · Explain Why
This revision was automatically updated to reflect the committed changes.