Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[Lua] Added README.lua for Lua installation process details.
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 24 Jul 2015 09:31:43 +0000 (11:31 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 15 Oct 2015 17:17:19 +0000 (19:17 +0200)
- Also added a patch file for patching Lua to generate a .so file

README.lua [new file with mode: 0644]
contrib/lua/lualib.patch [new file with mode: 0644]

diff --git a/README.lua b/README.lua
new file mode 100644 (file)
index 0000000..3636fd7
--- /dev/null
@@ -0,0 +1,26 @@
+SimGrid requires Lua 5.3; it will not work with Lua 5.2 or Lua 5.1,
+as Lua 5.3 breaks backwards compatibility.
+
+However, installing Lua 5.3 is easy. (If you're an administrator)
+
+Step 1: Go to http://www.lua.org/download.html and download the 5.3 package.
+
+Step 2: Untar the package: tar xvfz lua-5.3.*.tar.gz
+
+Step 3: cd into the new directory
+
+Step 4: Apply the patch in "<simgrid-source-dir>/contrib/lua/lualib.patch" to the
+        lua source:
+
+        For instance, if you unpacked the lua sourcecode to /tmp/lua-5.3.1, use
+        the following commands:
+
+        cp contrib/lua/lualib.patch /tmp/lua-5.3.1
+        cd /tmp/lua-5.3.1/
+        patch -p1 < lualib.patch
+
+Step 5: make
+
+Step 6: sudo make install
+
+Step 7: Run ccmake (or supply the config option to cmake) to enable Lua in SimGrid. Done!
diff --git a/contrib/lua/lualib.patch b/contrib/lua/lualib.patch
new file mode 100644 (file)
index 0000000..b795d67
--- /dev/null
@@ -0,0 +1,55 @@
+diff --git a/Makefile b/Makefile
+index 5ee5601..93830a3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -52,7 +52,7 @@ R= $V.1
+ all:  $(PLAT)
+ $(PLATS) clean:
+-      cd src && $(MAKE) $@
++      cd src && $(MAKE) $@ V=$(V) R=$(R)
+ test: dummy
+       src/lua -v
+diff --git a/src/Makefile b/src/Makefile
+index d71c75c..64bda79 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,7 +7,7 @@
+ PLAT= none
+ CC= gcc -std=gnu99
+-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
++CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -fPIC
+ LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
+ LIBS= -lm $(SYSLIBS) $(MYLIBS)
+@@ -29,6 +29,7 @@ MYOBJS=
+ PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+ LUA_A=        liblua.a
++LUA_SO= liblua.so
+ CORE_O=       lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
+       lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
+       ltm.o lundump.o lvm.o lzio.o
+@@ -43,7 +44,7 @@ LUAC_T=      luac
+ LUAC_O=       luac.o
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
+ ALL_A= $(LUA_A)
+ # Targets start here.
+@@ -59,6 +60,11 @@ $(LUA_A): $(BASE_O)
+       $(AR) $@ $(BASE_O)
+       $(RANLIB) $@
++$(LUA_SO): $(CORE_O) $(LIB_O)
++      $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
++      ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
++      ln -sf $(LUA_SO).$(R) $(LUA_SO)
++
+ $(LUA_T): $(LUA_O) $(LUA_A)
+       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)