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

packager="tnut <tnut@nutyx.org>"
contributors="Pierre,Fanch,Schrodinger72,Spiky"

makedepends=(libtool automake python)

PKGMK_KEEP_SOURCES="no"
name=libxml2
version=2.9.14
release=3

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 \
    --disable-static \
    --with-history \
    --with-python=/usr/bin/python3
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/lib/xml2Conf.sh usr/share/aclocal

rm -r usr/{share/aclocal,include,lib/{cmake,pkgconfig,xml2Conf.sh}}
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
}
