Last active
May 12, 2024 06:40
-
-
Save marslo/767e339e32e0dbc038a3e00e3c8a7cba to your computer and use it in GitHub Desktop.
patch for build lua v5.4.6 as a shared library (liblua.so)
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
--- Makefile 2024-01-04 18:12:26.836000000 -0800 | |
+++ Makefile.patched 2024-01-04 18:14:09.840000000 -0800 | |
@@ -38,21 +38,21 @@ | |
# Convenience platforms targets. | |
PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris | |
+# Lua version and release. | |
+V= 5.4 | |
+R= $V.6 | |
+ | |
# What to install. | |
TO_BIN= lua luac | |
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp | |
-TO_LIB= liblua.a | |
+TO_LIB= liblua.a liblua$(R).so | |
TO_MAN= lua.1 luac.1 | |
-# Lua version and release. | |
-V= 5.4 | |
-R= $V.6 | |
- | |
# Targets start here. | |
all: $(PLAT) | |
$(PLATS) help test clean: | |
- @cd src && $(MAKE) $@ | |
+ @cd src && $(MAKE) $@ V=$(V) R=$(R) | |
install: dummy | |
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) | |
@@ -60,6 +60,8 @@ | |
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) | |
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) | |
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) | |
+ ln -s $(INSTALL_LIB)/liblua$(R).so $(INSTALL_LIB)/liblua.so.$(V) | |
+ ln -s $(INSTALL_LIB)/liblua$(R).so $(INSTALL_LIB)/liblua.so | |
uninstall: | |
cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) |
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 2023-02-03 02:43:14.000000000 -0800 | |
+++ src/Makefile.patched 2024-01-04 18:47:16.755000000 -0800 | |
@@ -20,7 +20,7 @@ | |
SYSLDFLAGS= | |
SYSLIBS= | |
-MYCFLAGS= | |
+MYCFLAGS= -fPIC | |
MYLDFLAGS= | |
MYLIBS= | |
MYOBJS= | |
@@ -59,6 +59,8 @@ | |
$(LUA_A): $(BASE_O) | |
$(AR) $@ $(BASE_O) | |
$(RANLIB) $@ | |
+ $(CC) -shared -ldl -Wl,-soname,liblua$R.so -o liblua$R.so $? -lm $(MYLDFLAGS) | |
+ ln -sf liblua$R.so liblua.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
way to build lua 5.4.6
references: