# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 84550 2011-09-27 21:05:11Z snc@macports.org $

PortSystem 1.0
PortGroup		app 1.0

name			rocksndiamonds
version			3.3.0.1
revision		1
categories		games
platforms		darwin
maintainers		phw openmaintainer
license			GPL-2+

description		Arcade style game Boulderdash or Emerald Mine clone
long_description	Arcade style game Boulderdash (C64) or Emerald Mine \
				(Amiga) clone. Included are many levels known from the \
				games Boulderdash, Emerald Mine, Sokoban, Supaplex and \
				DX-Boulderdash, level elements for Diamond Caves II \
				style games and a lot of new levels designed by others.

homepage		http://www.artsoft.org/rocksndiamonds/
master_sites	http://www.artsoft.org/RELEASES/unix/${name}
checksums       md5     813ced99d54f89db7c593c518d197d18 \
                sha1    529612c95355292fb76d0b954ce51f7cb54dc22a \
                rmd160  44f8bec6be74ce0346ec6826844d923cc69069a6


patchfiles		patch-Makefile.diff

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

post-patch {
	reinplace "s|_PREFIX_|${prefix}|g" ${worksrcpath}/Makefile
}

use_configure	no

# ranlib: archive member: game_sp.a(main.o) size too large (archive member extends past the end of the file)
use_parallel_build	no

build.target	sdl
build.args		CC="${configure.cc} [get_canonical_archflags]"

destroot	{
	xinstall -s -m 755 ${worksrcpath}/rocksndiamonds ${destroot}${prefix}/bin
	file mkdir ${destroot}${prefix}/share/games/rocksndiamonds
	file copy ${worksrcpath}/graphics ${worksrcpath}/levels \
		${worksrcpath}/music ${worksrcpath}/sounds \
		${destroot}${prefix}/share/games/rocksndiamonds
}

app.name		Rocks'n'Diamonds
#app.icon		graphics/gfx_classic/rocks_icon_32x32.pcx
app.icon		${filespath}/rocks_icon_32x32.png

# convert work/rocksndiamonds-*/graphics/gfx_classic/rocks_icon_32x32.pcx -transparent '#000000' /tmp/rocks.png
# pngcrush /tmp/rocks.png files/rocks_icon_32x32.png

livecheck.type  regex
livecheck.url   ${homepage}/download.html
livecheck.regex           "Rocks'n'Diamonds (\\d+(?:\\.\\d+)*)"
