# SliTaz package receipt.

PACKED_SIZE="412.0K"
UNPACKED_SIZE="1.2M"
PACKAGE="libxml2"
VERSION="2.9.12"
CATEGORY="system-tools"
SHORT_DESC="XML C parser and toolkit."
MAINTAINER="pankso@slitaz.org"
LICENSE="MIT"
WEB_SITE="http://xmlsoft.org/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="ftp://xmlsoft.org/libxml2/$TARBALL"

DEPENDS="zlib"
BUILD_DEPENDS="autoconf automake libtool python-dev zlib-dev"

HOST_ARCH="i486 arm"

# When cross compiling Python is installed in chroot and is used
# by cross tools, cook dont need to install it in /usr/cross/arm
# Building with LZMA support is buggy and build fails
case "$ARCH" in
	arm)
		BUILD_DEPENDS="" 
		ARCH_ARGS="--without-lzma" ;;
esac

# What is the latest version available today?
current_version()
{
	wget -O - "https://gitlab.gnome.org/GNOME/libxml2/-/tags/?sort=updated_desc" 2>/dev/null | \
	sed '/item-title/!d;s|.*">v*||;s|<.*||;q'
}

# Rules to configure and make the package.
#
# Note: libxml2 can be build using option --with-minimum
# and binaries are splited into libxml2-tools
compile_rules()
{
	autoreconf -fi &&
	./configure				\
		--prefix=/usr			\
		--infodir=/usr/share/info	\
		--mandir=/usr/share/man		\
		--with-html-dir=/usr/share/doc	\
		--with-threads			\
		--with-history			\
	$CONFIGURE_ARGS $ARCH_ARGS &&
	make &&
	make install DESTDIR=$DESTDIR
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib
	cp -a $install/usr/lib/*.so*	$fs/usr/lib
}
