Initial commit

This commit is contained in:
2025-12-30 19:06:24 +02:00
commit ea5771c59b
8 changed files with 193 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Exclude bpm archives
*.bpm
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
# Ignore this package
echo "ignore"
+15
View File
@@ -0,0 +1,15 @@
name: lua5.1
description: A powerful, efficient, lightweight, embeddable scripting language
version: 5.1.5
revision: 1
url: https://www.lua.org/
license: MIT
architecture: any
type: source
depends:
- readline
downloads:
- url: https://www.lua.org/ftp/lua-${BPM_PKG_VERSION}.tar.gz
extract_to: ${BPM_SOURCE}
extract_strip_components: 1
checksum: 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
+13
View File
@@ -0,0 +1,13 @@
diff -Naur lua-5.1.orig/src/Makefile lua-5.1/src/Makefile
--- lua-5.1.orig/src/Makefile 2006-02-16 16:45:09.000000000 +0100
+++ lua-5.1/src/Makefile 2006-03-01 14:55:29.000000000 +0100
@@ -8,7 +8,8 @@
PLAT= none
CC= gcc
-CFLAGS= -O2 -Wall $(MYCFLAGS)
+CFLAGS ?= -O2 -Wall
+CFLAGS += $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
+21
View File
@@ -0,0 +1,21 @@
From: Enrico Tassi <[email protected]>
Date: Tue, 26 Aug 2014 16:20:55 +0200
Subject: Fix stack overflow in vararg functions
---
src/ldo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ldo.c b/src/ldo.c
index d1bf786..30333bf 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
CallInfo *ci;
StkId st, base;
Proto *p = cl->p;
- luaD_checkstack(L, p->maxstacksize);
+ luaD_checkstack(L, p->maxstacksize + p->numparams);
func = restorestack(L, funcr);
if (!p->is_vararg) { /* no varargs? */
base = func + 1;
+66
View File
@@ -0,0 +1,66 @@
diff -ur lua-5.1.4/etc/lua.pc lua-5.1.4-new/etc/lua.pc
--- lua-5.1.4/etc/lua.pc 2008-08-08 14:46:11.000000000 +0200
+++ lua-5.1.4-new/etc/lua.pc 2012-02-23 18:25:34.000000000 +0100
@@ -8,6 +8,6 @@
# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
-prefix= /usr/local
+prefix= /usr
INSTALL_BIN= ${prefix}/bin
INSTALL_INC= ${prefix}/include
INSTALL_LIB= ${prefix}/lib
diff -ur lua-5.1.4/src/luaconf.h lua-5.1.4-new/src/luaconf.h
--- lua-5.1.4/src/luaconf.h 2008-02-11 17:25:08.000000000 +0100
+++ lua-5.1.4-new/src/luaconf.h 2012-02-23 18:25:34.000000000 +0100
@@ -94,7 +94,7 @@
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#define LUA_PATH_DEFAULT \
diff -ur lua-5.1.4/src/Makefile lua-5.1.4-new/src/Makefile
--- lua-5.1.4/src/Makefile 2008-01-19 20:37:58.000000000 +0100
+++ lua-5.1.4-new/src/Makefile 2012-02-23 18:26:43.000000000 +0100
@@ -23,6 +23,7 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.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
@@ -36,7 +37,7 @@
LUAC_O= luac.o print.o
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)
default: $(PLAT)
@@ -51,6 +52,11 @@
$(AR) $@ $?
$(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 $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
--- lua-5.1.4/Makefile 2008-08-12 02:40:48.000000000 +0200
+++ lua-5.1.4-new/Makefile 2012-02-23 19:06:32.000000000 +0100
@@ -53,7 +53,7 @@
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V) R=$(R)
test: dummy
src/lua test/hello.lua
+20
View File
@@ -0,0 +1,20 @@
V=%V
R=%R
prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include/lua%V
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/lua%V
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua%V -lm -ldl
Cflags: -I${includedir}
+52
View File
@@ -0,0 +1,52 @@
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
# Patch for compiling a shared library
patch -Np1 -i "$BPM_WORKDIR"/liblua.patch
# Patch CVE 2014-5461
patch -Np1 -i "$BPM_WORKDIR"/cve-2014-5461-fix.patch
# Remove predefined cflags
patch -Np1 -i "$BPM_WORKDIR"/custom-cflags.patch
# Create lua pkgconfig file
sed -e "s/%V/${BPM_PKG_VERSION%.*}/" -e "s/%R/${BPM_PKG_VERSION}/" "$BPM_WORKDIR"/lua.pc.in > lua.pc
# Add version suffix to lua files
sed -r -e "/^LUA_(SO|A|T)=/ s/lua/lua${BPM_PKG_VERSION%.*}/" -e "/^LUAC_T=/ s/luac/luac${BPM_PKG_VERSION%.*}/" -i src/Makefile
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
make MYCFLAGS="$CFLAGS -fPIC" MYLDFALGS="$LDFLAGS" linux
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make INSTALL_DATA="cp -d" INSTALL_TOP="$BPM_OUTPUT"/usr INSTALL_INC="$BPM_OUTPUT"/usr/include/lua${BPM_PKG_VERSION%.*} INSTALL_MAN="$BPM_OUTPUT"/usr/share/man/man1 TO_BIN="lua${BPM_PKG_VERSION%.*} luac${BPM_PKG_VERSION%.*}" TO_LIB="liblua${BPM_PKG_VERSION%.*}.so liblua${BPM_PKG_VERSION%.*}.so.${BPM_PKG_VERSION%.*} liblua${BPM_PKG_VERSION%.*}.so.${BPM_PKG_VERSION}" DESTDIR="$BPM_OUTPUT" install
# Create library aliases
ln -sf liblua${BPM_PKG_VERSION%.*}.so "$BPM_OUTPUT"/usr/lib/liblua.so.${BPM_PKG_VERSION%.*}
ln -sf liblua${BPM_PKG_VERSION%.*}.so "$BPM_OUTPUT"/usr/lib/liblua.so.${BPM_PKG_VERSION}
# Install pkg-config file
version_no_dot=$(echo ${BPM_PKG_VERSION%.*} | tr -d '.')
install -Dm644 lua.pc "$BPM_OUTPUT"/usr/lib/pkgconfig/lua${version_no_dot}.pc
ln -sf lua${version_no_dot}.pc "$BPM_OUTPUT"/usr/lib/pkgconfig/lua${BPM_PKG_VERSION%.*}.pc
ln -sf lua${version_no_dot}.pc "$BPM_OUTPUT"/usr/lib/pkgconfig/lua-${BPM_PKG_VERSION%.*}.pc
# Move manpages
mv "$BPM_OUTPUT"/usr/share/man/man1/lua.{1,${BPM_PKG_VERSION}}
mv "$BPM_OUTPUT"/usr/share/man/man1/luac.{1,${BPM_PKG_VERSION}}
# Install documentation
install -d "$BPM_OUTPUT"/usr/share/doc/${BPM_PKG_NAME}
install -m644 doc/*.{gif,png,css,html} "$BPM_OUTPUT"/usr/share/doc/${BPM_PKG_NAME}
# Install license
install -Dm644 "$BPM_SOURCE"/doc/readme.html "$BPM_OUTPUT"/usr/share/licenses/${BPM_PKG_NAME}/readme.html
}