From 59031580fe52fff9ecd90233ad2925374f5b2ac3 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sun, 18 Jan 2026 10:22:44 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ check-version.sh | 4 ++++ pkg.info | 15 ++++++++++++ source-files/liblua.patch | 47 ++++++++++++++++++++++++++++++++++++++ source-files/lua.pc.in | 20 ++++++++++++++++ source.sh | 48 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 136 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 pkg.info create mode 100644 source-files/liblua.patch create mode 100644 source-files/lua.pc.in create mode 100644 source.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e58e5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Exclude bpm archives +*.bpm \ No newline at end of file diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..cd89e29 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# Ignore this package +echo "ignore" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..19adf0d --- /dev/null +++ b/pkg.info @@ -0,0 +1,15 @@ +name: lua5.4 +description: A powerful, efficient, lightweight, embeddable scripting language +version: 5.4.8 +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: 4f18ddae154e793e46eeab727c59ef1c0c0c2b744e7b94219710d76f530629ae diff --git a/source-files/liblua.patch b/source-files/liblua.patch new file mode 100644 index 0000000..a105244 --- /dev/null +++ b/source-files/liblua.patch @@ -0,0 +1,47 @@ +diff --git a/Makefile b/Makefile +index 416f444..eeaff03 100644 +--- a/Makefile ++++ b/Makefile +@@ -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 --git a/src/Makefile b/src/Makefile +index 514593d..372a6dc 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -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,12 @@ $(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) + diff --git a/source-files/lua.pc.in b/source-files/lua.pc.in new file mode 100644 index 0000000..6c8693c --- /dev/null +++ b/source-files/lua.pc.in @@ -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} diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..9238af7 --- /dev/null +++ b/source.sh @@ -0,0 +1,48 @@ +# 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 + # 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 +}