Skip to contentSkip to conversation

package/dovecot: fix build with Lua 5.1

PATCH New Yegor Yefremov 1 participant 1 message Oct 20

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 894cbeddafddf9322411fcb5257861c1d0df3ea7 ("package/dovecot{-pigeonhole}: security bump version to 2.4.5")
Assisted-by Claude:claude-opus-5-5

---
Note: dovecot's configure accepting Lua 5.1 has been reported upstream, with a patch requiring Lua >= 5.3:
https://github.com/dovecot/core/pull/335

 package/dovecot/dovecot.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/dovecot/dovecot.mk +8 -0
index 74cacc3200..876cff2523 100644
@@ -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
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot