#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

#pkgbase=doxygen
#pkgname=('doxygen' 'doxygen-docs')
pkgname=doxygen
pkgver=1.9.7
pkgrel=01
pkgdesc='Documentation system for C++, C, Java, IDL and PHP'
url='http://www.doxygen.nl'
makedepends=('cmake' 'gcc-libs' 'flex' 'qt5-base' 'texlive-core' 'ghostscript'
             'texlive-latexextra' 'graphviz' 'python' 'git')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz)

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/python \
    -Dbuild_doc:BOOL=OFF \
    -Dbuild_wizard:BOOL=ON
  make -C build
  export CAIRO_DEBUG_PDF=1 # https://github.com/doxygen/doxygen/issues/9319
#  make -C build docs -j1

}

check() {
  cd ${pkgname}-Release_${pkgver//./_}
  make -C build tests
}

#package_doxygen() {
package() {
  pkgdesc='Documentation system for C++, C, Java, IDL and PHP'
  depends=('gcc-libs')
  optdepends=('graphviz: for caller/callee graph generation'
              'qt5-base: for doxywizard')

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

  rm -rf "${pkgdir}/usr/share/doc"
}

#package_doxygen-docs() {
#  pkgdesc='Developer documentation for doxygen'
#
#  cd ${pkgbase}-Release_${pkgver//./_}
#  make -C build DESTDIR="${pkgdir}" install
#
#  rm -rf "${pkgdir}/usr/bin"
#  rm -rf "${pkgdir}/usr/share/man"
#}

#---- arch license gpg-key & sha256sums ----

arch=(x86_64)

license=('GPL')

sha256sums=(691777992a7240ed1f822a5c2ff2c4273b57c1cf9fc143553d87f91a0c5970ee) # doxygen-1.9.7.tar.gz

##  3a8e726a136c91925b7bd333e550fa231562e1f680cb5f13743bc2a3837d5933  doxygen-1.9.7-01-x86_64.pkg.tar.lz

