commit d426fe50e4f6cf287d081c55e2cc741936602e6f Author: EnumDev Date: Tue Dec 30 18:37:26 2025 +0200 Initial commit 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..59482bf --- /dev/null +++ b/pkg.info @@ -0,0 +1,15 @@ +name: lua5.3 +description: A powerful, efficient, lightweight, embeddable scripting language +version: 5.3.6 +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: fc5fd69bb8736323f026672b1b7235da613d7177e72558893a0bdcd320466d60 diff --git a/source-files/liblua.patch b/source-files/liblua.patch new file mode 100644 index 0000000..f9e24f3 --- /dev/null +++ b/source-files/liblua.patch @@ -0,0 +1,60 @@ +diff --git a/Makefile b/Makefile +index 7fa91c8..dccf485 100644 +--- a/Makefile ++++ b/Makefile +@@ -52,7 +52,7 @@ R= $V.0 + all: $(PLAT) + + $(PLATS) clean: +- cd src && $(MAKE) $@ ++ cd src && $(MAKE) $@ V=$(V) R=$(R) + + test: dummy + src/lua -v +diff --git a/src/Makefile b/src/Makefile +index 2e7a412..fa5769f 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -29,6 +29,7 @@ MYOBJS= + PLATS= aix bsd c89 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_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. +@@ -59,6 +60,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/src/luaconf.h b/src/luaconf.h +index fd28d21..e2662cc 100644 +--- a/src/luaconf.h ++++ b/src/luaconf.h +@@ -175,7 +175,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 "/" + #define LUA_PATH_DEFAULT \ 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 +}