# $Id: Portfile 91940 2012-04-13 18:27:45Z and.damore@macports.org $

PortSystem 1.0

name		mednafen
version		0.8.D.3
epoch       1
platforms	darwin
categories	emulators games
maintainers	freebsd.org:adamw openmaintainer
description	Super-fast and super-compatible emulator for many video game systems
long_description	Medfafen is a portable (utilizing OpenGL and SDL) \
			argument-driven multi-system emulator with many \
			advanced features. The Atari Lynx, GameBoy, GameBoy \
			Colour, GameBoy Advance, NES, PC Engine (TurboGrafx 16) \
			and SuperGrafx are emulated. Mednafen has the ability \
			to remap hotkey functions and virtual system inputs \
			to a keyboard, a joystick, or both simultaneously. \
			Save states are supported, as is real-time game \
			rewinding.

homepage	http://mednafen.sourceforge.net/
master_sites	sourceforge:project/${name}/Mednafen/${version}
use_bzip2	yes
checksums           md5     57d22805071becd81858b0c088a275e5 \
                    sha1    b19b92101853cb653506456fd8ab1c0bb0b6e636 \
                    rmd160  546f49a9541ba4d0367fe682aef23cdadf3d7325

depends_lib	path:lib/pkgconfig/sdl.pc:libsdl \
		port:libsdl_net \
		port:libsndfile \
		port:libcdio \
		port:zlib

depends_build port:pkgconfig

# Just an FYI: even though it takes a billion years to compile
# src/gba/arm.cpp, it *does* finish eventually.

patchfiles  patch-src_file_cpp.diff \
            patch-src_drivers_shader_cpp.diff 

worksrcdir	${name}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
	xinstall -m 755 ${worksrcpath}/README ${destroot}${prefix}/share/doc/${name}
	xinstall -m 755 ${worksrcpath}/ChangeLog ${destroot}${prefix}/share/doc/${name}
	eval xinstall [glob ${worksrcpath}/Documentation/*] ${destroot}${prefix}/share/doc/${name}
}

post-activate {

ui_msg "\n
Mednafen works by executing the ROM file of a game console you'd like to emulate.  Note
that no ROM files are included with Mednafen, so first you must obtain the game console
ROM file of your choice, by legal means of course.  

Supported ROM file formats are listed in section 'File Formats/Expansion Hardware'
in the Mednafen documenation at ${prefix}/share/doc/${name}.  Once you've obtained a
supported type of game console ROM file, start the Mednafen command-line executable and use
the ROM filename (including path) as an argument.  See the documentation for more options.
\n"
}
