# Description: Library for dealing with Microsoft ITSS/CHM format files
# URL: https://github.com/jedwing/CHMLib
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on:

name=chmlib
version=0.40
release=1
_commit=2bef8d063ec7d88a8de6fd9f0513ea42ac0fa21f
source=(https://github.com/jedwing/CHMLib/archive/$_commit/$name-$_commit.tar.gz
  chmlib-0001-Patch-to-fix-integer-types-problem-by-Goswin-von-Bre.patch
  chmlib-0002-Fix-for-extract_chmLib-confusing-empty-files-with-di.patch
  chm_http-port-shortopt.patch
  chm_http-bind-localhost.patch
  chm_http-output-server-address.patch
  chmlib-c99.patch
)

build() {
  cd CHMLib-$_commit

  patch -Np1 -i $SRC/chm_http-port-shortopt.patch
  patch -Np1 -i $SRC/chm_http-bind-localhost.patch
  patch -Np1 -i $SRC/chm_http-output-server-address.patch
  patch -Np1 -i $SRC/chmlib-c99.patch

  rm -f libtool
  mv configure.in configure.ac
  autoreconf -ivf

  ./configure --prefix=/usr \
    --enable-examples=no
  make
  make DESTDIR=$PKG install
}
