# $Id: Portfile,v 1.6 2005/10/19 08:10:12 blb Exp $

PortSystem 1.0

name		wxWindows
version		2.4.2
revision	1
categories	graphics devel
platforms	darwin
maintainers	mww@opendarwin.org blb@opendarwin.org
description	mature cross-platform C++ GUI framework
long_description	wxWindows is a mature open-source cross-platform C++ \
		GUI framework for MacOS, Unix, Linux, Windows. It can make use \
		of a variety of native widget sets as well as its own widget \
		set: MacOS, GTK+, Motif, WIN32. wxWindows will even run on \
		embedded systems using Linux and X11.

homepage	http://www.wxwindows.org/
master_sites	sourceforge:wxwindows \
		ftp://biolpc22.york.ac.uk/pub/${version}/
distname	wxAll-${version}
checksums	md5 05c2ac572ec07492b3121e3769c2d258

depends_lib	lib:libjpeg:jpeg \
		lib:libtiff:tiff \
		lib:libpng:libpng \
		lib:libfreetype.6:freetype \
		lib:libz:zlib

worksrcdir	${name}-${version}/build

post-extract	{
	file mkdir ${worksrcpath}
}

configure.args	--mandir=${prefix}/share/man \
		--with-libjpeg \
		--with-libtiff \
		--with-libpng \
		--with-freetype \
		--with-zlib
configure.env	LDFLAGS="-L${prefix}/lib" \
		CPPFLAGS="-I${prefix}/include"
configure.cmd	../configure

build.target
post-build {
	# build xrc support
	worksrcdir	${name}-${version}/build/contrib/src/xrc
	system "[command build]"
	worksrcdir	${name}-${version}/build
}

destroot.destdir	prefix=${destroot}${prefix}
post-destroot {
	# install xrc support
	worksrcdir	${name}-${version}/build/contrib/src/xrc
	system "[command destroot]"
	worksrcdir	${name}-${version}/build

	cd ${workpath}/${name}-${version}
	# install a missing include file needed by other ports
	# (e.g. rb-wxruby)
	xinstall -m 0644 include/wx/html/htmlproc.h \
		${destroot}${prefix}/include/wx/html
	# install docs
	xinstall -m 0755 -d ${destroot}/${prefix}/share/doc
	file copy docs ${destroot}/${prefix}/share/doc/${name}
}

default_variants		+mac

variant mac	{
	patchfiles	patch-configure \
			patch-makelib.env.in \
			patch-choice.cpp.diff \
			patch-choice.h.diff \
			patch-combobox.cpp.diff \
			patch-combobox.h.diff \
			patch-dc.cpp.diff \
			patch-menu.cpp.diff \
			patch-menu.h.diff \
			patch-menuitem.cpp.diff \
			patch-menuitem.h.diff \
			patch-uma.cpp.diff \
			patch-uma.h.diff

	configure.args-append	--with-mac \
				--with-opengl \
				--enable-geometry \
				--enable-optimise
}

variant gtk1	{
	depends_lib-append	lib:libgtk.1:gtk1 \
				lib:libGL:XFree86
	configure.args-append	--with-gtk \
				--with-opengl \
				--enable-geometry \
				--enable-optimise
	configure.env-delete	CPPFLAGS="-I${prefix}/include"
	configure.env-append	CPPFLAGS="-I${prefix}/include \
					-I${x11prefix}/include"
}

#variant motif	{}
#variant x11	{}
