summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPitBall2015-11-10 19:46:35 +0100
committerPitBall2015-11-10 19:46:35 +0100
commitd42a52e7f9adeb43c1dc1a41bd132e9a23aa86d0 (patch)
tree0404794b06f3d5e7ba9fb2658c196fdc5627ab12
downloadaur-d42a52e7f9adeb43c1dc1a41bd132e9a23aa86d0.tar.gz
Initial import
-rw-r--r--.SRCINFO46
-rw-r--r--000-luabind-0.9.1-boost149fix.patch56
-rw-r--r--001-luabind-use-lua_compare.patch117
-rw-r--r--002-luabind-deprecated-LUA_GLOBALSINDEX.patch239
-rw-r--r--003-luabind-use-lua_rawlen.patch130
-rw-r--r--004-luabind-getsetuservalue.patch65
-rw-r--r--005-luabind-lua_resume_extra_param.patch41
-rw-r--r--006-luabind-luaL_newstate.patch140
-rw-r--r--007-luabind-lua-52-fix-test.patch31
-rw-r--r--008-luabind-lua_pushglobaltable.patch75
-rw-r--r--009-luabind-0.9.1-boost157fix.patch22
-rw-r--r--PKGBUILD59
12 files changed, 1021 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..b3332bf1970
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,46 @@
+# Generated by mksrcinfo v8
+# Tue Nov 10 18:46:15 UTC 2015
+pkgbase = lua52bind
+ pkgdesc = A library that helps you create bindings between C++ and Lua52
+ pkgver = 0.9.1
+ pkgrel = 1
+ url = http://www.rasterbar.com/products/luabind.html
+ arch = i686
+ arch = x86_64
+ license = MIT
+ makedepends = unzip
+ makedepends = boost
+ makedepends = boost-build
+ depends = lua52
+ depends = gcc-libs
+ conflicts = luabind
+ conflicts = lua51bind
+ conflicts = lua53bind
+ replaces = luabind
+ replaces = lua51bind
+ replaces = lua53bind
+ source = http://downloads.sourceforge.net/luabind/luabind-0.9.1.tar.gz
+ source = 000-luabind-0.9.1-boost149fix.patch
+ source = 001-luabind-use-lua_compare.patch
+ source = 002-luabind-deprecated-LUA_GLOBALSINDEX.patch
+ source = 003-luabind-use-lua_rawlen.patch
+ source = 004-luabind-getsetuservalue.patch
+ source = 005-luabind-lua_resume_extra_param.patch
+ source = 006-luabind-luaL_newstate.patch
+ source = 007-luabind-lua-52-fix-test.patch
+ source = 008-luabind-lua_pushglobaltable.patch
+ source = 009-luabind-0.9.1-boost157fix.patch
+ md5sums = 8a323fb51d07dad5cfdb12c432793d55
+ md5sums = b7315e791201c8f737702a7ccc8e3d69
+ md5sums = f946eda70f37b623fc6d2dc00cc9d330
+ md5sums = 69a6dfea8dd6143601d2b537b55feafa
+ md5sums = 3c94f13cdb5e4cc450bcba7421529ec8
+ md5sums = d3611164a4ecb80c62f540f54e00ac05
+ md5sums = 47302600179f5aa9e1934f8a20dffc1f
+ md5sums = c49bf430a89d44a3602cb44f2826318a
+ md5sums = e6818960faabf4d2e98d621492279533
+ md5sums = 4d0624aa94394c6f17307ea69c6a7387
+ md5sums = a64c06783893c92cd58ef99ce4e94a08
+
+pkgname = lua52bind
+
diff --git a/000-luabind-0.9.1-boost149fix.patch b/000-luabind-0.9.1-boost149fix.patch
new file mode 100644
index 00000000000..a4f38a5843a
--- /dev/null
+++ b/000-luabind-0.9.1-boost149fix.patch
@@ -0,0 +1,56 @@
+diff -up luabind-0.9.1/luabind/detail/call_function.hpp.boost luabind-0.9.1/luabind/detail/call_function.hpp
+--- luabind-0.9.1/luabind/detail/call_function.hpp.boost 2013-01-14 12:56:44.024217074 -0500
++++ luabind-0.9.1/luabind/detail/call_function.hpp 2013-01-14 12:57:18.598223390 -0500
+@@ -323,7 +323,8 @@ namespace luabind
+
+ #endif // LUABIND_CALL_FUNCTION_HPP_INCLUDED
+
+-#elif BOOST_PP_ITERATION_FLAGS() == 1
++#else
++#if BOOST_PP_ITERATION_FLAGS() == 1
+
+ #define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
+ #define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
+@@ -440,4 +441,4 @@ namespace luabind
+
+
+ #endif
+-
++#endif
+diff -up luabind-0.9.1/luabind/detail/call_member.hpp.boost luabind-0.9.1/luabind/detail/call_member.hpp
+--- luabind-0.9.1/luabind/detail/call_member.hpp.boost 2013-01-14 12:59:09.825244981 -0500
++++ luabind-0.9.1/luabind/detail/call_member.hpp 2013-01-14 12:59:34.069252456 -0500
+@@ -316,7 +316,8 @@ namespace luabind
+
+ #endif // LUABIND_CALL_MEMBER_HPP_INCLUDED
+
+-#elif BOOST_PP_ITERATION_FLAGS() == 1
++#else
++#if BOOST_PP_ITERATION_FLAGS() == 1
+
+ #define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
+ #define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
+@@ -360,4 +361,4 @@ namespace luabind
+ #undef LUABIND_TUPLE_PARAMS
+
+ #endif
+-
++#endif
+diff -up luabind-0.9.1/luabind/wrapper_base.hpp.boost luabind-0.9.1/luabind/wrapper_base.hpp
+--- luabind-0.9.1/luabind/wrapper_base.hpp.boost 2013-01-14 12:59:47.984261884 -0500
++++ luabind-0.9.1/luabind/wrapper_base.hpp 2013-01-14 13:00:05.707268014 -0500
+@@ -89,7 +89,8 @@ namespace luabind
+
+ #endif // LUABIND_WRAPPER_BASE_HPP_INCLUDED
+
+-#elif BOOST_PP_ITERATION_FLAGS() == 1
++#else
++#if BOOST_PP_ITERATION_FLAGS() == 1
+
+ #define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
+ #define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
+@@ -188,3 +189,4 @@ namespace luabind
+ #undef N
+
+ #endif
++#endif
diff --git a/001-luabind-use-lua_compare.patch b/001-luabind-use-lua_compare.patch
new file mode 100644
index 00000000000..442653602f5
--- /dev/null
+++ b/001-luabind-use-lua_compare.patch
@@ -0,0 +1,117 @@
+From b61d233ac2a1d30a38bc56d54e602a9653fb6b4a Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 12:37:51 -0500
+Subject: [PATCH] Lua 5.2: replace lua_equal and lua_lessthan with lua_compare
+
+http://www.lua.org/manual/5.2/manual.html#8.3
+
+http://www.lua.org/manual/5.2/manual.html#lua_compare
+---
+ doc/docs.rst | 2 +-
+ luabind/object.hpp | 20 ++++++++++++++++----
+ src/create_class.cpp | 9 +++++++--
+ 3 files changed, 24 insertions(+), 7 deletions(-)
+
+diff --git a/doc/docs.rst b/doc/docs.rst
+index d9543a6..61a1bce 100755
+--- a/doc/docs.rst
++++ b/doc/docs.rst
+@@ -1116,7 +1116,7 @@ The ``interpreter()`` function returns the Lua state where this object is stored
+ If you want to manipulate the object with Lua functions directly you can push
+ it onto the Lua stack by calling ``push()``.
+
+-The operator== will call lua_equal() on the operands and return its result.
++The operator== will call lua_compare() on the operands and return its result.
+
+ The ``is_valid()`` function tells you whether the object has been initialized
+ or not. When created with its default constructor, objects are invalid. To make
+diff --git a/luabind/object.hpp b/luabind/object.hpp
+index f7b7ca5..106c2e2 100644
+--- a/luabind/object.hpp
++++ b/luabind/object.hpp
+@@ -45,6 +45,12 @@
+ #include <boost/preprocessor/iteration/iterate.hpp>
+ #include <boost/utility/enable_if.hpp>
+
++#if LUA_VERSION_NUM < 502
++# define lua_compare(L, index1, index2, fn) fn(L, index1, index2)
++# define LUA_OPEQ lua_equal
++# define LUA_OPLT lua_lessthan
++#endif
++
+ namespace luabind {
+
+ namespace detail
+@@ -208,11 +214,11 @@
+ detail::stack_pop pop2(L, 1); \
+ detail::push(L, rhs); \
+ \
+- return fn(L, -1, -2) != 0; \
++ return lua_compare(L, -1, -2, fn) != 0; \
+ }
+
+-LUABIND_BINARY_OP_DEF(==, lua_equal)
+-LUABIND_BINARY_OP_DEF(<, lua_lessthan)
++LUABIND_BINARY_OP_DEF(==, LUA_OPEQ)
++LUABIND_BINARY_OP_DEF(<, LUA_OPLT)
+
+ template<class ValueWrapper>
+ std::ostream& operator<<(std::ostream& os
+@@ -523,7 +529,7 @@
+ detail::stack_pop pop(m_interpreter, 2);
+ m_key.push(m_interpreter);
+ other.m_key.push(m_interpreter);
+- return lua_equal(m_interpreter, -2, -1) != 0;
++ return lua_compare(m_interpreter, -2, -1, LUA_OPEQ) != 0;
+ }
+
+ adl::iterator_proxy<AccessPolicy> dereference() const
+@@ -1406,5 +1412,11 @@ object property(GetValueWrapper const& get, SetValueWrapper const& set)
+
+ } // namespace luabind
+
++#if LUA_VERSION_NUM < 502
++# undef lua_compare
++# undef LUA_OPEQ
++# undef LUA_OPLT
++#endif
++
+ #endif // LUABIND_OBJECT_050419_HPP
+
+diff --git a/src/create_class.cpp b/src/create_class.cpp
+index c0eb719..9800c15 100755
+--- a/src/create_class.cpp
++++ b/src/create_class.cpp
+@@ -26,6 +26,11 @@
+
+ #include <luabind/luabind.hpp>
+
++#if LUA_VERSION_NUM < 502
++# define lua_compare(L, index1, index2, fn) fn(L, index1, index2)
++# define LUA_OPEQ lua_equal
++#endif
++
+ namespace luabind { namespace detail
+ {
+ namespace
+@@ -40,7 +45,7 @@
+ while (lua_next(L, -2))
+ {
+ lua_pushstring(L, "__init");
+- if (lua_equal(L, -1, -3))
++ if (lua_compare(L, -1, -3, LUA_OPEQ))
+ {
+ lua_pop(L, 2);
+ continue;
+@@ -48,7 +53,7 @@
+ else lua_pop(L, 1); // __init string
+
+ lua_pushstring(L, "__finalize");
+- if (lua_equal(L, -1, -3))
++ if (lua_compare(L, -1, -3, LUA_OPEQ))
+ {
+ lua_pop(L, 2);
+ continue;
+--
+1.8.1.6
+
diff --git a/002-luabind-deprecated-LUA_GLOBALSINDEX.patch b/002-luabind-deprecated-LUA_GLOBALSINDEX.patch
new file mode 100644
index 00000000000..cd81e519b38
--- /dev/null
+++ b/002-luabind-deprecated-LUA_GLOBALSINDEX.patch
@@ -0,0 +1,239 @@
+From f077a88d8dd9011dd66bc5ef560f4ad22464063e Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 13:26:35 -0500
+Subject: [PATCH] Lua 5.2: replace occurrences of deprecated LUA_GLOBALSINDEX
+
+Use lua_getglobal and lua_setglobal to retrieve and set globals.
+
+Use lua_rawgeti with LUA_RIDX_GLOBALS to retrieve table of globals.
+
+http://www.lua.org/manual/5.2/manual.html#8.3
+
+http://www.lua.org/manual/5.2/manual.html#4.5
+
+This commit drops support for Lua 5.0, since Luabind is incompatible
+with Lua 5.0 anyway, e.g. commit 7dc37f9 requires lua_Integer added
+in Lua 5.1.
+---
+ luabind/detail/call_function.hpp | 6 ++----
+ luabind/object.hpp | 4 ++++
+ src/class_rep.cpp | 17 ++++++-----------
+ src/create_class.cpp | 5 ++---
+ src/open.cpp | 9 +++------
+ src/scope.cpp | 12 +++++++-----
+ test/benchmark.cpp | 3 +--
+ test/test_free_functions.cpp | 3 +--
+ 8 files changed, 26 insertions(+), 33 deletions(-)
+
+diff --git a/luabind/detail/call_function.hpp b/luabind/detail/call_function.hpp
+index 1b45ec1..885e08f 100644
+--- a/luabind/detail/call_function.hpp
++++ b/luabind/detail/call_function.hpp
+@@ -346,8 +346,7 @@
+ , luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
+ , luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
+
+- lua_pushstring(L, name);
+- lua_gettable(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, name);
+
+ return proxy_type(L, 1, &detail::pcall, args);
+ }
+@@ -389,8 +388,7 @@
+ , luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
+ , luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
+
+- lua_pushstring(L, name);
+- lua_gettable(L, LUA_GLOBALSINDEX);
++ lua_getglobal(L, name);
+
+ return proxy_type(L, 1, &detail::resume_impl, args);
+ }
+diff --git a/luabind/object.hpp b/luabind/object.hpp
+index 106c2e2..698d236 100644
+--- a/luabind/object.hpp
++++ b/luabind/object.hpp
+@@ -1213,7 +1213,11 @@ inline object newtable(lua_State* interpreter)
+ // this could be optimized by returning a proxy
+ inline object globals(lua_State* interpreter)
+ {
++#if LUA_VERSION_NUM >= 502
++ lua_rawgeti(interpreter, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
++#else
+ lua_pushvalue(interpreter, LUA_GLOBALSINDEX);
++#endif
+ detail::stack_pop pop(interpreter, 1);
+ return object(from_stack(interpreter, -1));
+ }
+diff --git a/src/class_rep.cpp b/src/class_rep.cpp
+index 70bb623..5f03f39 100755
+--- a/src/class_rep.cpp
++++ b/src/class_rep.cpp
+@@ -146,11 +146,10 @@ int luabind::detail::class_rep::constructor_dispatcher(lua_State* L)
+ && cls->get_class_type() == class_rep::lua_class
+ && !cls->bases().empty())
+ {
+- lua_pushstring(L, "super");
+ lua_pushvalue(L, 1);
+- lua_pushvalue(L, -3);
++ lua_pushvalue(L, -2);
+ lua_pushcclosure(L, super_callback, 2);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "super");
+ }
+
+ lua_pushvalue(L, -1);
+@@ -169,9 +168,8 @@ int luabind::detail::class_rep::constructor_dispatcher(lua_State* L)
+
+ if (super_deprecation_disabled)
+ {
+- lua_pushstring(L, "super");
+ lua_pushnil(L);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "super");
+ }
+
+ return 1;
+@@ -214,17 +212,15 @@ int luabind::detail::class_rep::super_callback(lua_State* L)
+
+ if (base->bases().empty())
+ {
+- lua_pushstring(L, "super");
+ lua_pushnil(L);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "super");
+ }
+ else
+ {
+- lua_pushstring(L, "super");
+ lua_pushlightuserdata(L, base);
+ lua_pushvalue(L, lua_upvalueindex(2));
+ lua_pushcclosure(L, super_callback, 2);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "super");
+ }
+
+ base->get_table(L);
+@@ -241,9 +237,8 @@ int luabind::detail::class_rep::super_callback(lua_State* L)
+ // TODO: instead of clearing the global variable "super"
+ // store it temporarily in the registry. maybe we should
+ // have some kind of warning if the super global is used?
+- lua_pushstring(L, "super");
+ lua_pushnil(L);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "super");
+
+ return 0;
+ }
+diff --git a/src/create_class.cpp b/src/create_class.cpp
+index 9800c15..738cf9b 100755
+--- a/src/create_class.cpp
++++ b/src/create_class.cpp
+@@ -131,9 +131,8 @@
+ new(c) class_rep(L, name);
+
+ // make the class globally available
+- lua_pushstring(L, name);
+- lua_pushvalue(L, -2);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_pushvalue(L, -1);
++ lua_setglobal(L, name);
+
+ // also add it to the closure as return value
+ lua_pushcclosure(L, &stage2, 1);
+diff --git a/src/open.cpp b/src/open.cpp
+index f20dcfc..ec8e4ff 100755
+--- a/src/open.cpp
++++ b/src/open.cpp
+@@ -178,21 +178,18 @@
+ lua_settable(L, LUA_REGISTRYINDEX);
+
+ // add functions (class, cast etc...)
+- lua_pushstring(L, "class");
+ lua_pushcclosure(L, detail::create_class::stage1, 0);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "class");
+
+- lua_pushstring(L, "property");
+ lua_pushcclosure(L, &make_property, 0);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "property");
+
+ lua_pushlightuserdata(L, &main_thread_tag);
+ lua_pushlightuserdata(L, L);
+ lua_rawset(L, LUA_REGISTRYINDEX);
+
+- lua_pushstring(L, "super");
+ lua_pushcclosure(L, &deprecated_super, 0);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "super");
+ }
+
+ } // namespace luabind
+diff --git a/src/scope.cpp b/src/scope.cpp
+index 6495687..24a94c9 100755
+--- a/src/scope.cpp
++++ b/src/scope.cpp
+@@ -136,22 +136,24 @@
+ {
+ if (m_name)
+ {
+- lua_pushstring(m_state, m_name);
+- lua_gettable(m_state, LUA_GLOBALSINDEX);
++ lua_getglobal(m_state, m_name);
+
+ if (!lua_istable(m_state, -1))
+ {
+ lua_pop(m_state, 1);
+
+ lua_newtable(m_state);
+- lua_pushstring(m_state, m_name);
+- lua_pushvalue(m_state, -2);
+- lua_settable(m_state, LUA_GLOBALSINDEX);
++ lua_pushvalue(m_state, -1);
++ lua_setglobal(m_state, m_name);
+ }
+ }
+ else
+ {
++#if LUA_VERSION_NUM >= 502
++ lua_rawgeti(m_state, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
++#else
+ lua_pushvalue(m_state, LUA_GLOBALSINDEX);
++#endif
+ }
+
+ lua_pop_stack guard(m_state);
+diff --git a/test/benchmark.cpp b/test/benchmark.cpp
+index 0b66ed9..1923e8e 100644
+--- a/test/benchmark.cpp
++++ b/test/benchmark.cpp
+@@ -49,9 +49,8 @@ int main()
+
+ function(L, "test1", &f1);
+
+- lua_pushstring(L, "test2");
+ lua_pushcclosure(L, &f2, 0);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "test2");
+
+ std::clock_t total1 = 0;
+ std::clock_t total2 = 0;
+diff --git a/test/test_free_functions.cpp b/test/test_free_functions.cpp
+index 04dec6b..6a2df4b 100644
+--- a/test/test_free_functions.cpp
++++ b/test/test_free_functions.cpp
+@@ -77,9 +77,8 @@ void test_main(lua_State* L)
+ {
+ using namespace luabind;
+
+- lua_pushstring(L, "f");
+ lua_pushcclosure(L, &function_should_never_be_called, 0);
+- lua_settable(L, LUA_GLOBALSINDEX);
++ lua_setglobal(L, "f");
+
+ DOSTRING(L, "assert(f() == 10)");
+
+--
+1.8.1.6
+
diff --git a/003-luabind-use-lua_rawlen.patch b/003-luabind-use-lua_rawlen.patch
new file mode 100644
index 00000000000..6a89638c93b
--- /dev/null
+++ b/003-luabind-use-lua_rawlen.patch
@@ -0,0 +1,130 @@
+From c6f38b86ce9593cacd73f359e68f3377cd71f053 Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 13:32:47 -0500
+Subject: [PATCH] Lua 5.2: replace lua_strlen with lua_rawlen
+
+lua_strlen was a macro for lua_objlen, which is superseded by lua_rawlen.
+
+http://www.lua.org/manual/5.2/manual.html#8.3
+
+This commit drops support for Lua 5.0, since Luabind is incompatible
+with Lua 5.0 anyway, e.g. commit 7dc37f9 requires lua_Integer added
+in Lua 5.1.
+---
+ luabind/detail/policy.hpp | 10 +++++++++-
+ luabind/object.hpp | 4 +++-
+ src/class_rep.cpp | 6 +++++-
+ src/create_class.cpp | 3 ++-
+ 4 files changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/luabind/detail/policy.hpp b/luabind/detail/policy.hpp
+index 689c733..bd0feec 100644
+--- a/luabind/detail/policy.hpp
++++ b/luabind/detail/policy.hpp
+@@ -66,6 +66,10 @@
+ #include <luabind/from_stack.hpp>
+ #include <luabind/typeid.hpp>
+
++#if LUA_VERSION_NUM < 502
++# define lua_rawlen lua_objlen
++#endif
++
+ namespace luabind
+ {
+ namespace detail
+@@ -745,7 +749,7 @@ struct default_converter<std::string>
+
+ std::string from(lua_State* L, int index)
+ {
+- return std::string(lua_tostring(L, index), lua_strlen(L, index));
++ return std::string(lua_tostring(L, index), lua_rawlen(L, index));
+ }
+
+ void to(lua_State* L, std::string const& value)
+@@ -1017,5 +1021,9 @@ struct default_converter<lua_State*>
+ #endif
+ }}
+
++#if LUA_VERSION_NUM < 502
++# undef lua_rawlen
++#endif
++
+ #endif // LUABIND_POLICY_HPP_INCLUDED
+
+diff --git a/luabind/object.hpp b/luabind/object.hpp
+index 698d236..4c877b9 100644
+--- a/luabind/object.hpp
++++ b/luabind/object.hpp
+@@ -49,6 +49,7 @@
+ # define lua_compare(L, index1, index2, fn) fn(L, index1, index2)
+ # define LUA_OPEQ lua_equal
+ # define LUA_OPLT lua_lessthan
++# define lua_rawlen lua_objlen
+ #endif
+
+ namespace luabind {
+@@ -231,7 +232,7 @@
+ value_wrapper_traits<ValueWrapper>::unwrap(interpreter
+ , static_cast<ValueWrapper const&>(v));
+ char const* p = lua_tostring(interpreter, -1);
+- std::size_t len = lua_strlen(interpreter, -1);
++ std::size_t len = lua_rawlen(interpreter, -1);
+ std::copy(p, p + len, std::ostream_iterator<char>(os));
+ return os;
+ }
+@@ -1420,6 +1421,7 @@ object property(GetValueWrapper const& get, SetValueWrapper const& set)
+ # undef lua_compare
+ # undef LUA_OPEQ
+ # undef LUA_OPLT
++# undef lua_rawlen
+ #endif
+
+ #endif // LUABIND_OBJECT_050419_HPP
+diff --git a/src/class_rep.cpp b/src/class_rep.cpp
+index 5f03f39..23c58b3 100755
+--- a/src/class_rep.cpp
++++ b/src/class_rep.cpp
+@@ -31,6 +31,10 @@
+ #include <luabind/get_main_thread.hpp>
+ #include <utility>
+
++#if LUA_VERSION_NUM < 502
++# define lua_rawlen lua_objlen
++#endif
++
+ using namespace luabind::detail;
+
+ namespace luabind { namespace detail
+@@ -287,7 +291,7 @@ int luabind::detail::class_rep::static_class_gettable(lua_State* L)
+
+ const char* key = lua_tostring(L, 2);
+
+- if (std::strlen(key) != lua_strlen(L, 2))
++ if (std::strlen(key) != lua_rawlen(L, 2))
+ {
+ lua_pushnil(L);
+ return 1;
+diff --git a/src/create_class.cpp b/src/create_class.cpp
+index 738cf9b..7bce6dd 100755
+--- a/src/create_class.cpp
++++ b/src/create_class.cpp
+@@ -29,6 +29,7 @@
+ #if LUA_VERSION_NUM < 502
+ # define lua_compare(L, index1, index2, fn) fn(L, index1, index2)
+ # define LUA_OPEQ lua_equal
++# define lua_rawlen lua_objlen
+ #endif
+
+ namespace luabind { namespace detail
+@@ -117,7 +118,7 @@
+ lua_error(L);
+ }
+
+- if (std::strlen(lua_tostring(L, 1)) != lua_strlen(L, 1))
++ if (std::strlen(lua_tostring(L, 1)) != lua_rawlen(L, 1))
+ {
+ lua_pushstring(L, "luabind does not support class names with extra nulls");
+ lua_error(L);
+--
+1.8.1.6
+
diff --git a/004-luabind-getsetuservalue.patch b/004-luabind-getsetuservalue.patch
new file mode 100644
index 00000000000..994f999c827
--- /dev/null
+++ b/004-luabind-getsetuservalue.patch
@@ -0,0 +1,65 @@
+From 9d9130ae22c2a32b0275189aa8ff28ac293edf66 Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 13:41:29 -0500
+Subject: [PATCH] Lua 5.2: replace lua_[gs]etfenv with lua_[gs]etuservalue
+
+http://www.lua.org/manual/5.2/manual.html#8.1
+---
+ src/object_rep.cpp | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/src/object_rep.cpp b/src/object_rep.cpp
+index 6977bee..a8d990e 100755
+--- a/src/object_rep.cpp
++++ b/src/object_rep.cpp
+@@ -25,6 +25,11 @@
+ #include <luabind/detail/object_rep.hpp>
+ #include <luabind/detail/class_rep.hpp>
+
++#if LUA_VERSION_NUM < 502
++# define lua_getuservalue lua_getfenv
++# define lua_setuservalue lua_setfenv
++#endif
++
+ namespace luabind { namespace detail
+ {
+
+@@ -94,7 +99,7 @@
+
+ int set_instance_value(lua_State* L)
+ {
+- lua_getfenv(L, 1);
++ lua_getuservalue(L, 1);
+ lua_pushvalue(L, 2);
+ lua_rawget(L, -2);
+
+@@ -129,7 +134,7 @@
+ {
+ lua_newtable(L);
+ lua_pushvalue(L, -1);
+- lua_setfenv(L, 1);
++ lua_setuservalue(L, 1);
+ lua_pushvalue(L, 4);
+ lua_setmetatable(L, -2);
+ }
+@@ -147,7 +152,7 @@
+
+ int get_instance_value(lua_State* L)
+ {
+- lua_getfenv(L, 1);
++ lua_getuservalue(L, 1);
+ lua_pushvalue(L, 2);
+ lua_rawget(L, -2);
+
+@@ -262,7 +267,7 @@
+ void* storage = lua_newuserdata(L, sizeof(object_rep));
+ object_rep* result = new (storage) object_rep(0, cls);
+ cls->get_table(L);
+- lua_setfenv(L, -2);
++ lua_setuservalue(L, -2);
+ lua_rawgeti(L, LUA_REGISTRYINDEX, cls->metatable_ref());
+ lua_setmetatable(L, -2);
+ return result;
+--
+1.8.1.6
+
diff --git a/005-luabind-lua_resume_extra_param.patch b/005-luabind-lua_resume_extra_param.patch
new file mode 100644
index 00000000000..c61dcf2ec81
--- /dev/null
+++ b/005-luabind-lua_resume_extra_param.patch
@@ -0,0 +1,41 @@
+From 6497a5a598e86ee08d4f8a35b68508661bb11617 Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 13:45:38 -0500
+Subject: [PATCH] Lua 5.2: pass extra parameter NULL to lua_resume
+
+http://www.lua.org/manual/5.2/manual.html#8.3
+
+This commit drops support for Lua 5.0, since Luabind is incompatible
+with Lua 5.0 anyway, e.g. commit 7dc37f9 requires lua_Integer added
+in Lua 5.1.
+---
+ src/pcall.cpp | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/pcall.cpp b/src/pcall.cpp
+index 66dbeaa..817884c 100755
+--- a/src/pcall.cpp
++++ b/src/pcall.cpp
+@@ -47,14 +47,14 @@
+
+ int resume_impl(lua_State *L, int nargs, int)
+ {
+-#if LUA_VERSION_NUM >= 501
++#if LUA_VERSION_NUM >= 502
++ int res = lua_resume(L, NULL, nargs);
++#else
++ int res = lua_resume(L, nargs);
++#endif
+ // Lua 5.1 added LUA_YIELD as a possible return value,
+ // this was causing crashes, because the caller expects 0 on success.
+- int res = lua_resume(L, nargs);
+ return (res == LUA_YIELD) ? 0 : res;
+-#else
+- return lua_resume(L, nargs);
+-#endif
+ }
+
+ }}
+--
+1.8.1.6
+
diff --git a/006-luabind-luaL_newstate.patch b/006-luabind-luaL_newstate.patch
new file mode 100644
index 00000000000..1df6829566b
--- /dev/null
+++ b/006-luabind-luaL_newstate.patch
@@ -0,0 +1,140 @@
+From f62198290a5e350c5532fb5cedb7ead3703d7b42 Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 13:51:37 -0500
+Subject: [PATCH] Lua 5.2: replace lua_open with luaL_newstate
+
+This commit drops support for Lua 5.0, since Luabind is incompatible
+with Lua 5.0 anyway, e.g. commit 7dc37f9 requires lua_Integer added
+in Lua 5.1.
+---
+ doc/docs.rst | 2 +-
+ examples/any_converter/any_converter.cpp | 2 +-
+ examples/cln/cln_test.cpp | 2 +-
+ examples/filesystem/filesystem.cpp | 2 +-
+ examples/glut/glut_bind.cpp | 2 +-
+ examples/intrusive_ptr/intrusive_ptr.cpp | 2 +-
+ examples/regexp/regex_wrap.cpp | 2 +-
+ test/benchmark.cpp | 2 +-
+ test/main.cpp | 2 +-
+ 9 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/doc/docs.rst b/doc/docs.rst
+index 61a1bce..0a7ef92 100755
+--- a/doc/docs.rst
++++ b/doc/docs.rst
+@@ -1734,7 +1734,7 @@ follows::
+ {
+ try
+ {
+- lua_state L = lua_open();
++ lua_state L = luaL_newstate();
+ /* ... */
+ }
+ catch(luabind::error& e)
+diff --git a/examples/any_converter/any_converter.cpp b/examples/any_converter/any_converter.cpp
+index a5f6995..59c42dd 100644
+--- a/examples/any_converter/any_converter.cpp
++++ b/examples/any_converter/any_converter.cpp
+@@ -69,7 +69,7 @@ int main()
+ register_any_converter<const char*>();
+ register_any_converter<std::string>();
+
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ #if LUA_VERSION_NUM >= 501
+ luaL_openlibs(L);
+ #else
+diff --git a/examples/cln/cln_test.cpp b/examples/cln/cln_test.cpp
+index 24c622a..c2332bb 100644
+--- a/examples/cln/cln_test.cpp
++++ b/examples/cln/cln_test.cpp
+@@ -107,7 +107,7 @@ void bind_cln(lua_State* L)
+
+ int main()
+ {
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ lua_baselibopen(L);
+ lua_mathlibopen(L);
+ luabind::open(L);
+diff --git a/examples/filesystem/filesystem.cpp b/examples/filesystem/filesystem.cpp
+index 5d6915e..f51e0d0 100755
+--- a/examples/filesystem/filesystem.cpp
++++ b/examples/filesystem/filesystem.cpp
+@@ -78,7 +78,7 @@ void bind_filesystem(lua_State* L)
+
+ int main(int argc, const char* argv[])
+ {
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ luaopen_base(L);
+ luaopen_string(L);
+ luaopen_table(L);
+diff --git a/examples/glut/glut_bind.cpp b/examples/glut/glut_bind.cpp
+index f7022ee..d8941f5 100644
+--- a/examples/glut/glut_bind.cpp
++++ b/examples/glut/glut_bind.cpp
+@@ -167,7 +167,7 @@ void bind_glut(lua_State* L)
+
+ int main(int argc, char* argv[])
+ {
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ lua_baselibopen(L);
+ lua_mathlibopen(L);
+ bind_glut(L);
+diff --git a/examples/intrusive_ptr/intrusive_ptr.cpp b/examples/intrusive_ptr/intrusive_ptr.cpp
+index d477948..02df972 100644
+--- a/examples/intrusive_ptr/intrusive_ptr.cpp
++++ b/examples/intrusive_ptr/intrusive_ptr.cpp
+@@ -140,7 +140,7 @@ void f(boost::intrusive_ptr<A> ptr)
+
+ int main()
+ {
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ lua_baselibopen(L);
+
+ luabind::open(L);
+diff --git a/examples/regexp/regex_wrap.cpp b/examples/regexp/regex_wrap.cpp
+index 6a924cb..0219100 100644
+--- a/examples/regexp/regex_wrap.cpp
++++ b/examples/regexp/regex_wrap.cpp
+@@ -44,7 +44,7 @@ void wrap_regex(lua_State* L)
+
+ int main()
+ {
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ lua_baselibopen(L);
+ lua_strlibopen(L);
+ luabind::open(L);
+diff --git a/test/benchmark.cpp b/test/benchmark.cpp
+index 1923e8e..124c619 100644
+--- a/test/benchmark.cpp
++++ b/test/benchmark.cpp
+@@ -41,7 +41,7 @@ int main()
+
+ using namespace luabind;
+
+- lua_State* L = lua_open();
++ lua_State* L = luaL_newstate();
+ open(L);
+
+ class_<A>(L, "A")
+diff --git a/test/main.cpp b/test/main.cpp
+index 3152c73..baa0eac 100644
+--- a/test/main.cpp
++++ b/test/main.cpp
+@@ -50,7 +50,7 @@ struct lua_state
+ };
+
+ lua_state::lua_state()
+- : m_state(lua_open())
++ : m_state(luaL_newstate())
+ {
+ luaopen_base(m_state);
+ #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
+--
+1.8.1.6
+
diff --git a/007-luabind-lua-52-fix-test.patch b/007-luabind-lua-52-fix-test.patch
new file mode 100644
index 00000000000..533dae603cf
--- /dev/null
+++ b/007-luabind-lua-52-fix-test.patch
@@ -0,0 +1,31 @@
+From 3866d4c25b7949285dbb7feb90c3025e42a5deea Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Wed, 21 Dec 2011 15:13:07 -0500
+Subject: [PATCH] Lua 5.2: fix test_free_functions unit test
+
+The line triggering the error is truncated at a different position.
+---
+ test/test_free_functions.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/test/test_free_functions.cpp b/test/test_free_functions.cpp
+index 6a2df4b..9b649a7 100644
+--- a/test/test_free_functions.cpp
++++ b/test/test_free_functions.cpp
+@@ -144,7 +144,12 @@ void test_main(lua_State* L)
+ catch(luabind::error const& e)
+ {
+ if (std::string("[string \"function failing_fun() error('expected "
+- "erro...\"]:1: expected error message") != lua_tostring(L, -1))
++#if LUA_VERSION_NUM >= 502
++ "error ..."
++#else
++ "erro..."
++#endif
++ "\"]:1: expected error message") != lua_tostring(L, -1))
+ {
+ TEST_ERROR("function failed with unexpected error message");
+ }
+--
+1.8.1.6
+
diff --git a/008-luabind-lua_pushglobaltable.patch b/008-luabind-lua_pushglobaltable.patch
new file mode 100644
index 00000000000..73218406cfc
--- /dev/null
+++ b/008-luabind-lua_pushglobaltable.patch
@@ -0,0 +1,75 @@
+From 8c66030818f0eacbb7356c16776539b55d8c5319 Mon Sep 17 00:00:00 2001
+From: Peter Colberg <peter.colberg@utoronto.ca>
+Date: Fri, 23 Dec 2011 12:53:29 -0500
+Subject: [PATCH] Lua 5.2: use new macro lua_pushglobaltable
+
+This macro is not mentioned in the Lua 5.2 manual.
+---
+ luabind/object.hpp | 8 +++-----
+ src/scope.cpp | 10 +++++-----
+ 2 files changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/luabind/object.hpp b/luabind/object.hpp
+index 4c877b9..5e2771c 100644
+--- a/luabind/object.hpp
++++ b/luabind/object.hpp
+@@ -50,6 +50,7 @@
+ # define LUA_OPEQ lua_equal
+ # define LUA_OPLT lua_lessthan
+ # define lua_rawlen lua_objlen
++# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
+ #endif
+
+ namespace luabind {
+@@ -1214,11 +1215,7 @@ inline object newtable(lua_State* interpreter)
+ // this could be optimized by returning a proxy
+ inline object globals(lua_State* interpreter)
+ {
+-#if LUA_VERSION_NUM >= 502
+- lua_rawgeti(interpreter, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
+-#else
+- lua_pushvalue(interpreter, LUA_GLOBALSINDEX);
+-#endif
++ lua_pushglobaltable(interpreter);
+ detail::stack_pop pop(interpreter, 1);
+ return object(from_stack(interpreter, -1));
+ }
+@@ -1422,6 +1419,7 @@ object property(GetValueWrapper const& get, SetValueWrapper const& set)
+ # undef LUA_OPEQ
+ # undef LUA_OPLT
+ # undef lua_rawlen
++# undef lua_pushglobaltable
+ #endif
+
+ #endif // LUABIND_OBJECT_050419_HPP
+diff --git a/src/scope.cpp b/src/scope.cpp
+index 24a94c9..8b0ed9e 100755
+--- a/src/scope.cpp
++++ b/src/scope.cpp
+@@ -29,6 +29,10 @@
+ #include <luabind/detail/stack_utils.hpp>
+ #include <cassert>
+
++#if LUA_VERSION_NUM < 502
++# define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
++#endif
++
+ namespace luabind { namespace detail {
+
+ registration::registration()
+@@ -149,11 +153,7 @@
+ }
+ else
+ {
+-#if LUA_VERSION_NUM >= 502
+- lua_rawgeti(m_state, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS);
+-#else
+- lua_pushvalue(m_state, LUA_GLOBALSINDEX);
+-#endif
++ lua_pushglobaltable(m_state);
+ }
+
+ lua_pop_stack guard(m_state);
+--
+1.8.1.6
+
diff --git a/009-luabind-0.9.1-boost157fix.patch b/009-luabind-0.9.1-boost157fix.patch
new file mode 100644
index 00000000000..31f2e0d2f95
--- /dev/null
+++ b/009-luabind-0.9.1-boost157fix.patch
@@ -0,0 +1,22 @@
+diff -up luabind-0.9.1/luabind/object.hpp\~ luabind-0.9.1/luabind/object.hpp
+--- luabind-0.9.1/luabind/object.hpp~ 2015-02-04 02:48:49.558745199 +0100
++++ luabind-0.9.1/luabind/object.hpp 2015-02-04 02:50:22.184188471 +0100
+@@ -551,14 +551,14 @@ namespace detail
+ basic_iterator<basic_access> const& x \
+ , basic_iterator<basic_access> const& y) \
+ { \
+- return boost::operator op(x, y); \
++ return boost::iterators::operator op(x, y); \
+ } \
+ \
+ inline bool operator op( \
+ basic_iterator<raw_access> const& x \
+ , basic_iterator<raw_access> const& y) \
+ { \
+- return boost::operator op(x, y); \
++ return boost::iterators::operator op(x, y); \
+ }
+
+ LUABIND_OPERATOR_ADL_WKND(==)
+
+Diff finished. Wed Feb 4 02:52:16 2015
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..ad8d2456d24
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,59 @@
+# Contributor: PitBall
+
+luaver=5.2
+pkgname=lua${luaver//.}bind
+pkgver=0.9.1
+pkgrel=1
+pkgdesc="A library that helps you create bindings between C++ and Lua52"
+arch=('i686' 'x86_64')
+url="http://www.rasterbar.com/products/luabind.html"
+license=('MIT')
+makedepends=('unzip' 'boost' 'boost-build')
+depends=("lua${luaver//.}" 'gcc-libs')
+replaces=('luabind' 'lua51bind' 'lua53bind')
+conflicts=('luabind' 'lua51bind' 'lua53bind')
+source=("http://downloads.sourceforge.net/${pkgname//${luaver//.}}/${pkgname//${luaver//.}}-${pkgver}.tar.gz"
+ 000-luabind-0.9.1-boost149fix.patch
+ 001-luabind-use-lua_compare.patch
+ 002-luabind-deprecated-LUA_GLOBALSINDEX.patch
+ 003-luabind-use-lua_rawlen.patch
+ 004-luabind-getsetuservalue.patch
+ 005-luabind-lua_resume_extra_param.patch
+ 006-luabind-luaL_newstate.patch
+ 007-luabind-lua-52-fix-test.patch
+ 008-luabind-lua_pushglobaltable.patch
+ 009-luabind-0.9.1-boost157fix.patch)
+
+build() {
+ cd ${srcdir}/${pkgname//${luaver//.}}-${pkgver}
+ for diff in ${srcdir}/*.patch; do
+ patch -Np1 -i ${diff}; done
+
+ #export LUA_PATH=/usr/include/lua${luaver}
+ sed -e "s|51|${luaver//.}|" -e "s|5.1|${luaver}|" -i Jamroot
+ sed -r -e "s|^(\s*local\ names\s*=\s*).*|\1"liblua${luaver}\ liblua${luaver//.}\ \;"|" -i Jamroot
+
+ b2 -d+2 release --prefix=${pkgdir}/usr/ link=static,shared
+}
+
+package() {
+ cd ${srcdir}/${pkgname//${luaver//.}}-${pkgver}
+
+ b2 release --prefix=${pkgdir}/usr/ link=static,shared install
+
+ # copy license
+ install -Dm644 ${srcdir}/${pkgname//${luaver//.}}-${pkgver}/LICENSE \
+ ${pkgdir}/usr/share/licenses/${pkgname//${luaver//.}}/LICENSE
+}
+
+md5sums=('8a323fb51d07dad5cfdb12c432793d55'
+ 'b7315e791201c8f737702a7ccc8e3d69'
+ 'f946eda70f37b623fc6d2dc00cc9d330'
+ '69a6dfea8dd6143601d2b537b55feafa'
+ '3c94f13cdb5e4cc450bcba7421529ec8'
+ 'd3611164a4ecb80c62f540f54e00ac05'
+ '47302600179f5aa9e1934f8a20dffc1f'
+ 'c49bf430a89d44a3602cb44f2826318a'
+ 'e6818960faabf4d2e98d621492279533'
+ '4d0624aa94394c6f17307ea69c6a7387'
+ 'a64c06783893c92cd58ef99ce4e94a08')