#!/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.8
pkgrel=01
pkgdesc='Documentation system for C++, C, Java, IDL and PHP'
url='http://www.doxygen.nl'
makedepends=('cmake' 'gcc-libs' 'flex' 'qt5-base' 'ghostscript'
             'texlive-latexextra' 'graphviz' 'python' 'git'
	'texlive-fontutils' 'texlive-fontsrecommended' 'texlive-plaingeneric')
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=(77371e8a58d22d5e03c52729844d1043e9cbf8d0005ec5112ffa4c8f509ddde8) # doxygen-1.9.8.tar.gz
sha512sums=('028788a4c4daba895d5c4b20ad99a7bfe61aa9ddd39dfa220eafc3f56563881ad682fa528ebfb49ac04493f974cb0b503f9b0e7edd7ff860c3b2d2991d25705d')
b2sums=('4ff9264374db959936105301097d02d25c1cf57aabf336350767b97ae73c4f8d94f2f954b1baae2166fc29a5056f67fb4e6cbb6baa8a0c42cbbf51e631b3a9a8')


##  c798e9d39e7f04d3d9f63448e6c824f19ecf1cfde8dde21cc9b3c8b19811c8f4  doxygen-1.9.8-01-x86_64.pkg.tar.lz
