lua 5.4.7

This commit is contained in:
Dmitrii Tochanskii 2025-10-01 16:28:20 +00:00
commit e71dae212b
3 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,53 @@
diff --git a/Makefile b/Makefile
index 72ca8ff..b58b800 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,7 @@ PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw p
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua-5.4.so
TO_MAN= lua.1 luac.1
# Lua version and release.
diff --git a/src/Makefile b/src/Makefile
index b771196..673f5fb 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -7,7 +7,7 @@
PLAT= guess
CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
+CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -fPIC $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
@@ -33,6 +33,7 @@ CMCFLAGS=
PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua-5.4.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_T= luac
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.
@@ -66,6 +67,9 @@ $(LUA_T): $(LUA_O) $(LUA_A)
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -o $@ -shared $?
+
test:
./$(LUA_T) -v

19
0002-update-path.patch Normal file
View file

@ -0,0 +1,19 @@
diff --git a/Makefile b/Makefile
index b58b800..bbbd3b9 100644
--- a/Makefile
+++ b/Makefile
@@ -10,11 +10,11 @@ PLAT= guess
# so take care if INSTALL_TOP is not an absolute path. See the local target.
# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
-INSTALL_TOP= /usr/local
+INSTALL_TOP= /usr/
INSTALL_BIN= $(INSTALL_TOP)/bin
INSTALL_INC= $(INSTALL_TOP)/include
-INSTALL_LIB= $(INSTALL_TOP)/lib
-INSTALL_MAN= $(INSTALL_TOP)/man/man1
+INSTALL_LIB= $(INSTALL_TOP)/lib64
+INSTALL_MAN= $(INSTALL_TOP)/share/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V

43
lua.spec Normal file
View file

@ -0,0 +1,43 @@
Name: lua
Version: 5.4.7
Release: 1%{?dist}
Summary: A powerful light-weight programming language designed for extending applications
License: MIT
URL: https://www.lua.org/
Source0: https://www.lua.org/ftp/lua-%{version}.tar.gz
Patch0: 0001-add-shared-library.patch
Patch1: 0002-update-path.patch
BuildRequires: gcc
Requires: bash
%description
%prep
%setup -q
%patch -P0 -p1
%patch -P1 -p1
%build
%make_build
%install
%make_install INSTALL_TOP=%{buildroot}/usr
%files
%{_bindir}
%{_libdir}
%{_mandir}
%{_includedir}
%changelog
* Wed Oct 01 2025 Dmitrii Tochanskii <tochansky@tochlab.ru>
-