# $Id: Portfile,v 1.20 2006/04/12 19:45:59 mww Exp $

PortSystem 1.0

name			wxWidgets
version			2.6.3
categories		graphics devel
platforms		darwin
maintainers		mww@opendarwin.org blb@opendarwin.org
description		mature cross-platform C++ GUI framework
long_description	wxWidgets 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. \
				wxWidgets will even run on embedded systems using \
				Linux and X11.

homepage		http://www.wxwidgets.org/
master_sites	ftp://biolpc22.york.ac.uk/pub/${version}/ \
				sourceforge:wxwindows
use_bzip2		yes
dist_subdir		${name}/${version}
distfiles-append	${name}-${version}-Patch-2.tar.gz

fetch.user		anonymous
fetch.password		darwinports@opendarwin.org
fetch.use_epsv		no

checksums		${name}-${version}${extract.suffix} \
					md5 183a1fe136d7caacb60c717bbbef9788 \
				${name}-${version}${extract.suffix} \
					sha1 fde71ac6b17ed8479b4063928a791f398d2f2dbf \
				${name}-${version}${extract.suffix} \
					rmd160 6dcf6bd11f9ddeec2fe511282db94bf489f41e21 \
				${name}-${version}-Patch-2.tar.gz \
					md5 1218551e47e42185f31d819703004c46 \
				${name}-${version}-Patch-2.tar.gz \
					sha1 d2d9cb79fbf898f27b034bb454e32001f0052489 \
				${name}-${version}-Patch-2.tar.gz \
					rmd160 ba84c8dee9d0fb9f1af8f663526098c0b4c7c4e4

depends_lib		port:jpeg \
				port:tiff \
				port:libpng \
				port:zlib \
				port:libiconv \
				port:expat \
				port:libsdl \
				port:libsdl_mixer

set worksrcdir	build

extract.only	${name}-${version}${extract.suffix}
post-extract {
	file mkdir ${worksrcpath}
	cd ${workpath}/${name}-${version}
	system "gunzip -c ${distpath}/${name}-${version}-Patch-2.tar.gz | tar xf -"
}

configure.cmd	../${name}-${version}/configure
configure.env	CPPFLAGS="-I${prefix}/include" \
				CFLAGS="-I${prefix}/include" \
				LDFLAGS="-L${prefix}/lib"
configure.args	--mandir=${prefix}/share/man \
				--with-libiconv-prefix=${prefix} \
				--with-libjpeg \
				--with-libtiff \
				--with-libpng \
				--with-zlib \
				--with-sdl \
				--with-opengl \
				--with-mac \
				--disable-sdltest \
				--enable-unicode \
				--enable-display \
				--enable-monolithic

platform darwin 8 {
	configure.env-append	CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
}

set contrib		"animate gizmos stc"

build.target
post-build {
	foreach target { ${contrib} } {
		system "cd ${build.dir} && make -C contrib/src/${target}"
	}
}

post-destroot {
	foreach target { ${contrib} } {
		system "cd ${destroot.dir} && make -C contrib/src/${target} install ${destroot.destdir}"
	}
	xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${workpath}/${name}-${version} BuildCVS.txt CHANGES.txt \
		COPYING.LIB INSTALL-MAC.txt INSTALL-MGL.txt INSTALL-MOTIF.txt \
		INSTALL-OS2.txt INSTALL-X11.txt LICENCE.txt README-MAC.txt \
		README-MGL.txt README-MOTIF.txt README-X11.txt README.txt \
		${destroot}${prefix}/share/doc/${name}
	system "cd ${destroot}${prefix}/bin && \
		ln -sf ${prefix}/lib/wx/config/mac-unicode-release-2.6 wx-config"
}
