# $Id: Portfile 90449 2012-03-06 05:16:13Z ryandesign@macports.org $

PortSystem		1.0
name			wxmsw
version			2.8.4
categories		cross
maintainers		nomaintainer
description		The wxWidgets GUI toolkit with Win32 bindings
long_description	\
	A C++ package for platform independent software development

homepage		http://wxwidgets.org/
platforms		darwin
master_sites	sourceforge:project/wxwindows/wxMSW/${version}
distname		wxMSW-${version}
checksums		md5 72a614037769a7d8ad7c5eb9ed9d887c
use_zip		yes

# Parameters for this port.
set crossgcc-target i386-mingw32

depends_lib		port:i386-mingw32-gcc port:i386-mingw32-w32api port:dos2unix

configure.ldflags	"-L${prefix}/${crossgcc-target}/lib"
configure.cppflags	"-I${prefix}/${crossgcc-target}/include"
configure.args	--host=i386-mingw32 --target=mingw32 \
				--bindir=${prefix}/${crossgcc-target}/bin \
				--libdir=${prefix}/${crossgcc-target}/lib \
				--includedir=${prefix}/${crossgcc-target}/include \
				--with-msw --with-libpng --with-libjpeg --with-libtiff \
				--with-zlib

post-extract {
	system "dos2unix ${worksrcpath}/configure"
	system "chmod +x ${worksrcpath}/configure"
	system "dos2unix ${worksrcpath}/config.sub"
	system "dos2unix ${worksrcpath}/config.guess"
	system "dos2unix ${worksrcpath}/src/expat/configure"
	system "chmod +x ${worksrcpath}/src/expat/configure"
	system "dos2unix ${worksrcpath}/src/expat/expat_config.h.in"
	system "dos2unix ${worksrcpath}/src/expat/conftools/config.sub"
	system "dos2unix ${worksrcpath}/src/expat/conftools/config.guess"
}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
	eval xinstall -m 644 [glob ${worksrcpath}/*.txt] \
		${destroot}${prefix}/share/doc/${name}
}

variant opengl {
	configure.args-append	--with-opengl
}

post-destroot {
	system "dos2unix ${destroot}${prefix}/${crossgcc-target}/lib/wx/config/*"
	system "chmod +x ${destroot}${prefix}/${crossgcc-target}/lib/wx/config/*"

	xinstall -m 755 -d ${destroot}${prefix}/bin
	file rename ${destroot}${prefix}/${crossgcc-target}/bin/wx-config \
	            ${destroot}${prefix}/bin/wx-config
}

