aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk2
-rw-r--r--gnu/packages/lua.scm12
-rw-r--r--gnu/packages/patches/lua-5.4-liblua-so.patch33
-rw-r--r--gnu/packages/patches/lua-5.4-pkgconfig.patch110
4 files changed, 157 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 25e41cbf3f..5e140d2aed 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1450,6 +1450,8 @@ dist_patch_DATA = \
%D%/packages/patches/lua51-liblua-so.patch \
%D%/packages/patches/lua51-pkgconfig.patch \
%D%/packages/patches/lua-liblua-so.patch \
+ %D%/packages/patches/lua-5.4-pkgconfig.patch \
+ %D%/packages/patches/lua-5.4-liblua-so.patch \
%D%/packages/patches/luajit-no_ldconfig.patch \
%D%/packages/patches/luit-posix.patch \
%D%/packages/patches/lvm2-static-link.patch \
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index ff4d4824eb..99f09a26f1 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -105,6 +105,18 @@ automatic memory management with incremental garbage collection, making it ideal
for configuration, scripting, and rapid prototyping.")
(license license:x11)))
+(define-public lua-5.4
+ (package (inherit lua)
+ (version "5.4.3")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://www.lua.org/ftp/lua-"
+ version ".tar.gz"))
+ (sha256
+ (base32 "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq"))
+ (patches (search-patches "lua-5.4-pkgconfig.patch"
+ "lua-5.4-liblua-so.patch"))))))
+
(define-public lua-5.2
(package (inherit lua)
(version "5.2.4")
diff --git a/gnu/packages/patches/lua-5.4-liblua-so.patch b/gnu/packages/patches/lua-5.4-liblua-so.patch
new file mode 100644
index 0000000000..93dd011143
--- /dev/null
+++ b/gnu/packages/patches/lua-5.4-liblua-so.patch
@@ -0,0 +1,33 @@
+Patch the makefile to create liblua.so.
+
+--- a/src/Makefile 2021-02-09 18:47:17.000000000 +0000
++++ b/src/Makefile 2022-01-03 11:30:36.964501941 +0000
+@@ -33,6 +33,7 @@
+ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
+
+ LUA_A= liblua.a
++LUA_SO= liblua.so
+ 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
+ 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
+ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+@@ -44,7 +45,7 @@
+ LUAC_O= luac.o
+
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
+ ALL_A= $(LUA_A)
+
+ # Targets start here.
+@@ -56,6 +57,11 @@
+
+ a: $(ALL_A)
+
++$(LUA_SO): $(CORE_O) $(LIB_O)
++ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
++ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
++ ln -sf $(LUA_SO).$(R) $(LUA_SO)
++
+ $(LUA_A): $(BASE_O)
+ $(AR) $@ $(BASE_O)
+ $(RANLIB) $@
diff --git a/gnu/packages/patches/lua-5.4-pkgconfig.patch b/gnu/packages/patches/lua-5.4-pkgconfig.patch
new file mode 100644
index 0000000000..eb42633585
--- /dev/null
+++ b/gnu/packages/patches/lua-5.4-pkgconfig.patch
@@ -0,0 +1,110 @@
+Enables generating Lua's pkg-config file.
+
+http://lua-users.org/lists/lua-l/2015-03/msg00338.html
+
+--- a/Makefile 2022-01-03 12:06:37.760402709 +0000
++++ b/Makefile 2022-01-03 12:06:49.568402167 +0000
+@@ -14,6 +14,7 @@
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+ INSTALL_INC= $(INSTALL_TOP)/include
+ INSTALL_LIB= $(INSTALL_TOP)/lib
++INSTALL_PC= $(INSTALL_LIB)/pkgconfig
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+ INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+ INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+@@ -39,9 +40,12 @@
+ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
+
+ # What to install.
+-TO_BIN= lua luac
++INTERPRETER= lua
++COMPILER= luac
++TO_BIN= $(INTERPRETER) $(COMPILER)
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.a liblua.so liblua.so.${V}
++TO_PC= lua-$(V).pc
+ TO_MAN= lua.1 luac.1
+
+ # Lua version and release.
+@@ -51,20 +55,26 @@
+ # Targets start here.
+ all: $(PLAT)
+
+-$(PLATS) help test clean:
+- @cd src && $(MAKE) $@
++$(PLATS):
++ @cd src && $(MAKE) $@ V=$(V) R=$(R)
+
+-install: dummy
+- cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
++clean:
++ cd src && $(MAKE) $@
++ $(RM) $(TO_PC)
++
++install: dummy $(TO_PC)
++ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
++ cd src && $(INSTALL_EXEC) $(TO_LIB) $(INSTALL_LIB)
++ cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+
+ uninstall:
+ cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
+ cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
+ cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB)
++ cd src && cd $(INSTALL_PC) && $(RM) $(TO_PC)
+ cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN)
+
+ local:
+@@ -82,11 +92,13 @@
+ @echo "TO_BIN= $(TO_BIN)"
+ @echo "TO_INC= $(TO_INC)"
+ @echo "TO_LIB= $(TO_LIB)"
++ @echo "TO_PC= $(TO_PC)"
+ @echo "TO_MAN= $(TO_MAN)"
+ @echo "INSTALL_TOP= $(INSTALL_TOP)"
+ @echo "INSTALL_BIN= $(INSTALL_BIN)"
+ @echo "INSTALL_INC= $(INSTALL_INC)"
+ @echo "INSTALL_LIB= $(INSTALL_LIB)"
++ @echo "INSTALL_PC= $(INSTALL_PC)"
+ @echo "INSTALL_MAN= $(INSTALL_MAN)"
+ @echo "INSTALL_LMOD= $(INSTALL_LMOD)"
+ @echo "INSTALL_CMOD= $(INSTALL_CMOD)"
+@@ -95,12 +107,29 @@
+
+ # Echo pkg-config data.
+ pc:
+- @echo "version=$R"
+- @echo "prefix=$(INSTALL_TOP)"
+- @echo "libdir=$(INSTALL_LIB)"
+- @echo "includedir=$(INSTALL_INC)"
++ @echo 'prefix=$(INSTALL_TOP)'
++ @echo 'libdir=$(INSTALL_LIB)'
++ @echo 'includedir=$(INSTALL_INC)'
++ @echo 'bindir=$(INSTALL_BIN)'
++ @echo
++ @echo 'INSTALL_LMOD=$(INSTALL_LMOD)'
++ @echo 'INSTALL_CMOD=$(INSTALL_CMOD)'
++ @echo 'INTERPRETER=$${bindir}/$(INTERPRETER)'
++ @echo 'COMPILER=$${bindir}/$(COMPILER)'
++ @echo
++ @echo 'Name: Lua'
++ @echo 'Description: A powerful, fast, lightweight, embeddable scripting language'
++ @echo 'Version: $(R)'
++ @echo
++ @echo 'Libs: -L$${libdir} -llua -lm'
++ @echo 'Cflags: -I$${includedir}'
++
++pkg-config: $(TO_PC)
++$(TO_PC):
++ @$(MAKE) -s pc > $@
++
+
+ # Targets that do not create files (not all makes understand .PHONY).
+-.PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc
++.PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc pkg-config
+
+ # (end of Makefile)