2
1

lua-03-shared-libs-for-luac.patch 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. Compile the luac binary with the shared library.
  2. Many internal functions (LUAI_FUNC) must be exported (LUA_API).
  3. Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
  4. Index: b/src/ldo.h
  5. ===================================================================
  6. --- a/src/ldo.h
  7. +++ b/src/ldo.h
  8. @@ -46,7 +46,7 @@
  9. LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
  10. LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
  11. LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
  12. -LUAI_FUNC void luaD_growstack (lua_State *L, int n);
  13. +LUA_API void luaD_growstack (lua_State *L, int n);
  14. LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
  15. LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
  16. Index: b/src/lfunc.h
  17. ===================================================================
  18. --- a/src/lfunc.h
  19. +++ b/src/lfunc.h
  20. @@ -18,7 +18,7 @@
  21. cast(int, sizeof(TValue *)*((n)-1)))
  22. -LUAI_FUNC Proto *luaF_newproto (lua_State *L);
  23. +LUA_API Proto *luaF_newproto (lua_State *L);
  24. LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
  25. LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
  26. LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
  27. Index: b/src/lmem.h
  28. ===================================================================
  29. --- a/src/lmem.h
  30. +++ b/src/lmem.h
  31. @@ -38,9 +38,9 @@
  32. ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
  33. -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
  34. +LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
  35. size_t size);
  36. -LUAI_FUNC void *luaM_toobig (lua_State *L);
  37. +LUA_API void *luaM_toobig (lua_State *L);
  38. LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
  39. size_t size_elem, int limit,
  40. const char *errormsg);
  41. Index: b/src/lstring.h
  42. ===================================================================
  43. --- a/src/lstring.h
  44. +++ b/src/lstring.h
  45. @@ -25,7 +25,7 @@
  46. LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
  47. LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
  48. -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  49. +LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  50. #endif
  51. Index: b/src/lundump.h
  52. ===================================================================
  53. --- a/src/lundump.h
  54. +++ b/src/lundump.h
  55. @@ -17,7 +17,7 @@
  56. LUAI_FUNC void luaU_header (char* h);
  57. /* dump one chunk; from ldump.c */
  58. -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
  59. +LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
  60. #ifdef luac_c
  61. /* print one chunk; from print.c */
  62. Index: b/src/Makefile
  63. ===================================================================
  64. --- a/src/Makefile
  65. +++ b/src/Makefile
  66. @@ -34,7 +34,7 @@
  67. LUA_O= lua.o
  68. LUAC_T= luac
  69. -LUAC_O= luac.o print.o
  70. +LUAC_O= luac.o print.o lopcodes.o
  71. ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
  72. ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
  73. @@ -62,8 +62,8 @@
  74. $(LUA_T): $(LUA_O) $(LUA_SO)
  75. $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS)
  76. -$(LUAC_T): $(LUAC_O) $(LUA_A)
  77. - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
  78. +$(LUAC_T): $(LUAC_O) $(LUA_SO)
  79. + $(CC) -o $@ -L. $(MYLDFLAGS) $(LUAC_O) -llua $(LIBS)
  80. clean:
  81. $(RM) $(ALL_T) $(ALL_O)