-
-
Save momadacoding/38cffc4924128ccafefd7fd0fad3b08f to your computer and use it in GitHub Desktop.
fPIC Patch file for src/Makefile for lua-5.3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/Makefile.original2015-02-27 10:53:53.130125907 -0500 | |
+++ src/Makefile 2015-02-27 10:53:24.674126798 -0500 | |
@@ -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 @@ | |
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_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 @@ | |
$(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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ref this for mac os to build dylib https://github.com/Homebrew/homebrew-core/blob/master/Formula/lua.rb