mirror of
https://github.com/cazfi/meta-games.git
synced 2026-09-12 03:49:31 +02:00
tolua: Make generated code deterministic
Port patch from freeciv tree. This is necessary for any project that uses tolua to build reproducibly. Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
This commit is contained in:
38
dependencies/tolua/tolua/08-gen-code-deterministic.patch
vendored
Normal file
38
dependencies/tolua/tolua/08-gen-code-deterministic.patch
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
Upstream-Status: Inactive-Upstream
|
||||
|
||||
diff -Nurd tolua-5.2/src/bin/lua/package.lua tolua-5.2/src/bin/lua/package.lua
|
||||
--- tolua-5.2/src/bin/lua/package.lua 2026-08-06 05:52:07.651394122 +0200
|
||||
+++ tolua-5.2/src/bin/lua/package.lua 2026-08-06 05:49:00.012771828 +0200
|
||||
@@ -125,7 +125,11 @@
|
||||
output('\n')
|
||||
output('/* function to release collected object via destructor */')
|
||||
output('#ifdef __cplusplus\n')
|
||||
- for i,v in pairs(_collect) do
|
||||
+ local sorted = {}
|
||||
+ for i in pairs(_collect) do tinsert(sorted,i) end
|
||||
+ sort(sorted)
|
||||
+ for _,i in ipairs(sorted) do
|
||||
+ local v = _collect[i]
|
||||
output('\nstatic int '..v..' (lua_State* tolua_S)')
|
||||
output('{')
|
||||
output(' '..i..'* self = ('..i..'*) tolua_tousertype(tolua_S,1,0);')
|
||||
@@ -141,7 +145,10 @@
|
||||
output('/* function to register type */')
|
||||
output('static void tolua_reg_types (lua_State* tolua_S)')
|
||||
output('{')
|
||||
- foreach(_usertype,function(n,v) output(' tolua_usertype(tolua_S,"',v,'");') end)
|
||||
+ local sorted = {}
|
||||
+ foreach(_usertype,function(n,v) tinsert(sorted,v) end)
|
||||
+ sort(sorted)
|
||||
+ foreachi(sorted,function(i,v) output(' tolua_usertype(tolua_S,"',v,'");') end)
|
||||
output('}')
|
||||
output('\n')
|
||||
end
|
||||
@@ -182,7 +189,6 @@
|
||||
-- write header file
|
||||
function classPackage:header ()
|
||||
output('/*\n') output('** Lua binding: '..self.name..'\n')
|
||||
- output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
|
||||
output('*/\n\n')
|
||||
|
||||
if not flags.h then
|
||||
1
dependencies/tolua/tolua_5.2.4.bb
vendored
1
dependencies/tolua/tolua_5.2.4.bb
vendored
@@ -24,6 +24,7 @@ SRC_URI = "\
|
||||
file://04-include-tolua_event.patch \
|
||||
file://05-gen-code-fix-null-dereferences.patch \
|
||||
file://06-gen-code-no-trailing-spaces.patch \
|
||||
file://08-gen-code-deterministic.patch \
|
||||
"
|
||||
|
||||
B = "${S}"
|
||||
|
||||
Reference in New Issue
Block a user