The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / lua / 5.1.5 / 0002-shared-libs-for-lua.patch
1 Add the compilation of a shared library.
2 Compile the lua binary with the shared library.
3 And install the shared library.
4 The variable BUILDMODE allows to switch between static and dynamic mode.
5
6 Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
7
8 Index: b/Makefile
9 ===================================================================
10 --- a/Makefile
11 +++ b/Makefile
12 @@ -44,6 +44,7 @@
13  TO_BIN= lua luac
14  TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
15  TO_LIB= liblua.a
16 +TO_SOLIB = liblua.so.$(R)
17  TO_MAN= lua.1 luac.1
18  
19  # Lua version and release.
20 @@ -61,6 +62,8 @@
21  install: dummy
22         cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
23         cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
24 +       test -f src/$(TO_SOLIB) && cd src && $(INSTALL_EXEC) $(TO_SOLIB) $(INSTALL_LIB) || :
25 +       test -f src/$(TO_SOLIB) && ln -sf $(TO_SOLIB) $(INSTALL_LIB)/liblua.so || :
26         cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
27         cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
28         cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
29 Index: b/src/Makefile
30 ===================================================================
31 --- a/src/Makefile
32 +++ b/src/Makefile
33 @@ -23,6 +23,7 @@
34  PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
35  
36  LUA_A= liblua.a
37 +LUA_SO=        liblua.so
38  CORE_O=        lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
39         lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o  \
40         lundump.o lvm.o lzio.o
41 @@ -36,8 +37,13 @@
42  LUAC_O=        luac.o print.o
43  
44  ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
45 +ifneq (dynamic,$(BUILDMODE))
46  ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
47 +else
48 +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
49 +endif
50  ALL_A= $(LUA_A)
51 +ALL_SO= $(LUA_SO)
52  
53  default: $(PLAT)
54  
55 @@ -47,12 +53,23 @@
56  
57  a:     $(ALL_A)
58  
59 +so:    $(ALL_SO)
60 +
61  $(LUA_A): $(CORE_O) $(LIB_O)
62         $(AR) $@ $(CORE_O) $(LIB_O)     # DLL needs all object files
63         $(RANLIB) $@
64  
65 +$(LUA_SO): $(CORE_O) $(LIB_O)
66 +       $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
67 +       ln -fs $@.$(PKG_VERSION) $@
68 +
69 +ifneq (dynamic,$(BUILDMODE))
70  $(LUA_T): $(LUA_O) $(LUA_A)
71         $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
72 +else
73 +$(LUA_T): $(LUA_O) $(LUA_SO)
74 +       $(CC) -o $@ -L. $(MYLDFLAGS) $(LUA_O) -llua $(LIBS)
75 +endif
76  
77  $(LUAC_T): $(LUAC_O) $(LUA_A)
78         $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)