# 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 }