Compile Recipes

From Legends of Aria Admin and Modding Wiki
Revision as of 06:59, 18 November 2016 by Yorlik (talk | contribs) (Created page with "== Obtaining an building Lua == https://www.lua.org/ftp/lua-5.2.4.tar.gz === 32 bit === Building lua 5.2 manually from source using MSVC CLI tools: ------------------------...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Obtaining an building Lua

https://www.lua.org/ftp/lua-5.2.4.tar.gz

32 bit

Building lua 5.2 manually from source using MSVC CLI tools:

----------------------------------------
cd src
cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c
rename lua.obj lua.o
rename luac.obj luac.o
link /DLL /IMPLIB:lua52.lib /OUT:lua52.dll *.obj
link /OUT:lua.exe lua.o lua52.lib
lib /OUT:liblua52.lib *.obj
link /OUT:luac.exe luac.o liblua52.lib
----------------------------------------
prog:       lua.exe
prog:       luac.exe (statically linked)
static lib: lua5.2.-static.lib
importlib:  lua5.2.lib
dll:        lua52.dll
----------------------------------------

VIDEO LINK: http://www.youtube.com/watch?v=X5D_h2X8LCk

Building lua 5.2 using MinGW tools:

----------------------------------------
mingw32-make.exe mingw
----------------------------------------
prog:       lua.exe
prog:       luac.exe (statically linked)
static lib: liblua.a
importlib:  --
dll:        lua52.dll
----------------------------------------

Building lua 5.2 manually from source using MinGW tools:

----------------------------------------
-- build object files
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_BUILD_AS_DLL  -c  *.c

-- save executable object files for later
rename lua.o lua.obj
rename luac.o luac.obj
-- Build dll with import library from remaining object files
gcc -shared -o lua52.dll -Wl,--out-implib,lua52.a *.o
strip --strip-unneeded lua52.dll
-- build static library
ar rcu liblua52.a *.o
ranlib liblua52.a

-- create luac compiler statically
gcc -o luac.exe luac.obj liblua52.a -lm
-- create lua and dynamically link to dll
gcc -o lua.exe -s  lua.obj lua52.dll -lm
----------------------------------------
prog:       lua.exe
prog:       luac.exe (statically linked)
static lib: liblua52.a
importlib:  lua52.a
dll:        lua52.dll
----------------------------------------

64 bit

https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx
cd \VisualStudio14.0\VC
vcvarsall.bat amd64
cd lua\src\
.. proceed like msvc build above
gcc not yet tested

Installing

/lua/5.2/lua.exe
/lua/5.2/luac.exe
/lua/5.2/lua52.dll
/lua/5.2/lib/liblua52.a, lua5.2.-static.lib or both
/lua/5.2/lib/lua52.a, lua52.lib or both

Obtaining and building Luasocket

git clone https://github.com/diegonehab/luasocket.git

inside luasocket directory:

copy Lua52.props Lua.props

Then open luasocket.sln in Visual Studio
For both subprojects, luasocket and mime:

==> Add the Lua header directory to the includes directory
==> Add the Lua library directory to the library directory
==> Change the output directories and intermediate directories for each to be different
Build
Works in 64 and 32 bit if according Lua import library is supplied.

Obtaining and building LuaXML

http://viremo.eludi.net/LuaXML/LuaXML_130610.zip
git clone https://github.com/LuaDist/luaxml.git
--- Adjust your paths !

--- Building MSVC CLI Tools Example (Also works in 64 bit)

cl /MD /O2 /c /IE:\BUILD\src\lua-5.2.4\src -DWIN32 *.c
link /DLL /IMPLIB:LuaXML_lib.lib /OUT:LuaXML_lib.dll *.obj E:\BUILD\src\lua-5.2.4\src\32bit_MSVC\lua52.lib

-- gcc (MinGW)

gcc -O2 -Wall -DWIN32 -I/BUILD/src/lua-5.2.4/src -c  *.c
gcc -shared -o LuaXML_lib.dll -Wl,--out-implib,LuaXML_lib.a *.o E:/BUILD/src/lua-5.2.4/src/32bit_MSVC/lua52.lib 

All recipes at your own risk !