# Description: A programming language designed for extending applications
# URL: http://www.lua.org
# Packager: pierre at nutyx dot org

name=lua
version=5.3.2
release=2
_majorver=${version%.*}

source=(http://www.lua.org/ftp/$name-$version.tar.gz lua.pc
	http://www.linuxfromscratch.org/patches/blfs/svn/$name-$version-shared_library-1.patch)
build() {
	cd $name-$version
	patch -Np1 -i ../$name-$version-shared_library-1.patch
	sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h

    	make linux
	make INSTALL_TOP=$PKG/usr  TO_LIB="liblua.so liblua.so.5.3 liblua.so.5.3.2" \
	INSTALL_DATA="cp -d" INSTALL_MAN=$PKG/usr/share/man/man1 install
	mkdir -pv $PKG/usr/share/doc/$name-$version
	cp -v doc/*.{html,css,gif,png} $PKG/usr/share/doc/$name-$version
	mkdir -p $PKG/usr/lib/pkgconfig
	sed "s/%VER%/$_majorver/g;s/%REL%/$pkgver/g" ../lua.pc \
> $PKG/usr/lib/pkgconfig/lua.pc
}
