diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75d968c9..c600e704 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,10 @@ jobs: matrix: os: [macos-latest, ubuntu-latest] build_type: [tiny, regular-asm] + lua_engine: [LuaJIT, Lua] env: BUILD_TYPE: ${{ matrix.build_type }} + WITH_LUA_ENGINE: ${{ matrix.lua_engine }} steps: - uses: actions/checkout@v2 @@ -18,7 +20,7 @@ jobs: submodules: recursive - name: Configure - run: WITHOUT_AMALG=1 make ${BUILD_TYPE} + run: WITHOUT_AMALG=1 make ${BUILD_TYPE} WITH_LUA_ENGINE=${WITH_LUA_ENGINE} - name: Build run: make diff --git a/CMakeLists.txt b/CMakeLists.txt index f0cd537a..abb2f151 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ else (WithSharedLibluv) include_directories(deps/luv/src) include_directories(deps/luv/deps/libuv/include) if (WITH_LUA_ENGINE STREQUAL Lua) - include_directories(deps/luv/deps/lua/src) + include_directories(deps/luv/deps/lua) set(LUVI_LIBRARIES libluv_a lualib uv_a) else() include_directories(deps/luv/deps/luajit/src) diff --git a/Makefile b/Makefile index bf77fa1d..f41c8840 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,10 @@ ifdef WITHOUT_AMALG CMAKE_FLAGS+= -DWITH_AMALG=OFF endif +ifdef WITH_LUA_ENGINE + CMAKE_FLAGS+= -DWITH_LUA_ENGINE=$(WITH_LUA_ENGINE) +endif + WITH_SHARED_LIBLUV ?= OFF CMAKE_FLAGS += \ diff --git a/deps/lrexlib b/deps/lrexlib index 6511dc65..69d5c442 160000 --- a/deps/lrexlib +++ b/deps/lrexlib @@ -1 +1 @@ -Subproject commit 6511dc6549a2ee7c2f97636742ee2e01c79e7c09 +Subproject commit 69d5c442c5a4bdc1271103e88c5c798b605e9ed2 diff --git a/src/luvi_compat.c b/src/luvi_compat.c index 68c0c923..b5899f17 100644 --- a/src/luvi_compat.c +++ b/src/luvi_compat.c @@ -3,6 +3,8 @@ #define lutf8lib_c #include "luvi.h" + +#if (LUA_VERSION_NUM < 503) #include "compat-5.3.h" #include "compat-5.3.c" @@ -10,12 +12,13 @@ #include "lstrlib.c" #include "ltablib.c" #include "lutf8lib.c" +#endif +#if (LUA_VERSION_NUM == 501) #ifndef LUA_UTF8LIBNAME #define LUA_UTF8LIBNAME "utf8" #endif -#if (LUA_VERSION_NUM == 501) #ifndef UTF8PATT_501 #define UTF8PATT_501 "[%z\x01-\x7F\xC2-\xF4][\x80-\xBF]*" #endif @@ -23,7 +26,7 @@ void luvi_openlibs(lua_State *L) { luaL_openlibs(L); -#if (LUA_VERSION_NUM!=503) +#if (LUA_VERSION_NUM < 503) { static luaL_Reg const funcs[] = { { "pack", str_pack }, @@ -32,7 +35,11 @@ void luvi_openlibs(lua_State *L) { { NULL, NULL } }; +#if (LUA_VERSION_NUM > 501) + luaL_newlib(L, funcs); +#else luaL_register(L, LUA_STRLIBNAME, funcs); +#endif } lua_pop(L, 1); diff --git a/src/snapshot.c b/src/snapshot.c index deb374aa..75b30ab2 100644 --- a/src/snapshot.c +++ b/src/snapshot.c @@ -23,6 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "./luvi.h" +#if (LUA_VERSION_NUM > 501) +#define lua_getfenv lua_getuservalue +#define lua_setfenv lua_setuservalue +#endif + #if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf c99_snprintf