lua: add new package with version 5.4
[feed/packages.git] / lang / lua5.4 / patches / 020-shared_liblua.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -41,7 +41,7 @@ PLATS= guess aix bsd c89 freebsd generic
4 # What to install.
5 TO_BIN= lua$V luac$V
6 TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
7 -TO_LIB= liblua$V.a
8 +TO_LIB= liblua$V.a liblua$V.so.0.0.0
9 TO_MAN= lua$V.1 luac$V.1
10
11 # Lua version and release.
12 @@ -59,6 +59,9 @@ 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$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so.0.0
17 + ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so.0
18 + ln -s liblua$V.so.0.0.0 $(INSTALL_LIB)/liblua$V.so
19 cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
20
21 uninstall:
22 --- a/src/ldebug.h
23 +++ b/src/ldebug.h
24 @@ -36,7 +36,7 @@
25 #endif
26
27
28 -LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc);
29 +LUA_API int luaG_getfuncline (const Proto *f, int pc);
30 LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
31 StkId *pos);
32 LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
33 --- a/src/lstring.h
34 +++ b/src/lstring.h
35 @@ -50,7 +50,7 @@ LUAI_FUNC void luaS_init (lua_State *L);
36 LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
37 LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue);
38 LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
39 -LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
40 +LUA_API TString *luaS_new (lua_State *L, const char *str);
41 LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
42
43
44 --- a/src/lundump.h
45 +++ b/src/lundump.h
46 @@ -30,7 +30,7 @@
47 LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
48
49 /* dump one chunk; from ldump.c */
50 -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
51 +LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
52 void* data, int strip);
53
54 #endif
55 --- a/src/lzio.h
56 +++ b/src/lzio.h
57 @@ -44,7 +44,7 @@ typedef struct Mbuffer {
58 #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)
59
60
61 -LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,
62 +LUA_API void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader,
63 void *data);
64 LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */
65
66 --- a/src/Makefile
67 +++ b/src/Makefile
68 @@ -33,6 +33,7 @@ CMCFLAGS=
69 PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris
70
71 LUA_A= liblua$V.a
72 +LUA_SO= liblua$V.so.0.0.0
73 CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
74 LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
75 BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
76 @@ -44,8 +45,9 @@ LUAC_T= luac$V
77 LUAC_O= luac.o
78
79 ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
80 -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
81 +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
82 ALL_A= $(LUA_A)
83 +ALL_SO= $(LUA_SO)
84
85 # Targets start here.
86 default: $(PLAT)
87 @@ -56,14 +58,25 @@ o: $(ALL_O)
88
89 a: $(ALL_A)
90
91 +so: $(ALL_SO)
92 +
93 $(LUA_A): $(BASE_O)
94 $(AR) $@ $(BASE_O)
95 $(RANLIB) $@
96
97 -$(LUA_T): $(LUA_O) $(LUA_A)
98 - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
99 +$(LUA_SO): $(CORE_O) $(LIB_O)
100 + $(CC) -o $@ -Wl,-Bsymbolic-functions -shared -Wl,-soname="$@" $?
101 + ln -fs $@ liblua$V.so.0.0
102 + ln -fs $@ liblua$V.so.0
103 + ln -fs $@ liblua$V.so
104 +
105 +$(LUA_T): $(LUA_O) $(LUA_SO)
106 + $(CC) -o $@ -L. -llua$V $(MYLDFLAGS) $(LUA_O) $(LIBS)
107 +
108 +$(LUAC_T): $(LUAC_O) $(LUA_SO)
109 + $(CC) -o $@ -L. -llua$V $(MYLDFLAGS) $(LUAC_O) $(LIBS)
110
111 -$(LUAC_T): $(LUAC_O) $(LUA_A)
112 +$(LUAC_T)-host: $(LUAC_O) $(LUA_A)
113 $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
114
115 test: