Blame patches/lua-5.4.3_pre.local.patch

e81cb6
diff -ru lua-5.4.3.orig/Makefile lua-5.4.3/Makefile
e81cb6
--- lua-5.4.3.orig/Makefile	2021-03-02 21:04:35.000000000 +0100
e81cb6
+++ lua-5.4.3/Makefile	2021-10-18 18:33:35.605852816 +0200
e81cb6
@@ -10,13 +10,14 @@
e81cb6
 # so take care if INSTALL_TOP is not an absolute path. See the local target.
e81cb6
 # You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
e81cb6
 # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
e81cb6
-INSTALL_TOP= /usr/local
e81cb6
-INSTALL_BIN= $(INSTALL_TOP)/bin
e81cb6
-INSTALL_INC= $(INSTALL_TOP)/include
e81cb6
-INSTALL_LIB= $(INSTALL_TOP)/lib
e81cb6
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
e81cb6
-INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
e81cb6
-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
e81cb6
+PREFIX= /
e81cb6
+INSTALL_TOP= $(PREFIX)
e81cb6
+INSTALL_BIN= $(DESTDIR)$(INSTALL_TOP)/bin
e81cb6
+INSTALL_INC= $(DESTDIR)$(INSTALL_TOP)/include/lua$V
e81cb6
+INSTALL_LIB= $(DESTDIR)$(INSTALL_TOP)/lib
e81cb6
+INSTALL_MAN= $(DESTDIR)$(INSTALL_TOP)/man/man1
e81cb6
+INSTALL_LMOD= $(DESTDIR)$(INSTALL_TOP)/share/lua/$V
e81cb6
+INSTALL_CMOD= $(DESTDIR)$(INSTALL_TOP)/lib/lua/$V
e81cb6
 
e81cb6
 # How to install. If your install program does not support "-p", then
e81cb6
 # you may have to run ranlib on the installed liblua.a.
e81cb6
@@ -54,12 +55,11 @@
e81cb6
 $(PLATS) help test clean:
e81cb6
 	@cd src && $(MAKE) $@
e81cb6
 
e81cb6
-install: dummy
e81cb6
-	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
e81cb6
-	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
e81cb6
-	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
e81cb6
-	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
e81cb6
-	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
e81cb6
+install:
e81cb6
+	mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
e81cb6
+	cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua luac $(INSTALL_BIN)
e81cb6
+	cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
e81cb6
+	cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.la $(INSTALL_LIB)
e81cb6
 
e81cb6
 uninstall:
e81cb6
 	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
e81cb6
diff -ru lua-5.4.3.orig/src/luaconf.h lua-5.4.3/src/luaconf.h
e81cb6
--- lua-5.4.3.orig/src/luaconf.h	2021-03-15 14:32:52.000000000 +0100
e81cb6
+++ lua-5.4.3/src/luaconf.h	2021-10-18 18:34:55.701853395 +0200
e81cb6
@@ -217,7 +217,7 @@
e81cb6
 
e81cb6
 #else			/* }{ */
e81cb6
 
e81cb6
-#define LUA_ROOT	"/usr/local/"
e81cb6
+#define LUA_ROOT	"/"
e81cb6
 #define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR "/"
e81cb6
 #define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR "/"
e81cb6
 
e81cb6
diff -ru lua-5.4.3.orig/src/Makefile lua-5.4.3/src/Makefile
e81cb6
--- lua-5.4.3.orig/src/Makefile	2021-02-09 19:47:17.000000000 +0100
e81cb6
+++ lua-5.4.3/src/Makefile	2021-10-18 19:07:15.598332456 +0200
e81cb6
@@ -7,8 +7,8 @@
e81cb6
 PLAT= guess
e81cb6
 
e81cb6
 CC= gcc -std=gnu99
e81cb6
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
e81cb6
-LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
e81cb6
+CFLAGS ?= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
e81cb6
+LDFLAGS ?= $(SYSLDFLAGS) $(MYLDFLAGS)
e81cb6
 LIBS= -lm $(SYSLIBS) $(MYLIBS)
e81cb6
 
e81cb6
 AR= ar rcu
e81cb6
@@ -50,7 +50,8 @@
e81cb6
 # Targets start here.
e81cb6
 default: $(PLAT)
e81cb6
 
e81cb6
-all:	$(ALL_T)
e81cb6
+#all:	$(ALL_T)
e81cb6
+all: gentoo_all
e81cb6
 
e81cb6
 o:	$(ALL_O)
e81cb6
 
e81cb6
@@ -60,10 +61,10 @@
e81cb6
 	$(AR) $@ $(BASE_O)
e81cb6
 	$(RANLIB) $@
e81cb6
 
e81cb6
-$(LUA_T): $(LUA_O) $(LUA_A)
e81cb6
+origin$(LUA_T): $(LUA_O) $(LUA_A)
e81cb6
 	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
e81cb6
 
e81cb6
-$(LUAC_T): $(LUAC_O) $(LUA_A)
e81cb6
+origin$(LUAC_T): $(LUAC_O) $(LUA_A)
e81cb6
 	$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
e81cb6
 
e81cb6
 test:
e81cb6
@@ -220,3 +221,33 @@
e81cb6
  lobject.h ltm.h lzio.h
e81cb6
 
e81cb6
 # (end of Makefile)
e81cb6
+
e81cb6
+LIBTOOL = /usr/bin/libtool --quiet --tag=CC
e81cb6
+LIB_VERSION = 9:3:4
e81cb6
+RPATH = /lib
e81cb6
+V = 5.4
e81cb6
+R = $V.3
e81cb6
+
e81cb6
+# The following rules use libtool for compiling and linking in order to
e81cb6
+# provide shared library support.
e81cb6
+
e81cb6
+LIB_NAME = liblua.la
e81cb6
+LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
e81cb6
+
e81cb6
+%.lo %.o: %.c
e81cb6
+	$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
e81cb6
+
e81cb6
+$(LIB_NAME): $(LIB_OBJS)
e81cb6
+	$(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
e81cb6
+            -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
e81cb6
+
e81cb6
+$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
e81cb6
+	$(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
e81cb6
+
e81cb6
+$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
e81cb6
+	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME)
e81cb6
+
e81cb6
+gentoo_clean:
e81cb6
+	$(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac
e81cb6
+
e81cb6
+gentoo_all: $(LIB_NAME) $(LUA_T) $(LUAC_T)