Files
lua-lpeg/source.sh
T
2025-12-30 20:43:43 +02:00

73 lines
2.6 KiB
Bash

# 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"
for ver in 5.3 5.2 5.1; do
cp -a lua5.4 lua$ver
done
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
pushd lua5.4
make DLLFLAGS="-I/usr/include -fPIC" LUADIR="/usr/include"
popd
for ver in 5.3 5.2 5.1; do
pushd lua$ver
make DLLFLAGS="-I/usr/include/lua${ver} -fPIC" LUADIR="/usr/include/lua${ver}"
popd
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-lpeg() {
install -Dm755 lua5.4/lpeg.so -t "$BPM_OUTPUT"/usr/lib/lua/5.4
install -Dm644 lua5.4/re.lua -t "$BPM_OUTPUT"/usr/share/lua/5.4
# Install documentation
install -Dm644 lua5.4/lpeg.html "$BPM_OUTPUT"/usr/share/doc/lpeg-lua5.4/lpeg.html
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/lua-lpeg/LICENSE
}
package_lua5.3-lpeg() {
install -Dm755 lua5.3/lpeg.so -t "$BPM_OUTPUT"/usr/lib/lua/5.3
install -Dm644 lua5.3/re.lua -t "$BPM_OUTPUT"/usr/share/lua/5.3
# Install documentation
install -Dm644 lua5.3/lpeg.html "$BPM_OUTPUT"/usr/share/doc/lpeg-lua5.3/lpeg.html
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/lua5.3-lpeg/LICENSE
}
package_lua5.2-lpeg() {
install -Dm755 lua5.2/lpeg.so -t "$BPM_OUTPUT"/usr/lib/lua/5.2
install -Dm644 lua5.2/re.lua -t "$BPM_OUTPUT"/usr/share/lua/5.2
# Install documentation
install -Dm644 lua5.2/lpeg.html "$BPM_OUTPUT"/usr/share/doc/lpeg-lua5.2/lpeg.html
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/lua5.2-lpeg/LICENSE
}
package_lua5.1-lpeg() {
install -Dm755 lua5.1/lpeg.so -t "$BPM_OUTPUT"/usr/lib/lua/5.1
install -Dm644 lua5.1/re.lua -t "$BPM_OUTPUT"/usr/share/lua/5.1
# Install documentation
install -Dm644 lua5.1/lpeg.html "$BPM_OUTPUT"/usr/share/doc/lpeg-lua5.1/lpeg.html
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/lua5.1-lpeg/LICENSE
}