tools: refresh patches for tools lua, mtd-utils, ipkg-utils, squashfs, lzma, and...
[openwrt/openwrt.git] / tools / lua / patches / 020-shared_liblua.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -42,8 +42,8 @@ PLATS= aix ansi bsd freebsd generic linu
4
5 # What to install.
6 TO_BIN= lua luac
7 -TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
8 -TO_LIB= liblua.a
9 +TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp lnum_config.h
10 +TO_LIB= liblua.a liblua.so.$R
11 TO_MAN= lua.1 luac.1
12
13 # Lua version and release.
14 @@ -63,6 +63,7 @@ install: dummy
15 cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
16 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
17 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
18 + ln -s liblua.so.$R $(INSTALL_LIB)/liblua.so
19 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
20
21 ranlib:
22 --- a/src/ldo.h
23 +++ b/src/ldo.h
24 @@ -46,7 +46,7 @@ LUAI_FUNC int luaD_pcall (lua_State *L,
25 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
26 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
27 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
28 -LUAI_FUNC void luaD_growstack (lua_State *L, int n);
29 +LUA_API void luaD_growstack (lua_State *L, int n);
30
31 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
32 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
33 --- a/src/lfunc.h
34 +++ b/src/lfunc.h
35 @@ -18,7 +18,7 @@
36 cast(int, sizeof(TValue *)*((n)-1)))
37
38
39 -LUAI_FUNC Proto *luaF_newproto (lua_State *L);
40 +LUA_API Proto *luaF_newproto (lua_State *L);
41 LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
42 LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
43 LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
44 --- a/src/lmem.h
45 +++ b/src/lmem.h
46 @@ -38,9 +38,9 @@
47 ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
48
49
50 -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
51 +LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
52 size_t size);
53 -LUAI_FUNC void *luaM_toobig (lua_State *L);
54 +LUA_API void *luaM_toobig (lua_State *L);
55 LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
56 size_t size_elem, int limit,
57 const char *errormsg);
58 --- a/src/lstring.h
59 +++ b/src/lstring.h
60 @@ -25,7 +25,7 @@
61
62 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
63 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
64 -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
65 +LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
66
67
68 #endif
69 --- a/src/lundump.h
70 +++ b/src/lundump.h
71 @@ -17,7 +17,7 @@ LUAI_FUNC Proto* luaU_undump (lua_State*
72 LUAI_FUNC void luaU_header (char* h);
73
74 /* dump one chunk; from ldump.c */
75 -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
76 +LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
77
78 #ifdef luac_c
79 /* print one chunk; from print.c */
80 --- a/src/Makefile
81 +++ b/src/Makefile
82 @@ -23,6 +23,7 @@ MYLIBS=
83 PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
84
85 LUA_A= liblua.a
86 +LUA_SO= liblua.so
87 CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
88 lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
89 lundump.o lvm.o lzio.o lnum.o
90 @@ -33,11 +34,12 @@ LUA_T= lua
91 LUA_O= lua.o
92
93 LUAC_T= luac
94 -LUAC_O= luac.o print.o
95 +LUAC_O= luac.o print.o lopcodes.o
96
97 ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
98 -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
99 +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
100 ALL_A= $(LUA_A)
101 +ALL_SO= $(LUA_SO)
102
103 default: $(PLAT)
104
105 @@ -47,14 +49,23 @@ o: $(ALL_O)
106
107 a: $(ALL_A)
108
109 +so: $(ALL_SO)
110 +
111 $(LUA_A): $(CORE_O) $(LIB_O)
112 $(AR) $@ $?
113 $(RANLIB) $@
114
115 -$(LUA_T): $(LUA_O) $(LUA_A)
116 - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
117 +$(LUA_SO): $(CORE_O) $(LIB_O)
118 + $(CC) -o $@.$(PKG_VERSION) -shared -soname="$@.$(PKG_VERSION)" $? -nostdlib -lgcc
119 + ln -fs $@.$(PKG_VERSION) $@
120 +
121 +$(LUA_T): $(LUA_O) $(LUA_SO)
122 + $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS)
123 +
124 +$(LUAC_T): $(LUAC_O) $(LUA_SO)
125 + $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUAC_O) $(LIBS)
126
127 -$(LUAC_T): $(LUAC_O) $(LUA_A)
128 +$(LUAC_T)-host: $(LUAC_O) $(LUA_A)
129 $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
130
131 clean:
132 @@ -96,7 +107,7 @@ generic:
133 $(MAKE) all MYCFLAGS=
134
135 linux:
136 - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
137 + $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
138
139 macosx:
140 $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"