# $Id: Portfile 65518 2010-03-26 23:42:32Z ryandesign@macports.org $

PortSystem 1.0

name		neverball
version		1.4.0
revision	1
categories	games
platforms	darwin
maintainers	gmail.com:mvitocruz
description	Tilt the floor to roll a ball through an obstacle course.
long_description	\
		Tilt the floor to roll a ball through an obstacle     \
		course before time runs out. Neverball is part puzzle \
		game, part action game, and entirely a test of skill.

homepage	http://icculus.org/neverball/
master_sites	${homepage}
checksums	md5 a6cd860f1c2b7d8cecbcfc05ff228ef0
patchfiles	patch-Makefile.diff patch-ball-main.c patch-putt-main.c

depends_lib	path:lib/pkgconfig/sdl.pc:libsdl \
		port:libsdl_image \
		port:libsdl_mixer \
		port:libsdl_ttf

post-patch {
	reinplace "s|./data|${prefix}/share/${name}|g" ${worksrcpath}/share/config.h
}

use_configure	no

build.args	CC=${configure.cc}

destroot {
	xinstall -d -m 755 ${destroot}${prefix}/share/
	file copy ${worksrcpath}/data ${destroot}${prefix}/share/${name}
	xinstall -s -m 755 ${worksrcpath}/neverball ${destroot}${prefix}/bin
	xinstall -s -m 755 ${worksrcpath}/neverputt ${destroot}${prefix}/bin
}

platform darwin {
	pre-destroot {
		xinstall -d -m 755 \
			${destroot}${applications_dir}/Neverball.app/Contents/MacOS \
			${destroot}${applications_dir}/Neverputt.app/Contents/MacOS
		ln -s ${prefix}/bin/neverball \
			${destroot}${applications_dir}/Neverball.app/Contents/MacOS/Neverball
		ln -s ${prefix}/bin/neverputt \
			${destroot}${applications_dir}/Neverputt.app/Contents/MacOS/Neverputt
	}
}
