1 This patch is to be applied to the Lua 5.3 source file to get a shared
2 library. This is because the authors of Lua don't bother distributing
3 a working build system for their software, so we have to make one...
5 As unfortunate as it may be, there is nothing else we can do.
9 diff --git a/Makefile b/Makefile
10 index 5ee5601..93830a3 100644
13 @@ -52,7 +52,7 @@ R= $V.1
17 - cd src && $(MAKE) $@
18 + cd src && $(MAKE) $@ V=$(V) R=$(R)
22 diff --git a/src/Makefile b/src/Makefile
23 index d71c75c..64bda79 100644
30 -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
31 +CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -fPIC
32 LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
33 LIBS= -lm $(SYSLIBS) $(MYLIBS)
35 @@ -29,6 +29,7 @@ MYOBJS=
36 PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
40 CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
41 lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
42 ltm.o lundump.o lvm.o lzio.o
43 @@ -43,7 +44,7 @@ LUAC_T= luac
46 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
47 -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
48 +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
52 @@ -59,6 +60,11 @@ $(LUA_A): $(BASE_O)
56 +$(LUA_SO): $(CORE_O) $(LIB_O)
57 + $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
58 + ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
59 + ln -sf $(LUA_SO).$(R) $(LUA_SO)
61 $(LUA_T): $(LUA_O) $(LUA_A)
62 $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)