SUMMARY="GUI wizard for doxygen"
DESCRIPTION="Doxygen is the de facto standard tool for generating \
documentation from annotated C++ sources, but it also supports other popular \
programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL \
(Corba  and Microsoft flavors), Fortran, VHDL, Tcl, and to some extent D.
Doxygen can:
  * generate an on-line documentation browser (in HTML) and/or an \
off-line reference manual (in LaTeX) from a set of documented source \
files. There is also support for generating output in RTF (MS-Word), \
PostScript, hyperlinked PDF, compressed HTML, and Unix man pages. The \
documentation is extracted directly from the sources, which makes it much \
easier to keep the documentation consistent with the source code.
 * extract the code structure from undocumented source files. This is \
very useful to quickly find your way in large source distributions. \
Doxygen can also visualize the relations between the various elements \
by means of include dependency graphs, inheritance diagrams, and \
collaboration diagrams, which are all generated automatically."
HOMEPAGE="http://www.doxygen.org/"
COPYRIGHT="1997-2025 Dimitri van Heesch"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/doxygen/doxygen/archive/Release_${portVersion//./_}.tar.gz"
CHECKSUM_SHA256="5663bf33e979381f470c2f4055c3b162e0abe41bdd6c5dccefd8d8775780bcc3"
SOURCE_DIR="doxygen-Release_${portVersion//./_}"
ADDITIONAL_FILES="doxygen.rdef.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	doxygen_gui$secondaryArchSuffix
	cmd:doxywizard = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:doxygen
	lib:libGL$secondaryArchSuffix
	lib:libQt6Core$secondaryArchSuffix
	lib:libQt6Gui$secondaryArchSuffix
	lib:libQt6Widgets$secondaryArchSuffix
	lib:libQt6Xml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:doxygen == $portVersion # not used, needed to set version for requires
	devel:libiconv$secondaryArchSuffix
	devel:libQt6Core$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:bison
	cmd:cmake
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:python3
	"

BUILD()
{
	cmake -Bbuild-gui -S. -DCMAKE_BUILD_TYPE=Release \
		$cmakeDirArgs \
		-DCMAKE_INSTALL_BINDIR=$prefix/bin \
		-Dbuild_wizard=ON
	make -Cbuild-gui $jobArgs
}

INSTALL()
{
	make -Cbuild-gui install

	# use base cmd:doxygen
	rm -rf $prefix/bin/doxygen
	rm -rf $manDir/man1/doxygen.1

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	local APP_NAME="DoxyWizard"
	local LONG_INFO="$SUMMARY"
	local APP_SIGNATURE="application/x-vnd.doxywizard"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		-e "s|@APP_NAME@|$APP_NAME|" \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		$portDir/additional-files/doxygen.rdef.in > doxygen.rdef

	addResourcesToBinaries doxygen.rdef $prefix/bin/doxywizard

	addAppDeskbarSymlink $prefix/bin/doxywizard DoxyWizard
}
