5e041512fcb5be0af03116a80a3a892540d8f277
[openwrt/svn-archive/archive.git] / lang / lua / patches / 010-shared_liblua.patch
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4
5 diff -ruN lua-5.1.1-old/Makefile lua-5.1.1-new/Makefile
6 --- lua-5.1.1-old/Makefile 2006-06-02 12:53:38.000000000 +0200
7 +++ lua-5.1.1-new/Makefile 2007-01-09 02:10:39.000000000 +0100
8 @@ -42,7 +42,7 @@
9 # What to install.
10 TO_BIN= lua luac
11 TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
12 -TO_LIB= liblua.a
13 +TO_LIB= liblua.a liblua.so liblua.so.$R
14 TO_MAN= lua.1 luac.1
15
16 # Lua version and release.
17 diff -ruN lua-5.1.1-old/src/Makefile lua-5.1.1-new/src/Makefile
18 --- lua-5.1.1-old/src/Makefile 2006-03-22 01:41:49.000000000 +0100
19 +++ lua-5.1.1-new/src/Makefile 2007-01-09 02:10:45.000000000 +0100
20 @@ -23,6 +23,7 @@
21 PLATS= aix ansi bsd generic linux macosx mingw posix solaris
22
23 LUA_A= liblua.a
24 +LUA_SO= liblua.so
25 CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
26 lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
27 lundump.o lvm.o lzio.o
28 @@ -33,11 +34,12 @@
29 LUA_O= lua.o
30
31 LUAC_T= luac
32 -LUAC_O= luac.o print.o
33 +LUAC_O= luac.o print.o lopcodes.o
34
35 ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
36 -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
37 +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
38 ALL_A= $(LUA_A)
39 +ALL_SO= $(LUA_SO)
40
41 default: $(PLAT)
42
43 @@ -47,15 +49,21 @@
44
45 a: $(ALL_A)
46
47 +so: $(ALL_SO)
48 +
49 $(LUA_A): $(CORE_O) $(LIB_O)
50 $(AR) $@ $?
51 $(RANLIB) $@
52
53 -$(LUA_T): $(LUA_O) $(LUA_A)
54 - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
55 +$(LUA_SO): $(CORE_O) $(LIB_O)
56 + $(LD) -o $@.$(PKG_VERSION) -shared -soname="$@.$(PKG_VERSION)" $?
57 + ln -fs $@.$(PKG_VERSION) $@
58 +
59 +$(LUA_T): $(LUA_O) $(LUA_SO)
60 + $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUA_O) $(LIBS)
61
62 -$(LUAC_T): $(LUAC_O) $(LUA_A)
63 - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
64 +$(LUAC_T): $(LUAC_O) $(LUA_SO)
65 + $(CC) -o $@ -L. -llua $(MYLDFLAGS) $(LUAC_O) $(LIBS)
66
67 clean:
68 $(RM) $(ALL_T) $(ALL_O)
69 @@ -92,7 +100,7 @@
70 $(MAKE) all MYCFLAGS=
71
72 linux:
73 - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
74 + $(MAKE) all MYCFLAGS+=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
75
76 macosx:
77 $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
78 diff -ruN lua-5.1.1-old/src/ldo.h lua-5.1.1-new/src/ldo.h
79 --- lua-5.1.1-old/src/ldo.h 2005-08-24 18:15:49.000000000 +0200
80 +++ lua-5.1.1-new/src/ldo.h 2007-01-09 02:10:45.000000000 +0100
81 @@ -46,7 +46,7 @@
82 LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
83 LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
84 LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
85 -LUAI_FUNC void luaD_growstack (lua_State *L, int n);
86 +LUA_API void luaD_growstack (lua_State *L, int n);
87
88 LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
89 LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
90 diff -ruN lua-5.1.1-old/src/lfunc.h lua-5.1.1-new/src/lfunc.h
91 --- lua-5.1.1-old/src/lfunc.h 2005-04-25 21:24:10.000000000 +0200
92 +++ lua-5.1.1-new/src/lfunc.h 2007-01-09 02:10:45.000000000 +0100
93 @@ -18,7 +18,7 @@
94 cast(int, sizeof(TValue *)*((n)-1)))
95
96
97 -LUAI_FUNC Proto *luaF_newproto (lua_State *L);
98 +LUA_API Proto *luaF_newproto (lua_State *L);
99 LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
100 LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
101 LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
102 diff -ruN lua-5.1.1-old/src/lmem.h lua-5.1.1-new/src/lmem.h
103 --- lua-5.1.1-old/src/lmem.h 2005-04-25 21:24:10.000000000 +0200
104 +++ lua-5.1.1-new/src/lmem.h 2007-01-09 02:10:45.000000000 +0100
105 @@ -38,9 +38,9 @@
106 ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
107
108
109 -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
110 +LUA_API void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
111 size_t size);
112 -LUAI_FUNC void *luaM_toobig (lua_State *L);
113 +LUA_API void *luaM_toobig (lua_State *L);
114 LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
115 size_t size_elem, int limit,
116 const char *errormsg);
117 diff -ruN lua-5.1.1-old/src/lstring.h lua-5.1.1-new/src/lstring.h
118 --- lua-5.1.1-old/src/lstring.h 2005-04-25 21:24:10.000000000 +0200
119 +++ lua-5.1.1-new/src/lstring.h 2007-01-09 02:10:45.000000000 +0100
120 @@ -25,7 +25,7 @@
121
122 LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
123 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
124 -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
125 +LUA_API TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
126
127
128 #endif
129 diff -ruN lua-5.1.1-old/src/lundump.h lua-5.1.1-new/src/lundump.h
130 --- lua-5.1.1-old/src/lundump.h 2005-11-11 15:03:13.000000000 +0100
131 +++ lua-5.1.1-new/src/lundump.h 2007-01-09 02:10:45.000000000 +0100
132 @@ -17,7 +17,7 @@
133 LUAI_FUNC void luaU_header (char* h);
134
135 /* dump one chunk; from ldump.c */
136 -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
137 +LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
138
139 #ifdef luac_c
140 /* print one chunk; from print.c */