lua-02-shared-libs-for-lua.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Add the compilation of a shared library.
  2. Compile the lua binary with the shared library.
  3. Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
  4. Index: b/src/Makefile
  5. ===================================================================
  6. --- a/src/Makefile
  7. +++ b/src/Makefile
  8. @@ -29,6 +29,7 @@
  9. PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
  10. LUA_A= liblua.a
  11. +LUA_SO= liblua.so
  12. CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
  13. lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
  14. ltm.o lundump.o lvm.o lzio.o
  15. @@ -43,8 +44,9 @@
  16. LUAC_O= luac.o
  17. ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
  18. -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
  19. +ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
  20. ALL_A= $(LUA_A)
  21. +ALL_SO= $(LUA_SO)
  22. # Targets start here.
  23. default: $(PLAT)
  24. @@ -55,12 +57,18 @@
  25. a: $(ALL_A)
  26. +so: $(ALL_SO)
  27. +
  28. $(LUA_A): $(BASE_O)
  29. $(AR) $@ $(BASE_O)
  30. $(RANLIB) $@
  31. -$(LUA_T): $(LUA_O) $(LUA_A)
  32. - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
  33. +$(LUA_SO): $(CORE_O) $(LIB_O)
  34. + $(CC) -o $@.$(PKG_VERSION) -shared -Wl,-soname="$@.$(PKG_VERSION)" $?
  35. + ln -fs $@.$(PKG_VERSION) $@
  36. +
  37. +$(LUA_T): $(LUA_O) $(LUA_SO)
  38. + $(CC) -o $@ -L. $(LDFLAGS) $(LUA_O) -llua $(LIBS)
  39. $(LUAC_T): $(LUAC_O) $(LUA_A)
  40. $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)