From 02e72b86c0c715fdfb952243a032235582684e5d Mon Sep 17 00:00:00 2001 From: EnumDev Date: Tue, 30 Dec 2025 18:52:54 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ check-version.sh | 4 +++ pkg.info | 15 +++++++++++ source-files/liblua.patch | 57 +++++++++++++++++++++++++++++++++++++++ source-files/lua.pc.in | 20 ++++++++++++++ source.sh | 48 +++++++++++++++++++++++++++++++++ 6 files changed, 146 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..b97ca01 --- /dev/null +++ b/pkg.info @@ -0,0 +1,15 @@ +name: lua5.2 +description: A powerful, efficient, lightweight, embeddable scripting language +version: 5.2.4 +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: b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b diff --git a/source-files/liblua.patch b/source-files/liblua.patch new file mode 100644 index 0000000..92c1f3a --- /dev/null +++ b/source-files/liblua.patch @@ -0,0 +1,57 @@ +diff -ru lua-5.2.1/Makefile lua-5.2.1.new/Makefile +--- lua-5.2.1/Makefile 2012-05-17 16:05:54.000000000 +0200 ++++ lua-5.2.1.new/Makefile 2012-09-12 22:39:07.162748096 +0200 +@@ -52,7 +52,7 @@ + all: $(PLAT) + + $(PLATS) clean: +- cd src && $(MAKE) $@ ++ cd src && $(MAKE) $@ V=$(V) R=$(R) + + test: dummy + src/lua -v +diff -ru lua-5.2.1/src/luaconf.h lua-5.2.1.new/src/luaconf.h +--- lua-5.2.1/src/luaconf.h 2012-05-11 16:14:42.000000000 +0200 ++++ lua-5.2.1.new/src/luaconf.h 2012-09-12 22:40:27.986622772 +0200 +@@ -100,7 +100,7 @@ + #else /* }{ */ + + #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/" +-#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 + #define LUA_PATH_DEFAULT \ +diff -ru lua-5.2.1/src/Makefile lua-5.2.1.new/src/Makefile +--- lua-5.2.1/src/Makefile 2012-03-09 17:32:16.000000000 +0100 ++++ lua-5.2.1.new/src/Makefile 2012-09-12 22:38:08.591386896 +0200 +@@ -29,6 +29,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 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 +@@ -43,7 +44,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. +@@ -59,6 +60,12 @@ + $(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 +}