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