commit d8079f851fef2a18825e54960b7f700d1589eafc Author: EnumDev Date: Tue Dec 30 20:54:04 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..2639f8f --- /dev/null +++ b/check-version.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Github repository +REPO="libmpack/libmpack-lua" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name') + +echo "$TAG_NAME" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..e559add --- /dev/null +++ b/pkg.info @@ -0,0 +1,36 @@ +name: lua-mpack +description: Simple implementation of msgpack in C Lua +version: 1.0.13 +revision: 1 +url: https://github.com/libmpack/libmpack-lua +license: MIT +architecture: any +type: source +make_depends: + - libmpack + - lua + - lua5.1 + - lua5.2 + - lua5.3 +downloads: + - url: https://github.com/libmpack/libmpack-lua/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 436a6a3973207403d3f20082002c32e74c25d9149ff2516dc06b0b41514044bf +split_packages: + - name: lua-mpack + depends: + - libmpack + - lua + - name: lua5.3-mpack + depends: + - libmpack + - lua5.3 + - name: lua5.2-mpack + depends: + - libmpack + - lua5.2 + - name: lua5.1-mpack + depends: + - libmpack + - lua5.1 diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..063077f --- /dev/null +++ b/source.sh @@ -0,0 +1,45 @@ +# 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 build function is executed in the source directory +# This function is used to compile the source code +build() { + gcc -O2 -fPIC -DMPACK_USE_SYSTEM -I/usr/include -c lmpack.c -o lmpack.o + gcc -shared -lmpack -o mpack.so.5.4 lmpack.o + + for ver in 5.4 5.3 5.2 5.1; do + gcc -O2 -fPIC -DMPACK_USE_SYSTEM -I/usr/include/lua$ver -c lmpack.c -o lmpack.o + gcc -shared -lmpack -o mpack.so.$ver lmpack.o + done +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package_lua-mpack() { + install -Dm755 mpack.so.5.4 "$BPM_OUTPUT"/usr/lib/lua/5.4/mpack.so + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE-MIT "$BPM_OUTPUT"/usr/share/licenses/lua-mpack/LICENSE +} + +package_lua5.3-mpack() { + install -Dm755 mpack.so.5.3 "$BPM_OUTPUT"/usr/lib/lua/5.3/mpack.so + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE-MIT "$BPM_OUTPUT"/usr/share/licenses/lua5.3-mpack/LICENSE +} + +package_lua5.2-mpack() { + install -Dm755 mpack.so.5.2 "$BPM_OUTPUT"/usr/lib/lua/5.2/mpack.so + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE-MIT "$BPM_OUTPUT"/usr/share/licenses/lua5.2-mpack/LICENSE +} + +package_lua5.1-mpack() { + install -Dm755 mpack.so.5.1 "$BPM_OUTPUT"/usr/lib/lua/5.1/mpack.so + + # Install package license + install -Dm644 "$BPM_SOURCE"/LICENSE-MIT "$BPM_OUTPUT"/usr/share/licenses/lua5.1-mpack/LICENSE +}