# Maintainer: Jesus E. <heckyel@riseup.net>

pkgname=doxygen
pkgver=1.8.20
pkgrel=1
pkgdesc='Documentation system for C, C++ and other languages'
url='https://www.doxygen.nl/index.html'
arch=('i686' 'x86_64')
license=('GPL-2')
makedepends=('cmake' 'gcc-libs' 'flex' 'tauthon')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz)
sha512sums=('25509cec8904b10431cf3d29f6e6bbdad49fbf3a763606b30c92c111f294ac0311aa13d53007d71ff1f55fcae6903e2ce8f80d1a6b4832fa43f6a9166184e005')

prepare() {
  cd ${pkgname}-Release_${pkgver//./_}
  # Install the man pages in the right place
  sed -i 's:DESTINATION man/man1:DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1":g' \
    doc/CMakeLists.txt
}

build() {
  cd ${pkgname}-Release_${pkgver//./_}

  cmake -B build \
    -DCMAKE_INSTALL_PREFIX:PATH=/usr \
    -DDOC_INSTALL_DIR:PATH=share/doc/doxygen \
    -DPYTHON_EXECUTABLE:FILE=/usr/bin/tauthon
  make -C build
}

package() {
  pkgdesc='Documentation system for C, C++ and other languages'
  depends=('gcc-libs')

  cd ${pkgname}-Release_${pkgver//./_}
  make -C build DESTDIR="${pkgdir}" install

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim: ts=2 sw=2 et:
