summaryrefslogtreecommitdiffhomepage
path: root/patches/lua-5.4.3_pre.local.patch
blob: 7c9314cb2ddbe06a23a6e94f1167f43c30e7a5db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -ru lua-5.4.3.orig/Makefile lua-5.4.3/Makefile
--- lua-5.4.3.orig/Makefile	2021-03-02 21:04:35.000000000 +0100
+++ lua-5.4.3/Makefile	2021-10-18 18:33:35.605852816 +0200
@@ -10,13 +10,14 @@
 # so take care if INSTALL_TOP is not an absolute path. See the local target.
 # You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
 # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
-INSTALL_TOP= /usr/local
-INSTALL_BIN= $(INSTALL_TOP)/bin
-INSTALL_INC= $(INSTALL_TOP)/include
-INSTALL_LIB= $(INSTALL_TOP)/lib
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
-INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
-INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+PREFIX= /
+INSTALL_TOP= $(PREFIX)
+INSTALL_BIN= $(DESTDIR)$(INSTALL_TOP)/bin
+INSTALL_INC= $(DESTDIR)$(INSTALL_TOP)/include/lua$V
+INSTALL_LIB= $(DESTDIR)$(INSTALL_TOP)/lib
+INSTALL_MAN= $(DESTDIR)$(INSTALL_TOP)/man/man1
+INSTALL_LMOD= $(DESTDIR)$(INSTALL_TOP)/share/lua/$V
+INSTALL_CMOD= $(DESTDIR)$(INSTALL_TOP)/lib/lua/$V
 
 # How to install. If your install program does not support "-p", then
 # you may have to run ranlib on the installed liblua.a.
@@ -54,12 +55,11 @@
 $(PLATS) help test clean:
 	@cd src && $(MAKE) $@
 
-install: dummy
-	cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
-	cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
-	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
-	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
-	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+install:
+	mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
+	cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua luac $(INSTALL_BIN)
+	cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+	cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.la $(INSTALL_LIB)
 
 uninstall:
 	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff -ru lua-5.4.3.orig/src/luaconf.h lua-5.4.3/src/luaconf.h
--- lua-5.4.3.orig/src/luaconf.h	2021-03-15 14:32:52.000000000 +0100
+++ lua-5.4.3/src/luaconf.h	2021-10-18 18:34:55.701853395 +0200
@@ -217,7 +217,7 @@
 
 #else			/* }{ */
 
-#define LUA_ROOT	"/usr/local/"
+#define LUA_ROOT	"/"
 #define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR "/"
 #define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR "/"
 
diff -ru lua-5.4.3.orig/src/Makefile lua-5.4.3/src/Makefile
--- lua-5.4.3.orig/src/Makefile	2021-02-09 19:47:17.000000000 +0100
+++ lua-5.4.3/src/Makefile	2021-10-18 19:07:15.598332456 +0200
@@ -7,8 +7,8 @@
 PLAT= guess
 
 CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
-LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
+CFLAGS ?= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
+LDFLAGS ?= $(SYSLDFLAGS) $(MYLDFLAGS)
 LIBS= -lm $(SYSLIBS) $(MYLIBS)
 
 AR= ar rcu
@@ -50,7 +50,8 @@
 # Targets start here.
 default: $(PLAT)
 
-all:	$(ALL_T)
+#all:	$(ALL_T)
+all: gentoo_all
 
 o:	$(ALL_O)
 
@@ -60,10 +61,10 @@
 	$(AR) $@ $(BASE_O)
 	$(RANLIB) $@
 
-$(LUA_T): $(LUA_O) $(LUA_A)
+origin$(LUA_T): $(LUA_O) $(LUA_A)
 	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
 
-$(LUAC_T): $(LUAC_O) $(LUA_A)
+origin$(LUAC_T): $(LUAC_O) $(LUA_A)
 	$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
 
 test:
@@ -220,3 +221,33 @@
  lobject.h ltm.h lzio.h
 
 # (end of Makefile)
+
+LIBTOOL = /usr/bin/libtool --quiet --tag=CC
+LIB_VERSION = 9:3:4
+RPATH = /lib
+V = 5.4
+R = $V.3
+
+# The following rules use libtool for compiling and linking in order to
+# provide shared library support.
+
+LIB_NAME = liblua.la
+LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
+
+%.lo %.o: %.c
+	$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+$(LIB_NAME): $(LIB_OBJS)
+	$(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
+            -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
+
+$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
+	$(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
+
+$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
+	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME)
+
+gentoo_clean:
+	$(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac
+
+gentoo_all: $(LIB_NAME) $(LUA_T) $(LUAC_T)