# This is the recipe.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 }