# $Id: Portfile 43319 2008-12-09 04:22:16Z css@macports.org $

PortSystem 1.0

name			doxygen
version			1.5.7
revision		2
categories		textproc devel
maintainers		css@macports.org
description		Documentation system for several programming languages
long_description \
	It can generate an on-line documentation browser (in HTML) and/or an \
	off-line reference manual 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. \
	You can configure doxygen to extract the code structure from \
	undocumented source files. This is very useful to quickly find your \
	way in large source distributions. You 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.

platforms		darwin

homepage		http://www.doxygen.org/
master_sites		ftp://ftp.stack.nl/pub/users/dimitri/
distfiles		${distname}.src${extract.suffix}

checksums		md5 ee2fed530ade60daede50461d5227885 \
			sha1 91a35d0ff0e5d19c8f0362999c305ed640c9ba92 \
			rmd160 13c4872d49c9d4b178934fe93d02f6ed5e358bee

depends_lib		lib:libpng:libpng bin:dot:graphviz \
			bin:ginstall:coreutils port:libiconv

universal_variant no

# setup to work smoothly with Qt3
post-patch {
	reinplace "s|\$(QTDIR)/include|\$(QTDIR)/include/qt3|g" \
		${tmake_conf}
	reinplace "s|@@PREFIX@@|${prefix}|g" \
		${worksrcpath}/addon/doxywizard/Makefile.doxywizard
	reinplace "s|@@X11PREFIX@@|${x11prefix}|g" \
		${worksrcpath}/addon/doxywizard/Makefile.doxywizard
}

# Patch support for Tiger--no longer needed as of 1.5.6?
#patchfiles		patch-qfiledefs_p.h

configure.pre_args	--prefix ${prefix}
configure.args		--docdir ${prefix}/share/doc --dot ${prefix}/bin/dot
configure.env		QTDIR=${prefix}

post-configure {
	reinplace "/^TMAKE_CC\[\[:space:\]\]/s%=.*%= ${configure.cc}%" ${tmake_conf}
	reinplace "/^TMAKE_CXX\[\[:space:\]\]/s%=.*%= ${configure.cxx}%" ${tmake_conf}
}

build.env		QTDIR=${prefix}
build.target		all

destroot.target		install
destroot.args		INSTALL=${destroot}${prefix} \
			DOCDIR=${destroot}${prefix}/share/doc/doxygen \
			MAN1DIR=share/man/man1

variant docs description {Include the doxygen PDF documentation and LaTeX} {
	build.target-append	pdf
	destroot.target-append	install_docs
	depends_lib-append	bin:pdflatex:texlive \
				bin:gs:ghostscript
}

variant wizard description {Include the GUI wizard based on Qt} {
	depends_lib-append	lib:libqt-mt:qt3
	configure.args-append	--with-doxywizard
}

platform darwin {
	# Specify the platform explicitly to avoid a universal build.
	global tmake_conf
	set tmake_conf	${worksrcpath}/tmake/lib/macosx-c++/tmake.conf
	configure.args-append	--platform macosx-c++
	if {[variant_isset wizard]} {
		post-destroot {
			set dpappdir	${destroot}/Applications/MacPorts
			xinstall -m 755 -d ${dpappdir}/doxywizard.app/Contents/MacOS
			file rename ${destroot}${prefix}/bin/doxywizard \
				${dpappdir}/doxywizard.app/Contents/MacOS/
			xinstall -m 644 ${filespath}/Info.plist \
				${dpappdir}/doxywizard.app/Contents/
		}
	}
}
