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