1
0

020-shared_liblua.patch 4.5 KB

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