# Description: the extensible chat client
# URL: https://weechat.org/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: gnutls libgcrypt
# Optional: asciidoc aspell guile lua ninja ruby tcl

name=weechat
version=4.0.3
release=1
source=(https://weechat.org/files/src/$name-$version.tar.xz)

build() {
  prt-get isinst asciidoc || PKGMK_WEECHAT+=' -D ENABLE_MAN=OFF'
  prt-get isinst aspell || PKGMK_WEECHAT+=' -D ENABLE_SPELL=OFF'
  prt-get isinst guile || PKGMK_WEECHAT+=' -D ENABLE_GUILE=OFF'
  prt-get isinst lua || PKGMK_WEECHAT+=' -D ENABLE_LUA=OFF'
  prt-get isinst ruby || PKGMK_WEECHAT+=' -D ENABLE_RUBY=OFF'
  prt-get isinst tcl || PKGMK_WEECHAT+=' -D ENABLE_TCL=OFF'

  cmake -S $name-$version -B build $PKGMK_WEECHAT -G Ninja \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
    -D WEECHAT_HOME="~/.config/weechat" \
    -D ENABLE_PERL=ON \
    -D ENABLE_PYTHON=ON \
    -D ENABLE_PHP=OFF \
    -D ENABLE_NLS=OFF \
    -Wno-dev
  cmake --build build
  DESTDIR=$PKG cmake --install build
}
