lua-shared-libs.patch 5.3 KB

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