7fa9652290b631f060e9cffec9400200aab18bd4
[openwrt/staging/nbd.git] / package / utils / lua5.3 / patches / 020-shared_liblua.patch
1 --- a/Makefile 2019-07-02 09:24:57.554332875 -0600
2 +++ b/Makefile 2019-07-02 09:25:42.626694604 -0600
3 @@ -41,7 +41,7 @@ PLATS= aix bsd c89 freebsd generic linux
4 # What to install.
5 TO_BIN= lua$V luac$V
6 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
7 -TO_LIB= liblua$V.a
8 +TO_LIB= liblua$V.a liblua$V.so.0.0.0
9 TO_MAN= lua$V.1 luac$V.1
10
11 # Lua version and release.
12 @@ -62,6 +62,9 @@ install: dummy
13 cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
14 cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
15 cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
16 + ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so.0.0
17 + ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so.0
18 + ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so
19 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
20
21 uninstall:
22 --- a/src/ldo.h 2017-04-19 11:20:42.000000000 -0600
23 +++ b/src/ldo.h 2019-07-02 09:25:42.626694604 -0600
24 @@ -47,8 +47,8 @@ LUAI_FUNC int luaD_pcall (lua_State *L,
25 LUAI_FUNC int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult,
26 int nres);
27 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
28 -LUAI_FUNC void luaD_growstack (lua_State *L, int n);
29 -LUAI_FUNC void luaD_shrinkstack (lua_State *L);
30 +LUA_API void luaD_growstack (lua_State *L, int n);
31 +LUA_API void luaD_shrinkstack (lua_State *L);
32 LUAI_FUNC void luaD_inctop (lua_State *L);
33
34 LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode);
35 --- a/src/lfunc.h 2017-04-19 11:39:34.000000000 -0600
36 +++ b/src/lfunc.h 2019-07-02 09:25:42.630694635 -0600
37 @@ -47,14 +47,14 @@ struct UpVal {
38 #define upisopen(up) ((up)->v != &(up)->u.value)
39
40
41 -LUAI_FUNC Proto *luaF_newproto (lua_State *L);
42 +LUA_API Proto *luaF_newproto (lua_State *L);
43 LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems);
44 -LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems);
45 -LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
46 -LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
47 -LUAI_FUNC void luaF_close (lua_State *L, StkId level);
48 +LUA_API LClosure *luaF_newLclosure (lua_State *L, int nelems);
49 +LUA_API void luaF_initupvals (lua_State *L, LClosure *cl);
50 +LUA_API UpVal *luaF_findupval (lua_State *L, StkId level);
51 +LUA_API void luaF_close (lua_State *L, StkId level);
52 LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
53 -LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
54 +LUA_API const char *luaF_getlocalname (const Proto *func, int local_number,
55 int pc);
56
57
58 --- a/src/lgc.h 2017-04-19 11:39:34.000000000 -0600
59 +++ b/src/lgc.h 2019-07-02 09:25:42.634694666 -0600
60 @@ -133,11 +133,11 @@
61
62 LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o);
63 LUAI_FUNC void luaC_freeallobjects (lua_State *L);
64 -LUAI_FUNC void luaC_step (lua_State *L);
65 +LUA_API void luaC_step (lua_State *L);
66 LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask);
67 LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency);
68 LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz);
69 -LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v);
70 +LUA_API void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v);
71 LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o);
72 LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv);
73 LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt);
74 --- a/src/llex.h 2017-04-19 11:20:42.000000000 -0600
75 +++ b/src/llex.h 2019-07-02 09:25:42.630694635 -0600
76 @@ -73,13 +73,13 @@ typedef struct LexState {
77
78
79 LUAI_FUNC void luaX_init (lua_State *L);
80 -LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
81 +LUA_API void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
82 TString *source, int firstchar);
83 LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
84 -LUAI_FUNC void luaX_next (LexState *ls);
85 -LUAI_FUNC int luaX_lookahead (LexState *ls);
86 -LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
87 -LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
88 +LUA_API void luaX_next (LexState *ls);
89 +LUA_API int luaX_lookahead (LexState *ls);
90 +LUA_API l_noret luaX_syntaxerror (LexState *ls, const char *s);
91 +LUA_API const char *luaX_token2str (LexState *ls, int token);
92
93
94 #endif
95 --- a/src/lmem.h 2017-04-19 11:20:42.000000000 -0600
96 +++ b/src/lmem.h 2019-07-02 09:25:42.630694635 -0600
97 @@ -56,12 +56,12 @@
98 #define luaM_reallocvector(L, v,oldn,n,t) \
99 ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
100
101 -LUAI_FUNC l_noret luaM_toobig (lua_State *L);
102 +LUA_API l_noret luaM_toobig (lua_State *L);
103
104 /* not to be called directly */
105 -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
106 +LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
107 size_t size);
108 -LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
109 +LUA_API void *luaM_growaux_ (lua_State *L, void *block, int *size,
110 size_t size_elem, int limit,
111 const char *what);
112
113 --- a/src/lobject.h 2017-04-19 11:39:34.000000000 -0600
114 +++ b/src/lobject.h 2019-07-02 09:25:42.630694635 -0600
115 @@ -525,7 +525,7 @@ typedef struct Table {
116 #define luaO_nilobject (&luaO_nilobject_)
117
118
119 -LUAI_DDEC const TValue luaO_nilobject_;
120 +LUA_API const TValue luaO_nilobject_;
121
122 /* size of buffer for 'luaO_utf8esc' function */
123 #define UTF8BUFFSZ 8
124 @@ -534,15 +534,15 @@ LUAI_FUNC int luaO_int2fb (unsigned int
125 LUAI_FUNC int luaO_fb2int (int x);
126 LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x);
127 LUAI_FUNC int luaO_ceillog2 (unsigned int x);
128 -LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1,
129 +LUA_API void luaO_arith (lua_State *L, int op, const TValue *p1,
130 const TValue *p2, TValue *res);
131 LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o);
132 LUAI_FUNC int luaO_hexavalue (int c);
133 LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj);
134 -LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
135 +LUA_API const char *luaO_pushvfstring (lua_State *L, const char *fmt,
136 va_list argp);
137 -LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
138 -LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
139 +LUA_API const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
140 +LUA_API void luaO_chunkid (char *out, const char *source, size_t len);
141
142
143 #endif
144 --- a/src/lopcodes.h 2017-04-19 11:20:42.000000000 -0600
145 +++ b/src/lopcodes.h 2019-07-02 09:25:42.630694635 -0600
146 @@ -278,7 +278,7 @@ enum OpArgMask {
147 OpArgK /* argument is a constant or register/constant */
148 };
149
150 -LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES];
151 +LUA_API const lu_byte luaP_opmodes[NUM_OPCODES];
152
153 #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
154 #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
155 @@ -287,7 +287,7 @@ LUAI_DDEC const lu_byte luaP_opmodes[NUM
156 #define testTMode(m) (luaP_opmodes[m] & (1 << 7))
157
158
159 -LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
160 +LUA_API const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
161
162
163 /* number of list items to accumulate before a SETLIST instruction */
164 --- a/src/lstate.h 2017-04-19 11:39:34.000000000 -0600
165 +++ b/src/lstate.h 2019-07-02 09:25:42.630694635 -0600
166 @@ -244,9 +244,9 @@ union GCUnion {
167
168 LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
169 LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
170 -LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
171 -LUAI_FUNC void luaE_freeCI (lua_State *L);
172 -LUAI_FUNC void luaE_shrinkCI (lua_State *L);
173 +LUA_API CallInfo *luaE_extendCI (lua_State *L);
174 +LUA_API void luaE_freeCI (lua_State *L);
175 +LUA_API void luaE_shrinkCI (lua_State *L);
176
177
178 #endif
179 --- a/src/lstring.h 2017-04-19 11:20:42.000000000 -0600
180 +++ b/src/lstring.h 2019-07-02 09:25:42.630694635 -0600
181 @@ -35,15 +35,15 @@
182
183 LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
184 LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
185 -LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
186 +LUA_API int luaS_eqlngstr (TString *a, TString *b);
187 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
188 LUAI_FUNC void luaS_clearcache (global_State *g);
189 LUAI_FUNC void luaS_init (lua_State *L);
190 LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
191 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s);
192 -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
193 -LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
194 -LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
195 +LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
196 +LUA_API TString *luaS_new (lua_State *L, const char *str);
197 +LUA_API TString *luaS_createlngstrobj (lua_State *L, size_t l);
198
199
200 #endif
201 --- a/src/ltable.h 2018-05-24 13:39:05.000000000 -0600
202 +++ b/src/ltable.h 2019-07-02 09:25:42.630694635 -0600
203 @@ -41,14 +41,14 @@
204
205
206 LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);
207 -LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key,
208 +LUA_API void luaH_setint (lua_State *L, Table *t, lua_Integer key,
209 TValue *value);
210 LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key);
211 LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
212 LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
213 LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key);
214 -LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
215 -LUAI_FUNC Table *luaH_new (lua_State *L);
216 +LUA_API TValue *luaH_set (lua_State *L, Table *t, const TValue *key);
217 +LUA_API Table *luaH_new (lua_State *L);
218 LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
219 unsigned int nhsize);
220 LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
221 --- a/src/ltm.h 2017-04-19 11:20:42.000000000 -0600
222 +++ b/src/ltm.h 2019-07-02 09:25:42.634694666 -0600
223 @@ -55,10 +55,10 @@ typedef enum {
224 LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS];
225
226
227 -LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o);
228 +LUA_API const char *luaT_objtypename (lua_State *L, const TValue *o);
229
230 LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
231 -LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
232 +LUA_API const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
233 TMS event);
234 LUAI_FUNC void luaT_init (lua_State *L);
235
236 @@ -66,9 +66,9 @@ LUAI_FUNC void luaT_callTM (lua_State *L
237 const TValue *p2, TValue *p3, int hasres);
238 LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
239 StkId res, TMS event);
240 -LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
241 +LUA_API void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
242 StkId res, TMS event);
243 -LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1,
244 +LUA_API int luaT_callorderTM (lua_State *L, const TValue *p1,
245 const TValue *p2, TMS event);
246
247
248 --- a/src/lundump.h 2017-04-19 11:20:42.000000000 -0600
249 +++ b/src/lundump.h 2019-07-02 09:25:42.634694666 -0600
250 @@ -23,10 +23,10 @@
251 #define LUAC_FORMAT 0 /* this is the official format */
252
253 /* load one chunk; from lundump.c */
254 -LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
255 +LUA_API LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
256
257 /* dump one chunk; from ldump.c */
258 -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
259 +LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
260 void* data, int strip);
261
262 #endif
263 --- a/src/lzio.h 2017-04-19 11:20:42.000000000 -0600
264 +++ b/src/lzio.h 2019-07-02 09:25:42.634694666 -0600
265 @@ -61,6 +61,6 @@ struct Zio {
266 };
267
268
269 -LUAI_FUNC int luaZ_fill (ZIO *z);
270 +LUA_API int luaZ_fill (ZIO *z);
271
272 #endif
273 --- a/src/Makefile 2019-07-02 09:24:57.554332875 -0600
274 +++ b/src/Makefile 2019-07-02 09:25:42.630694635 -0600
275 @@ -29,6 +29,7 @@ MYOBJS=
276 PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
277
278 LUA_A= liblua$V.a
279 +LUA_SO= liblua$V.so.0.0.0
280 CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
281 lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
282 ltm.o lundump.o lvm.o lzio.o
283 @@ -43,8 +44,9 @@ LUAC_T= luac$V
284 LUAC_O= luac.o
285
286 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
287 -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
288 +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
289 ALL_A= $(LUA_A)
290 +ALL_SO= $(LUA_SO)
291
292 # Targets start here.
293 default: $(PLAT)
294 @@ -55,14 +57,25 @@ o: $(ALL_O)
295
296 a: $(ALL_A)
297
298 +so: $(ALL_SO)
299 +
300 $(LUA_A): $(BASE_O)
301 $(AR) $@ $(BASE_O)
302 $(RANLIB) $@
303
304 -$(LUA_T): $(LUA_O) $(LUA_A)
305 - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
306 +$(LUA_SO): $(CORE_O) $(LIB_O)
307 + $(CC) -o $@ -Wl,-Bsymbolic-functions -shared -Wl,-soname="$@" $?
308 + ln -fs $@ liblua$V.so.0.0
309 + ln -fs $@ liblua$V.so.0
310 + ln -fs $@ liblua$V.so
311 +
312 +$(LUA_T): $(LUA_O) $(LUA_SO)
313 + $(CC) -o $@ -L. -llua$V $(MYLDFLAGS) $(LUA_O) $(LIBS)
314 +
315 +$(LUAC_T): $(LUAC_O) $(LUA_SO)
316 + $(CC) -o $@ -L. -llua$V $(MYLDFLAGS) $(LUAC_O) $(LIBS)
317
318 -$(LUAC_T): $(LUAC_O) $(LUA_A)
319 +$(LUAC_T)-host: $(LUAC_O) $(LUA_A)
320 $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
321
322 clean: