1
0
Fork 0

lang/lua: New port

This commit is contained in:
ffqq 2024-01-23 14:48:00 +03:00
parent 242b479d63
commit ff7d1f9601
3 changed files with 157 additions and 0 deletions

54
lang/lua/SCHEMATIC Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
name="lua"
short_desc="Small, compilable scripting language providing easy access to C code"
desc="Lua is a programming language originally designed for extending applications,
but also frequently used as a general-purpose, stand-alone language. Lua
combines simple procedural syntax (similar to Pascal) with powerful data
description constructs based on associative arrays and extensible semantics.
Lua is dynamically typed, interpreted from bytecodes, and has automatic memory
management with garbage collection, making it ideal for configuration,
scripting, and rapid prototyping.
A fundamental concept in the design of Lua is to provide meta-mechanisms for
implementing features, instead of providing a host of features directly in
the language. For example, although Lua is not a pure object-oriented
language, it does provide meta-mechanisms for implementing classes and
inheritance. Lua's meta-mechanisms bring an economy of concepts and keep the
language small, while allowing the semantics to be extended in unconventional
ways. Extensible semantics is a distinguishing feature of Lua.
Lua is implemented as a small library of C functions, written in ANSI C, and
compiles unmodified in all known platforms. The implementation goals are
simplicity, efficiency, portability, and low embedding cost."
category="lang"
version="5.4.6"
maintainer="ffqq@danwin1210.de"
www="https://www.lua.org/"
master_site="https://www.lua.org/ftp"
source_name="$name-$version.tar.gz"
license_logic="single" # accepted values: single, and, or
licenses=("MIT")
build_dependencies=("devel/gmake" "lang/gcc" "devel/ncurses")
run_dependencies=("system/glibc" "devel/ncurses")
build_process() {
cd $name-$version
cp -v $TAMANDUA_FILES_DIR/lua.pc .
patch -Np1 -i $TAMANDUA_FILES_DIR/lua-5.4.6-shared_library-1.patch
sed "s/install -p/install/" Makefile > _
mv -f _ Makefile
sed "s|/usr/local|/usr|g" src/luaconf.h > _
mv -f _ src/luaconf.h
make linux
make INSTALL_TOP=$TAMANDUA_STAGE_DIR/usr \
INSTALL_MAN=$TAMANDUA_STAGE_DIR/usr/share/man/man1 \
install
mkdir -pv $TAMANDUA_STAGE_DIR/usr/share/doc/lua-5.4.6
mkdir -pv $TAMANDUA_STAGE_DIR/usr/lib/pkgconfig
cp -v doc/*.{html,css,gif,png} $TAMANDUA_STAGE_DIR/usr/share/doc/lua-5.4.6
cp -v lua.pc $TAMANDUA_STAGE_DIR/usr/lib/pkgconfig/lua.pc
}

View File

@ -0,0 +1,83 @@
Submitted By: Xi Ruoyao <xry111 at xry111 dot site>
Date: 2022-09-16
Initial Package Version: 5.4.4
Upstream Status: Rejected
Origin: Arch Linux, with some modifications
Description: 2020-06-30 renodr:
Creates a shared liblua library, as well as
removes optimization since it causes SIGBUS errors,
and sets the search path to /usr from /usr/local.
The initial version of this patch was created by
Igor Zivkovic, before being rediffed for 5.4.0 by
myself with some modifications made.
2022-09-16 xry111:
Remove an extra newline before $(MYLDFLAGS).
MYLDFLAGS is empty by default so it does not break
BLFS build, but it may break a custom build with
tuning or hardening.
diff -Naurp lua-5.4.0.orig/Makefile lua-5.4.0/Makefile
--- lua-5.4.0.orig/Makefile 2020-04-15 07:55:07.000000000 -0500
+++ lua-5.4.0/Makefile 2020-06-30 13:22:00.997938585 -0500
@@ -52,7 +52,7 @@ R= $V.0
all: $(PLAT)
$(PLATS) help test clean:
- @cd src && $(MAKE) $@
+ @cd src && $(MAKE) $@ V=$(V) R=$(R)
install: dummy
cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
diff -Naurp lua-5.4.0.orig/src/luaconf.h lua-5.4.0/src/luaconf.h
--- lua-5.4.0.orig/src/luaconf.h 2020-06-18 09:25:54.000000000 -0500
+++ lua-5.4.0/src/luaconf.h 2020-06-30 13:24:59.294932289 -0500
@@ -227,7 +227,7 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
diff -Naurp lua-5.4.0.orig/src/Makefile lua-5.4.0/src/Makefile
--- lua-5.4.0.orig/src/Makefile 2020-04-15 08:00:29.000000000 -0500
+++ lua-5.4.0/src/Makefile 2020-06-30 13:24:15.746933827 -0500
@@ -7,7 +7,7 @@
PLAT= guess
CC= gcc -std=gnu99
-CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_3 $(SYSCFLAGS) $(MYCFLAGS)
+CFLAGS= -fPIC -O0 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1 $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS)
@@ -33,6 +33,7 @@ CMCFLAGS= -Os
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_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.
@@ -60,6 +61,11 @@ $(LUA_A): $(BASE_O)
$(AR) $@ $(BASE_O)
$(RANLIB) $@
+$(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_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)

20
lang/lua/files/lua.pc Normal file
View File

@ -0,0 +1,20 @@
V=5.4
R=5.4.6
prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/share/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua -lm -ldl
Cflags: -I${includedir}