description="Libraries and utilities used for parsing XML files."
url="http://xmlsoft.org/"

packager="spiky <spiky@nutyx.org>"
contributors="Pierre,Fanch,Schrodinger72,Tnut"

makedepends=(libtool automake python)

name=libxml2
version=2.13.4

PKGMK_GROUPS=(lib man devel doc)
source=(https://gitlab.gnome.org/GNOME/libxml2/-/archive/v${version}/$name-v${version}.tar.gz)

prepare() {
mv $name-v${version} $name-$version
}

build() {
cd $name-$version

autoreconf -fiv
./configure       \
    --prefix=/usr \
    --sysconfdir=/etc \
    --disable-static  \
    --with-history \
    --with-legacy  \
    --with-python=/usr/bin/python
make
make DESTDIR=$PKG install
rm $PKG/usr/lib/$name.la
}

lib() {
cd $PKG
bsdtar -cf \
$PKGMK_PACKAGE_DIR/$name.lib${PKGMK_BUILDVER}${PKGMK_ARCH}.cards.tar \
usr/lib/libxml2*

rm usr/lib/libxml2*
rm -d usr/lib || true
}

devel() {
cd $PKG
bsdtar -cf \
$PKGMK_PACKAGE_DIR/$name.devel${PKGMK_BUILDVER}any.cards.tar \
usr/lib/cmake usr/lib/pkgconfig usr/lib/cmake \
usr/include  usr/share/aclocal

rm -r usr/{share/aclocal,include,lib/{cmake,pkgconfig}}
rm -d usr/lib || true
}

doc() {
cd $PKG
bsdtar -cf \
$PKGMK_PACKAGE_DIR/$name.doc${PKGMK_BUILDVER}any.cards.tar \
usr/share/doc usr/share/gtk-doc
rm -r usr/share/{doc,gtk-doc}
rm -d usr/share || true
}
