liblua.so.patch 3.3 KB

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