020-shared_liblua.patch 13 KB

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