### this file is sourced not run
PKGVER=2.9.7
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 8.2
TARBALL=libxml2-$PKGVER.tar.gz
MD5SUM=896608641a08b465098a40ddf51cefba
SRC_URL=http://xmlsoft.org/sources/$TARBALL
#SRC_URL=http://distro.ibiblio.org/fatdog/source/800/$TARBALL
BUNDLE=

# Note: This is the same recipe as libxml2. But we collect only the python modules
# Reason why we need this: libxml2 was built before python, thus it cannot build
# python modules.

SLACKREQ=libreadline
SLACKDESC="python-libxml2: python-libxml2 $PKGVER (Python module for libxml2)
python-libxml2: 
python-libxml2: This is a python module for libxml2.
python-libxml2: 
python-libxml2: 
python-libxml2: 
python-libxml2: 
python-libxml2: 
python-libxml2: 
python-libxml2: 
python-libxml2: 
"

### default pkg_download
### default pkg_prepare

### package - only keep python modules
pkg_package() {
	rm -f usr/$LIBDIR/* 2> /dev/null
	rm -r usr/include usr/bin usr/share usr/$LIBDIR/cmake usr/$LIBDIR/pkgconfig
}

### build
pkg_build() {
	CONFFLAGS="$CONFFLAGS --disable-static --with-history --with-threads"
	
	cd /tmp/libxml2* &&

	# BLFS 8.2: patch to make Python 3.6.4 to build
	patch -Np1 -i /tmp/pkg/libxml2-2.9.7-python3_hack-1.patch &&
	sed -i '/_PyVerify_fd/,+1d' python/types.c &&
	
	#autoreconf -fi &&
	pkg_build_autoconf && 
	pkg_build_slackdesc &&
	
	# multilib
	mv -v /usr/bin/xml2-config{,-64} &&
	ln -sfv multiarch_wrapper /usr/bin/xml2-config	
}


