# Description: Tools for accessing and converting various ebook file formats
# URL: http://ebook-tools.sourceforge.net/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: libzip libxml2

name=ebook-tools
version=0.2.2
release=2
source=(http://downloads.sourceforge.net/sourceforge/$name/$name-$version.tar.gz
  # https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/ebook-tools/trunk/crash-fix.patch
  crash-fix.patch)

build() {
  patch -Np2 -d $name-$version -i $SRC/crash-fix.patch # https://sourceforge.net/p/ebook-tools/bugs/8/

  cmake -S $name-$version -B build -G Ninja \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
    -D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
    -Wno-dev
  cmake --build build
  DESTDIR=$PKG cmake --install build
}
