app=libxml2
version=2.9.12
build=3sml
homepage="http://www.xmlsoft.org/"
download="ftp://xmlsoft.org/libxml2/libxml2-$version.tar.gz"
desc="XML parser library"
requires="readline zlib xz python3"

build() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions

  applypatch $srcdir/libxml2-2.9.8-python3-unicode-errors.patch
  applypatch $srcdir/revert-Make-xmlFreeNodeList-non-recursive.patch
  applypatch $srcdir/652dd12a858989b14eed4e84e453059cd3ba340e.diff

  ./configure \
    --prefix="" \
    --enable-shared \
    --disable-static \
    --disable-silent-rules \
    --with-python=/bin/python3

  sed -i 's@-L -L@@g' python/Makefile

  make
  make install DESTDIR=$pkg

  cp Copyright $pkgdocs/

  mkfinalpkg
}

sha512sums="
df1c6486e80f0fcf3c506f3599bcfb94b620c00d0b5d26831bc983daa78d58ec58b5057b1ec7c1a26c694f40199c6234ee2a6dcabf65abfa10c447cb5705abbd  libxml2-2.9.12.tar.gz
a205c97fa1488fb8907cfa08b5f82e2055c80b86213dc3cc5c4b526fe6aa786bcc4e4eeb226c44635a1d021307b39e3940f706c42fb60e9e3e9b490a84164df7  libxml2-2.9.8-python3-unicode-errors.patch
347178e432379d543683cba21b902e7305202c03e8dbd724ae395963d677096a5cfc4e345e208d498163ca5174683c167610fc2b297090476038bc2bb7c84b4f  revert-Make-xmlFreeNodeList-non-recursive.patch
"
