package/dovecot: fix build with Lua 5.1

Since version 2.4, dovecot's configure defaults to --with-lua=auto and
picks up any Lua found through pkg-config, as long as it is >= 5.1 and
not 5.2. However, src/lib-lua/dlua-iostream.c, also new in 2.4, uses
luaL_Stream, luaL_tolstring() and luaL_fileresult(), which only exist
since Lua 5.2 and are not covered by dovecot's compat layer, so the
build fails when Lua 5.1 happens to be built before dovecot:

  dlua-iostream.c:16:28: error: field 'stream' has incomplete type
  dlua-iostream.c:68:24: error: implicit declaration of function 'luaL_tolstring'; did you mean 'lua_tolstring'? [-Wimplicit-function-declaration]

Handle Lua explicitly: enable it, and add the missing dependency, only
with Lua 5.3/5.4, and pass --without-lua otherwise, which also covers
LuaJIT as it only provides the Lua 5.1 API. This also makes the build
reproducible, as Lua is no longer picked up depending on build order.

This issue has been present since commit 894cbeddaf
("package/dovecot{-pigeonhole}: security bump version to 2.4.5"), as
dovecot 2.3 only enabled Lua when explicitly requested. That commit is
not part of any release yet.

Fixes:
https://autobuild.buildroot.org/results/e4cf30f6ca8b18ac010755bf13fc1d5e92eda575

Fixes: 894cbeddaf ("package/dovecot{-pigeonhole}: security bump version to 2.4.5")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Yegor Yefremov
2026-10-20 09:23:57 +02:00
committed by Thomas Petazzoni
parent 32a2510317
commit 97179e17d4

View File

@@ -89,6 +89,14 @@ else
DOVECOT_CONF_OPTS += --without-pam
endif
# Lua support needs the Lua >= 5.2 API (luaL_Stream, luaL_tolstring...)
ifeq ($(BR2_PACKAGE_LUA)$(BR2_PACKAGE_LUA_5_1),y)
DOVECOT_CONF_OPTS += --with-lua=yes
DOVECOT_DEPENDENCIES += lua
else
DOVECOT_CONF_OPTS += --without-lua
endif
ifeq ($(BR2_PACKAGE_OPENLDAP),y)
DOVECOT_CONF_OPTS += --with-ldap=yes
DOVECOT_DEPENDENCIES += openldap