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,24 +542,23 @@ class RioLua(Lua):
self.compat = "default" if opts.compat in ["default", "5.2"] else opts.compat self.compat = "default" if opts.compat in ["default", "5.2"] else opts.compat
def add_compat_to_defines(self): def add_compat_to_defines(self):
if self.compat != "default": if self.major_version == "5.1":
if self.major_version == "5.1": if self.compat == "none":
if self.compat == "none": self.redefines.extend([
self.redefines.extend([ "#undef LUA_COMPAT_VARARG", "#undef LUA_COMPAT_MOD",
"#undef LUA_COMPAT_VARARG", "#undef LUA_COMPAT_MOD", "#undef LUA_COMPAT_LSTR", "#undef LUA_COMPAT_GFIND",
"#undef LUA_COMPAT_LSTR", "#undef LUA_COMPAT_GFIND", "#undef LUA_COMPAT_OPENLIB"
"#undef LUA_COMPAT_OPENLIB" ])
]) elif self.major_version == "5.2":
elif self.major_version == "5.2": if self.compat == "default":
self.defines.append("#undef LUA_COMPAT_ALL") self.defines.append("#define LUA_COMPAT_ALL")
elif self.compat == "none": else:
self.defines.append("#undef LUA_COMPAT_5_2") if self.compat in ["5.1", "all"]:
elif self.compat == "5.1":
self.defines.append("#undef LUA_COMPAT_5_2")
self.defines.append("#define LUA_COMPAT_5_1")
else:
self.defines.append("#define LUA_COMPAT_5_1") 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): def make(self):
if self.major_version == "5.3": if self.major_version == "5.3":
cc = "gcc -std=gnu99" 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 rm -rf test/here
$HEREROCKS -l^ -r^ $HEREROCKS -l^ -r^
lua -v lua -v
lua -e "assert(bit32)"
luarocks --version luarocks --version
luarocks make luarocks make
hererocks-test | tee test/tmp && grep "5\.3" test/tmp hererocks-test | tee test/tmp && grep "5\.3" test/tmp
@ -27,7 +28,7 @@ lua -e "assert(math.mod == nil)"
rm -rf test/here rm -rf test/here
$HEREROCKS -l 5.3 --compat=none --builds=test/builds $HEREROCKS -l 5.3 --compat=none --builds=test/builds
lua -e "assert(module == nil)" lua -e "assert(not bit32)"
rm -rf test/here rm -rf test/here
$HEREROCKS -l 5.3 --compat=none --builds=test/builds | tee test/tmp && grep "Building" test/tmp | grep "cached" $HEREROCKS -l 5.3 --compat=none --builds=test/builds | tee test/tmp && grep "Building" test/tmp | grep "cached"