[Tarantool-patches] [PATCH 2/3] misc: add lib_misc.c to all .bat files

Sergey Kaplun skaplun at tarantool.org
Fri Oct 16 22:49:39 MSK 2020


Since neither this patch compiles without the following, nor vice versa,
I have merged these two commits into one.

Side note 1: Forgot to say in previous letter: `#define lj_mapi_c` added
for consistency with other LUA_CORE files. AFAIK it is not used
anywhere.

Side note 2: ^M symbols that you may see in your favorite editor is 0xD
character - the carriage return character. Unix uses 0xA for a newline
character. Windows uses a combination of two characters: 0xD and 0xA.

See new full patch below. Branch is force pushed.

===================================================================
commit d3952c3553d78725a565ee535e28e675036cf7d3
Author: Sergey Kaplun <skaplun at tarantool.org>
Date:   Fri Oct 16 15:48:08 2020 +0300

    misc: fix build for Windows-like systems
    
    For become symbols exportable at several building systems
    (namely mvsc, xedk, xb1) LuaJIT defines LUA_BUILD_AS_DLL at
    corresponding bat files.  When this macro is defined, the definition of
    LUA_API macro depends on LUA_CORE and LUA_LIB macros (see luaconf.h). If
    defined(LUA_CORE) or defined(LUA_LIB) then LUA_API macro is defined as
    __declspec(dllexport). Otherwise, it defined as __declspec(dllimport).
    
    This patch consists from two parts.
    
    First of all it adds lib_misc.c to ALL_LIB in .bat files
    for specific building systems.
    
    Secondly, this patch also adds definition of LUA_CORE macro at the top
    of lj_mapi.c file to make corresponding symbols exportable for systems
    described above.
    
    Follows up tarantool/tarantool#5187

diff --git a/src/lj_mapi.c b/src/lj_mapi.c
index 13737e0..b2b35a1 100644
--- a/src/lj_mapi.c
+++ b/src/lj_mapi.c
@@ -5,6 +5,9 @@
 ** Copyright (C) 2015-2019 IPONWEB Ltd.
 */
 
+#define lj_mapi_c
+#define LUA_CORE
+
 #include "lua.h"
 #include "lmisclib.h"
 
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
index 71bde75..b0bddee 100644
--- a/src/msvcbuild.bat
+++ b/src/msvcbuild.bat
@@ -23,7 +23,7 @@
 @set DASC=vm_x86.dasc
 @set LJDLLNAME=lua51.dll
 @set LJLIBNAME=lua51.lib
- at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
+ at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_misc.c
 
 %LJCOMPILE% host\minilua.c
 @if errorlevel 1 goto :BAD
diff --git a/src/ps4build.bat b/src/ps4build.bat
index e4a7def..0509f1d 100644
--- a/src/ps4build.bat
+++ b/src/ps4build.bat
@@ -26,7 +26,7 @@
 @set LJMT=mt /nologo
 @set DASMDIR=..\dynasm
 @set DASM=%DASMDIR%\dynasm.lua
- at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
+ at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_misc.c
 @set GC64=-DLUAJIT_ENABLE_GC64
 @set DASC=vm_x64.dasc
 
diff --git a/src/psvitabuild.bat b/src/psvitabuild.bat
index 3991dc6..ed1fce1 100644
--- a/src/psvitabuild.bat
+++ b/src/psvitabuild.bat
@@ -14,7 +14,7 @@
 @set LJMT=mt /nologo
 @set DASMDIR=..\dynasm
 @set DASM=%DASMDIR%\dynasm.lua
- at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
+ at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_misc.c
 
 %LJCOMPILE% host\minilua.c
 @if errorlevel 1 goto :BAD
diff --git a/src/xb1build.bat b/src/xb1build.bat
index 847e84a..b3948da 100644
--- a/src/xb1build.bat
+++ b/src/xb1build.bat
@@ -14,7 +14,7 @@
 @set LJMT=mt /nologo
 @set DASMDIR=..\dynasm
 @set DASM=%DASMDIR%\dynasm.lua
- at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
+ at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_misc.c
 
 %LJCOMPILE% host\minilua.c
 @if errorlevel 1 goto :BAD
diff --git a/src/xedkbuild.bat b/src/xedkbuild.bat
index 240ec87..d108bfc 100644
--- a/src/xedkbuild.bat
+++ b/src/xedkbuild.bat
@@ -14,7 +14,7 @@
 @set LJMT=mt /nologo
 @set DASMDIR=..\dynasm
 @set DASM=%DASMDIR%\dynasm.lua
- at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
+ at set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_misc.c
 
 %LJCOMPILE% host\minilua.c
 @if errorlevel 1 goto :BAD
===================================================================

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list