# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

pkgname=doxygen
pkgver=1.11.0
pkgrel=1
pkgdesc="A documentation system for C++, C, Java, IDL and PHP"
arch=('i686' 'x86_64')
url="http://www.doxygen.org/"
msys2_repository_url="https://github.com/doxygen/doxygen"
msys2_references=(
  "cpe: cpe:/a:doxygen:doxygen"
)
license=('GPL')
depends=("gcc-libs" "libsqlite" "libiconv")
makedepends=("cmake" "ninja" "flex" "python" "libsqlite-devel" "libiconv-devel" 'gcc')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz)
sha256sums=('1fea49c69e51fec3dd2599947f6d48d9b1268bd5115b1bb08dffefc1fd5d19ee')

build() {
  local extra_config=Release
  if check_option "debug" "y"; then
    extra_config=Debug
  fi

  mkdir -p build-${CHOST} && cd build-${CHOST}

  /usr/bin/cmake \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=${extra_config} \
    -Dbuild_wizard=OFF \
    -Dbuild_search=OFF \
    -Duse_sqlite3=ON \
    -Duse_libclang=OFF \
    ../${pkgname}-Release_${pkgver//./_}

  /usr/bin/cmake --build .
}

package() {
  cd ${srcdir}/build-${CHOST}
  DESTDIR="${pkgdir}" /usr/bin/cmake --install .
}
