Bug 251688 - mail/opendkim: Fix build with lua > 5.3
Summary: mail/opendkim: Fix build with lua > 5.3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Alexey Dokuchaev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-08 18:16 UTC by Dimitry Andric
Modified: 2021-01-19 03:50 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (freebsd-ports)


Attachments
Fix lua version check in mail/opendkim (1.66 KB, patch)
2020-12-08 18:16 UTC, Dimitry Andric
no flags Details | Diff
Fix lua version check in mail/opendkim (10.38 KB, patch)
2020-12-08 19:45 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer 2020-12-08 18:16:05 UTC
Created attachment 220370 [details]
Fix lua version check in mail/opendkim

Attempting to build mail/opendkim 2.10.3_11 with lua 5.4 installed (i.e. with DEFAULT_VERSIONS+=lua=5.4 in make.conf) leads to warnings and errors:

...
Making all in miltertest
cc -DHAVE_CONFIG_H -I. -I..  -I./../libopendkim -I/usr/include -I/usr/local/include/lua54 -DCONFIG_BASE=\"/usr/local/etc\"  -O2 -pipe -march=haswell  -fstack-protector-strong -fno-strict-aliasing -MT miltertest-miltertest.o -MD -MP -MF .deps/miltertest-miltertest.Tpo -c -o miltertest-miltertest.o `test -f 'miltertest.c' || echo './'`miltertest.c
miltertest.c:4016:2: warning: implicit declaration of function 'luaL_register' is invalid in C99 [-Wimplicit-function-declaration]
        luaL_register(l, "mt", mt_library);
        ^
miltertest.c:4171:54: error: too few arguments to function call, expected 5, have 4
                         script == NULL ? "(stdin)" : script))
                                                            ^
/usr/local/include/lua54/lua.h:289:1: note: 'lua_load' declared here
LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
^
/usr/local/include/lua54/luaconf.h:292:18: note: expanded from macro 'LUA_API'
#define LUA_API         extern
                        ^
1 warning and 1 error generated.
*** Error code 1

This is because ports r488837 changed the #if statements in this file, but didn't use >= to check for any version of lua >= 5.2.

Attached patch will make it all work for a while, until lua messes up their API again.
Comment 1 Dimitry Andric freebsd_committer 2020-12-08 19:45:47 UTC
Created attachment 220373 [details]
Fix lua version check in mail/opendkim

It turns out the code is even more riddled with bad version checks, so I had to patch a few additional ones. I went over them mechanically, and successfully built the port in a poudriere jail with it.
Comment 2 commit-hook freebsd_committer 2021-01-19 03:46:44 UTC
A commit references this bug:

Author: danfe
Date: Tue Jan 19 03:46:02 UTC 2021
New revision: 562018
URL: https://svnweb.freebsd.org/changeset/ports/562018

Log:
  Fix Lua version checks and thus unbreak the build against Lua 5.4.

  PR:		251688
  Submitted by:	dim

Changes:
  head/mail/opendkim/files/patch-miltertest_miltertest.c
  head/mail/opendkim/files/patch-opendkim_opendkim-lua.c
Comment 3 Alexey Dokuchaev freebsd_committer 2021-01-19 03:50:30 UTC
Committed as ports r562018, thank you very much!