# $Id: Portfile,v 1.3 2005/04/28 20:39:55 mww Exp $

PortSystem 1.0

name			criticalmass
version			0.9.11
categories		games
platforms		darwin
maintainers		mww@opendarwin.org
description		Critical Mass is an SDL/OpenGL space shoot'em up game.
long_description	${description}

homepage		http://criticalmass.sourceforge.net/critter.php
master_sites	sourceforge:criticalmass
distname		CriticalMass-${version}
checksums		md5 80a70f8e5cbdcfe8eedf49f91b093b2d
use_bzip2		yes

depends_lib		bin:sdl-config:libsdl \
				lib:libSDL_mixer:libsdl_mixer \
				lib:libSDL_image:libsdl_image \
				lib:libpng:libpng \
				lib:libz:zlib

post-patch {
	reinplace "s|/Contents/Resources/|/../share/${name}/|g" \
		${worksrcpath}/game/Makefile.in
}
configure.args	--mandir=${prefix}/share/man
post-configure {
	reinplace "s|-I${prefix}/include/SDL|-I${prefix}/include -I${prefix}/include/SDL|g" \
		${worksrcpath}/game/Makefile \
		${worksrcpath}/utilssdl/Makefile \
		${worksrcpath}/utilsgl/Makefile
}

post-destroot {
	cd ${destroot}${prefix}/share
	file rename Critical_Mass ${name}
	set dest ${destroot}${prefix}/Applications/DarwinPorts/CriticalMass.app/Contents/MacOS
	xinstall -m 755 -d ${dest}
	system "ln -sf ${prefix}/bin/critter ${dest}/CriticalMass"
}
