summaryrefslogtreecommitdiffhomepage
path: root/patches/lua-5.3.3.local.patch
blob: e4a035d1eacf0a39a59ea8a055750a2b715b2ebe (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
127
128
--- lua-5.3.3/src/luaconf.h.orig	2016-05-01 20:06:09.000000000 +0000
+++ lua-5.3.3/src/luaconf.h	2016-06-23 10:02:23.471604030 +0000
@@ -72,6 +72,12 @@
 #endif
 
 
+#if defined(LUA_USE_MIDIPIX)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN		/* needs an extra library: -ldl */
+#endif
+
+
 /*
 @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
 ** C89 ('long' and 'double'); Windows always has '__int64', so it does
@@ -188,7 +194,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  \
--- lua-5.3.3/src/Makefile.orig	2015-05-27 11:10:11.000000000 +0000
+++ lua-5.3.3/src/Makefile	2016-06-23 10:45:40.323546394 +0000
@@ -26,9 +26,10 @@
 
 # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
 
-PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+PLATS= aix bsd c89 freebsd generic linux macosx midipix 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
@@ -36,14 +37,14 @@
 	lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
 BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
 
-LUA_T=	lua
+LUA_T=	lua$(V)
 LUA_O=	lua.o
 
-LUAC_T=	luac
+LUAC_T=	luac$(V)
 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.
@@ -56,9 +57,14 @@
 a:	$(ALL_A)
 
 $(LUA_A): $(BASE_O)
-	$(AR) $@ $(BASE_O)
+	$(AR) rcs $@ $(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)
 
@@ -112,6 +118,9 @@
 macosx:
 	$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc
 
+midipix:
+	$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MIDIPIX" SYSLIBS="-Wl,-E -ldl"
+
 mingw:
 	$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \
 	"AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
--- lua-5.3.3/Makefile.orig	2015-05-27 11:10:11.000000000 +0000
+++ lua-5.3.3/Makefile	2016-06-23 10:59:29.519527991 +0000
@@ -36,23 +36,25 @@
 # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
 
 # Convenience platforms targets.
-PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
+PLATS= aix bsd c89 freebsd generic linux macosx midipix mingw posix solaris
+
+# Lua version and release.
+V= 5.3
+R= $V.3
 
 # What to install.
-TO_BIN= lua luac
+TO_BIN= lua$(V) luac$(V)
+TO_BIN_LINKS= lua$(V):lua luac$(V):luac
 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
 TO_LIB= liblua.a
+TO_LIBSO= liblua.so liblua.so.$V
 TO_MAN= lua.1 luac.1
 
-# Lua version and release.
-V= 5.3
-R= $V.3
-
 # Targets start here.
 all:	$(PLAT)
 
 $(PLATS) clean:
-	cd src && $(MAKE) $@
+	cd src && $(MAKE) $@ V=$(V) R=$(R)
 
 test:	dummy
 	src/lua -v
@@ -60,8 +62,10 @@
 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 && for FNAME in $(TO_BIN_LINKS); do echo ln -fs $${FNAME%:*} $(INSTALL_BIN)/$${FNAME#*:}; ln -fs $${FNAME%:*} $(INSTALL_BIN)/$${FNAME#*:}; done
 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+	cd src && $(INSTALL_EXEC) $(TO_LIBSO) $(INSTALL_LIB)
 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
 
 uninstall: