lua-5.4.2-shared_library-1.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Submitted By: Douglas R. Reno <renodr at linuxfromscratch dot org>
  2. Date: 2020-06-30
  3. Initial Package Version: 5.4.0
  4. Upstream Status: Rejected
  5. Origin: Arch Linux, with some modifications
  6. Description: Creates a shared liblua library, as well as
  7. removes optimization since it causes SIGBUS errors,
  8. and sets the search path to /usr from /usr/local.
  9. The initial version of this patch was created by
  10. Igor Zivkovic, before being rediffed for 5.4.0 by
  11. myself with some modifications made.
  12. diff -Naurp lua-5.4.0.orig/Makefile lua-5.4.0/Makefile
  13. --- lua-5.4.0.orig/Makefile 2020-04-15 07:55:07.000000000 -0500
  14. +++ lua-5.4.0/Makefile 2020-06-30 13:22:00.997938585 -0500
  15. @@ -52,7 +52,7 @@ R= $V.0
  16. all: $(PLAT)
  17. $(PLATS) help test clean:
  18. - @cd src && $(MAKE) $@
  19. + @cd src && $(MAKE) $@ V=$(V) R=$(R)
  20. install: dummy
  21. cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
  22. diff -Naurp lua-5.4.0.orig/src/luaconf.h lua-5.4.0/src/luaconf.h
  23. --- lua-5.4.0.orig/src/luaconf.h 2020-06-18 09:25:54.000000000 -0500
  24. +++ lua-5.4.0/src/luaconf.h 2020-06-30 13:24:59.294932289 -0500
  25. @@ -227,7 +227,7 @@
  26. #else /* }{ */
  27. -#define LUA_ROOT "/usr/local/"
  28. +#define LUA_ROOT "/usr/"
  29. #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
  30. #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
  31. diff -Naurp lua-5.4.0.orig/src/Makefile lua-5.4.0/src/Makefile
  32. --- lua-5.4.0.orig/src/Makefile 2020-04-15 08:00:29.000000000 -0500
  33. +++ lua-5.4.0/src/Makefile 2020-06-30 13:24:15.746933827 -0500
  34. @@ -7,7 +7,7 @@
  35. PLAT= guess
  36. CC= gcc -std=gnu99
  37. -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
  38. +CFLAGS= -fPIC -O0 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1 $(SYSCFLAGS) $(MYCFLAGS)
  39. LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
  40. LIBS= -lm $(SYSLIBS) $(MYLIBS)
  41. @@ -33,6 +33,7 @@ CMCFLAGS= -Os
  42. PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
  43. LUA_A= liblua.a
  44. +LUA_SO= liblua.so
  45. 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
  46. 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
  47. BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
  48. @@ -44,7 +45,7 @@ LUAC_T= luac
  49. LUAC_O= luac.o
  50. ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
  51. -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
  52. +ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
  53. ALL_A= $(LUA_A)
  54. # Targets start here.
  55. @@ -60,6 +61,12 @@ $(LUA_A): $(BASE_O)
  56. $(AR) $@ $(BASE_O)
  57. $(RANLIB) $@
  58. +$(LUA_SO): $(CORE_O) $(LIB_O)
  59. + $(CC) -shared -ldl -Wl,--soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm
  60. + $(MYLDFLAGS)
  61. + ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
  62. + ln -sf $(LUA_SO).$(R) $(LUA_SO)
  63. +
  64. $(LUA_T): $(LUA_O) $(LUA_A)
  65. $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)