pkgname=itstool
pkgver=2.0.7
pkgdesc="Translation tool for XML documents that uses gettext files and ITS rules"
homepage="https://itstool.org/"
license=("GPL-3+")
depends=("dev-python/lxml")
_patches=("itstool-2.0.7-raw-string-testrunner.patch")
_patch_sums=("9864daaf40dcbb3a5074ea73d98275a1c5590044b4c1e74f980a78978a706153d5c70c347da5424757e877b0cc49307804a228404daf8f276568e214436c5610")
sources=("${pkgname}-${pkgver}.tar.gz"
  "${pkgname}-2.0.7-switch-to-lxml.patch.xz"
  "${_patches[@]}"
)
_commit="19f9580f27aa261ea383b395fdef7e153f3f9e6d"
urls=("https://github.com/itstool/itstool/archive/${_commit}.tar.gz"
  "https://dev.gentoo.org/~sam/distfiles/dev-util/itstool/${sources[1]}"
  "${_patches[@]}"
)
sha512sums=("52ec7c97891bb55628a34141e39029003fa09bb3f79baeeaaf782710bc14e6e4eda4c5ca360728db68928cd27f331ff0e0f6ee8a954ad723e4619f0d2193e50c"
  "40e69baa1d644aa8bdf305fee396ee4bd15203f2d55aa3d7ece088a176a35624711eaa31ef05d6f3e6a0bfdd1ed39ab41911fc968099fe34802afdc4142b200a"
  "${_patch_sums[@]}"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  for _patch in ${_patches[@]}; do
    patch -p1 -i ${filedir}/${_patch}
  done
  cp -v ${distdir}/${sources[1]} ./
  xz -d ${sources[1]} 
  patch -p1 -i ${sources[1]%.xz}

  autoreconf -fiv
}

src_build() {
  ./configure --prefix=/usr
  make
}

src_check() {
  make check
}

src_install() {
  make DESTDIR="$pkgdir" install
}

# vim:ft=sh syn=sh et sw=2:
