gnu: lua: Add version 5.4.3.

* gnu/packages/lua.scm (lua-5.4): New variable.
* gnu/packages/patches/lua-5.4-liblua-so.patch,
gnu/packages/patches/lua-5.4-pkgconfig.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Alex Devaure 2022-01-11 12:21:13 +00:00 committed by Ludovic Courtès
parent 197579417d
commit 2c9902cae9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
4 changed files with 157 additions and 0 deletions

View file

@ -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 \

View file

@ -105,6 +105,18 @@ (define-public lua
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")

View file

@ -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) $@

View file

@ -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)