Fix compatibility defines patching for Lua

Makefile is not used anymore, patches to luaconf.h for compatibility
defines should operate correctly with default defines not present
initially.
This commit is contained in:
mpeterv 2016-03-22 16:40:46 +03:00
parent 98f1426656
commit 75b6d57e4c
2 changed files with 17 additions and 17 deletions

View File

@ -542,7 +542,6 @@ class RioLua(Lua):
self.compat = "default" if opts.compat in ["default", "5.2"] else opts.compat
def add_compat_to_defines(self):
if self.compat != "default":
if self.major_version == "5.1":
if self.compat == "none":
self.redefines.extend([
@ -551,15 +550,15 @@ class RioLua(Lua):
"#undef LUA_COMPAT_OPENLIB"
])
elif self.major_version == "5.2":
self.defines.append("#undef LUA_COMPAT_ALL")
elif self.compat == "none":
self.defines.append("#undef LUA_COMPAT_5_2")
elif self.compat == "5.1":
self.defines.append("#undef LUA_COMPAT_5_2")
self.defines.append("#define LUA_COMPAT_5_1")
if self.compat == "default":
self.defines.append("#define LUA_COMPAT_ALL")
else:
if self.compat in ["5.1", "all"]:
self.defines.append("#define LUA_COMPAT_5_1")
if self.compat in ["default", "5.2", "all"]:
self.defines.append("#define LUA_COMPAT_5_2")
def make(self):
if self.major_version == "5.3":
cc = "gcc -std=gnu99"

View File

@ -6,6 +6,7 @@ HEREROCKS="python hererocks.py test/here --downloads=test/cache --no-git-cache -
rm -rf test/here
$HEREROCKS -l^ -r^
lua -v
lua -e "assert(bit32)"
luarocks --version
luarocks make
hererocks-test | tee test/tmp && grep "5\.3" test/tmp
@ -27,7 +28,7 @@ lua -e "assert(math.mod == nil)"
rm -rf test/here
$HEREROCKS -l 5.3 --compat=none --builds=test/builds
lua -e "assert(module == nil)"
lua -e "assert(not bit32)"
rm -rf test/here
$HEREROCKS -l 5.3 --compat=none --builds=test/builds | tee test/tmp && grep "Building" test/tmp | grep "cached"