[asterisk] fix for lua 5.2

Tom Callaway spot at fedoraproject.org
Fri May 10 16:31:36 UTC 2013


commit f962b64a8092d2751af3c1919f34a30f3c7e5500
Author: Tom Callaway <spot at fedoraproject.org>
Date:   Fri May 10 12:31:02 2013 -0400

    fix for lua 5.2

 asterisk-11.3.0-lua-5.2.patch |   52 +++++++++++++++++++++++++++++++++++++++++
 asterisk.spec                 |   12 +++++++--
 2 files changed, 61 insertions(+), 3 deletions(-)
---
diff --git a/asterisk-11.3.0-lua-5.2.patch b/asterisk-11.3.0-lua-5.2.patch
new file mode 100644
index 0000000..6cc4c7e
--- /dev/null
+++ b/asterisk-11.3.0-lua-5.2.patch
@@ -0,0 +1,52 @@
+diff -up asterisk-11.3.0/configure.ac.lua-52 asterisk-11.3.0/configure.ac
+--- asterisk-11.3.0/configure.ac.lua-52	2013-05-10 12:15:50.248880769 -0400
++++ asterisk-11.3.0/configure.ac	2013-05-10 12:15:59.435880440 -0400
+@@ -2096,7 +2096,7 @@ if test "x${PBX_LUA}" = "x1" ; then
+ fi
+ 
+ # Some distributions (like SuSE) remove the 5.1 suffix.
+-AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
++AST_EXT_LIB_CHECK([LUA], [lua], [luaL_openlib], [lua.h], [-lm])
+ 
+ AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
+ 
+diff -up asterisk-11.3.0/configure.lua-52 asterisk-11.3.0/configure
+--- asterisk-11.3.0/configure.lua-52	2013-05-10 12:15:41.700881074 -0400
++++ asterisk-11.3.0/configure	2013-01-30 12:46:52.000000000 -0500
+@@ -26245,7 +26245,7 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_
+       	 pbxlibdir="-L${LUA_DIR}"
+       fi
+    fi
+-   pbxfuncname="luaL_register"
++   pbxfuncname="luaL_openlib"
+    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+       AST_LUA_FOUND=yes
+    else
+diff -up asterisk-11.3.0/pbx/pbx_lua.c.lua-52 asterisk-11.3.0/pbx/pbx_lua.c
+--- asterisk-11.3.0/pbx/pbx_lua.c.lua-52	2013-05-10 12:24:03.873863124 -0400
++++ asterisk-11.3.0/pbx/pbx_lua.c	2013-05-10 12:24:08.069862974 -0400
+@@ -873,8 +873,11 @@ static int lua_sort_extensions(lua_State
+ 		 * table in the extensions_order table */
+ 		for (lua_pushnil(L); lua_next(L, context); lua_pop(L, 1)) {
+ 			int exten = lua_gettop(L) - 1;
+-
++#if LUA_VERSION_NUM < 502
+ 			lua_pushinteger(L, lua_objlen(L, context_order) + 1);
++#else
++			lua_pushinteger(L, lua_rawlen(L, context_order) + 1);
++#endif
+ 			lua_pushvalue(L, exten);
+ 			lua_settable(L, context_order);
+ 		}
+@@ -1508,7 +1511,11 @@ static int lua_find_extension(lua_State
+ 	context_order_table = lua_gettop(L);
+ 	
+ 	/* step through the extensions looking for a match */
++#if LUA_VERSION_NUM < 502
+ 	for (i = 1; i < lua_objlen(L, context_order_table) + 1; i++) {
++#else
++	for (i = 1; i < lua_rawlen(L, context_order_table) + 1; i++) {
++#endif
+ 		int e_index_copy, match = 0;
+ 		const char *e;
+ 
diff --git a/asterisk.spec b/asterisk.spec
index fa53bc6..fc9b0cf 100644
--- a/asterisk.spec
+++ b/asterisk.spec
@@ -31,7 +31,7 @@
 Summary: The Open Source PBX
 Name: asterisk
 Version: 11.3.0
-Release: 1%{?_rc:.rc%{_rc}}%{?_beta:.beta%{_beta}}%{?dist}
+Release: 2%{?_rc:.rc%{_rc}}%{?_beta:.beta%{_beta}}%{?dist}
 License: GPLv2
 Group: Applications/Internet
 URL: http://www.asterisk.org/
@@ -48,6 +48,8 @@ Patch1:  0001-Modify-modules.conf-so-that-different-voicemail-modu.patch
 Patch2:  0002-Fix-up-some-paths.patch
 Patch3:  0003-Add-LDAP-schema-that-is-compatible-with-Fedora-Direc.patch
 
+Patch10: asterisk-11.3.0-lua-5.2.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
 
 BuildRequires: autoconf
@@ -494,6 +496,7 @@ local filesystem.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch10 -p1 -b .lua-52
 
 cp %{S:3} menuselect.makedeps
 cp %{S:4} menuselect.makeopts
@@ -566,8 +569,8 @@ chmod -x contrib/scripts/dbsep.cgi
 %global ldflags -m%{__isa_bits} -Wl,--as-needed,--library-path=%{_libdir}
 %endif
 
-export CFLAGS="%{optflags}"
-export CXXFLAGS="%{optflags}"
+export CFLAGS="%{optflags} -DLUA_COMPAT_MODULE"
+export CXXFLAGS="%{optflags} -DLUA_COMPAT_MODULE"
 export FFLAGS="%{optflags}"
 export LDFLAGS="%{ldflags}"
 
@@ -1391,6 +1394,9 @@ fi
 %{_libdir}/asterisk/modules/app_voicemail_plain.so
 
 %changelog
+* Fri May 10 2013 Tom Callaway <spot at fedoraproject.org> - 11.3.0-2
+- fix build with lua 5.2
+
 * Tue Apr 23 2013 Jeffrey Ollie <jeff at ocjtech.us> - 11.3.0-1:
 - The Asterisk Development Team has announced the release of Asterisk 11.3.0.
 - This release is available for immediate download at


More information about the scm-commits mailing list