From 75b6d57e4cb3b317d917f371943b6950c15037e9 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Tue, 22 Mar 2016 16:40:46 +0300 Subject: [PATCH] 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. --- hererocks.py | 31 +++++++++++++++---------------- test.sh | 3 ++- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hererocks.py b/hererocks.py index 87e3a50..13b7db5 100755 --- a/hererocks.py +++ b/hererocks.py @@ -542,24 +542,23 @@ 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([ - "#undef LUA_COMPAT_VARARG", "#undef LUA_COMPAT_MOD", - "#undef LUA_COMPAT_LSTR", "#undef LUA_COMPAT_GFIND", - "#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") - else: + if self.major_version == "5.1": + if self.compat == "none": + self.redefines.extend([ + "#undef LUA_COMPAT_VARARG", "#undef LUA_COMPAT_MOD", + "#undef LUA_COMPAT_LSTR", "#undef LUA_COMPAT_GFIND", + "#undef LUA_COMPAT_OPENLIB" + ]) + elif self.major_version == "5.2": + 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" diff --git a/test.sh b/test.sh index fc7966d..921373c 100755 --- a/test.sh +++ b/test.sh @@ -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"