83 lines
2.2 KiB
Diff
83 lines
2.2 KiB
Diff
|
From e137059046d0b9367465ce6088dd2fcbc185818e Mon Sep 17 00:00:00 2001
|
||
|
From: Joshua Strobl <joshua@stroblindustries.com>
|
||
|
Date: Sat, 16 Sep 2017 19:39:28 +0300
|
||
|
Subject: [PATCH 1/1] Use shared libraries and proper prefix.
|
||
|
|
||
|
---
|
||
|
Makefile | 2 +-
|
||
|
src/Makefile | 10 ++++++++--
|
||
|
src/luaconf.h | 2 +-
|
||
|
3 files changed, 10 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/Makefile b/Makefile
|
||
|
index 119110d..19c9573 100644
|
||
|
--- a/Makefile
|
||
|
+++ b/Makefile
|
||
|
@@ -52,7 +52,7 @@ R= $V.4
|
||
|
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..35ea2f5 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= -fPIC -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1 $(SYSCFLAGS) $(MYCFLAGS)
|
||
|
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)
|
||
|
|
||
|
diff --git a/src/luaconf.h b/src/luaconf.h
|
||
|
index f37bea0..e963d48 100644
|
||
|
--- a/src/luaconf.h
|
||
|
+++ b/src/luaconf.h
|
||
|
@@ -200,7 +200,7 @@
|
||
|
|
||
|
#else /* }{ */
|
||
|
|
||
|
-#define LUA_ROOT "/usr/local/"
|
||
|
+#define LUA_ROOT "/usr/"
|
||
|
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
|
||
|
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
|
||
|
#define LUA_PATH_DEFAULT \
|
||
|
--
|
||
|
2.14.1
|
||
|
|