#4 Fix for Lua >= 5.3
Closed 3 years ago by robert. Opened 3 years ago by salimma.
rpms/ salimma/lua-socket fix-for-53-and-macros  into  master

file modified
+29 -23
@@ -1,42 +1,36 @@ 

- %if 0%{?fedora} >= 22 || 0%{?rhel} > 7

- %define luaver 5.4

- %else

- %if 0%{?fedora} >= 20

- %define luaver 5.2

- %else

- %define luaver 5.1

- %endif

- %endif

- 

  %define luacompatver 5.1

  %define luacompatlibdir %{_libdir}/lua/%{luacompatver}

  %define luacompatpkgdir %{_datadir}/lua/%{luacompatver}

  %define lua51dir %{_builddir}/lua51-%{name}-%{version}-%{release}

  

- %define lualibdir %{_libdir}/lua/%{luaver}

- %define luapkgdir %{_datadir}/lua/%{luaver}

  %global baseversion 3.0-rc1

  %global upstreamname luasocket

  

  Name:           lua-socket

  Version:        3.0

- Release:        0.25.rc1%{?dist}

+ Release:        0.26.rc1%{?dist}

  Summary:        Network support for the Lua language

  

  License:        MIT

  URL:            http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/

- #Source0:        http://luaforge.net/frs/download.php/2664/luasocket-%{baseversion}.tar.gz

  Source0:        https://github.com/diegonehab/%{upstreamname}/archive/v%{baseversion}.tar.gz

  Patch0:         luasocket-optflags.patch

- # All changes in the upstream repo from %{baseversion} tag to the

+ # All changes in the upstream repo from %%{baseversion} tag to the

  # current master. Seems to be harmless.

  Patch1:         luasocket-no-global-vars.patch

  Patch2:         luasocket-3.0-settimeout.patch

  

  BuildRequires:  gcc

- BuildRequires:  lua >= %{luaver}, lua-devel >= %{luaver}

+ BuildRequires:  lua-devel >= 5.1

  BuildRequires:  /usr/bin/iconv

- Requires:       lua(abi) >= %{luaver}

+ %if 0%{?rhel} && 0%{?rhel} < 8

+ # no automatic lua(abi)

+ Requires:       lua >= 5.1

+ Requires:       lua < 5.2

+ %global lua_libdir %{_libdir}/lua/5.1

+ %global lua_pkgdir %{_datadir}/lua/5.1

+ %endif

+ 

  

  %package devel

  Summary:    Development files for %{name}
@@ -56,6 +50,7 @@ 

  Header files and libraries for building an extension library for the

  Lua using %{name}

  

+ 

  %if 0%{?fedora} >= 20

  %package compat

  Summary:        Network support for the Lua language 5.1
@@ -72,6 +67,7 @@ 

  and FTP. In addition there are modules for MIME, URL handling and LTN12.

  %endif

  

+ 

  %prep

  %setup -q -n %{upstreamname}-%{baseversion}

  %patch0 -p1 -b .optflags
@@ -83,8 +79,13 @@ 

  cp -a . %{lua51dir}

  %endif

  

+ 

  %build

- %make_build LUAV=%{luaver} OPTFLAGS="%{optflags} -fPIC" \

+ # fix for:

+ # /usr/lib64/lua/5.4/socket/core.so: undefined symbol: luaL_checkint

+ # https://github.com/diegonehab/luasocket/issues/124#issuecomment-73561562

+ %make_build LUAV=%{luaver} \

+      OPTFLAGS="%{optflags} -fPIC -DLUA_COMPAT_APIINTCASTS" \

       LDFLAGS="%{?__global_ldflags} -shared -o " linux

  /usr/bin/iconv -f ISO8859-1 -t UTF8 LICENSE >LICENSE.UTF8

  mv -f LICENSE.UTF8 LICENSE
@@ -100,11 +101,11 @@ 

  popd

  %endif

  

+ 

  %install

- rm -rf $RPM_BUILD_ROOT

  make install-unix OPTFLAGS="%{optflags}" INSTALL_TOP=$RPM_BUILD_ROOT \

-     INSTALL_TOP_CDIR=$RPM_BUILD_ROOT%{lualibdir} \

-     INSTALL_TOP_LDIR=$RPM_BUILD_ROOT%{luapkgdir}

+     INSTALL_TOP_CDIR=$RPM_BUILD_ROOT%{lua_libdir} \

+     INSTALL_TOP_LDIR=$RPM_BUILD_ROOT%{lua_pkgdir}

  

  # install development files

  install -d $RPM_BUILD_ROOT%{_includedir}/%{upstreamname}
@@ -123,8 +124,8 @@ 

  %{!?_licensedir:%global license %%doc}

  %license LICENSE

  %doc README doc/*

- %{lualibdir}/*

- %{luapkgdir}/*

+ %{lua_libdir}/*

+ %{lua_pkgdir}/*

  

  %files devel

  %{_includedir}/%{upstreamname}
@@ -138,7 +139,12 @@ 

  %{luacompatpkgdir}/*

  %endif

  

+ 

  %changelog

+ * Fri Aug 28 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.0-0.26.rc1

+ - Fix for Lua >= 5.3

+ - Use standard Lua macros

+ 

  * Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-0.25.rc1

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

  

Also use standard Lua macros

source: https://github.com/diegonehab/luasocket/issues/124#issuecomment-73561562

Without this, trying to run lua-logging's test suite fails on Lua >= 5.3 with:

/usr/lib64/lua/5.4/socket/core.so: undefined symbol: luaL_checkint

Signed-off-by: Michel Alexandre Salim salimma@fedoraproject.org

I've just run into https://bugzilla.redhat.com/show_bug.cgi?id=1873634 (please mention it in the commit message and/or changelog), and looking at the PR, I think you could immediately merge just the fix for the plugin being unloadable (so the "-DLUA_COMPAT_APIINTCASTS" addition), if that's enough.

I've committed the minimal fix to rawhide and F33.

Thank you for the contribution, commit 4c1658 contains a more extensive cleanup and spec file modernization including a run-time test in %check to avoid such failures in the future.

Pull-Request has been closed by robert

3 years ago