# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 47759 2009-03-05 18:01:45Z krischik@macports.org $

PortSystem 1.0

name				nonpareil	
version				0.79
#revision			4
platforms			darwin
categories			emulators
maintainers			krischik@me.com
description			a high-fidelity simulator for calculators.
long_description	Nonpareil is a high-fidelity simulator for calculators. \
					It currently supports many HP calculators models		\
					introduced between 1972 and 1982. Simulation fidelity	\
					is achieved through the use of the actual microcode of	\
					the calculators, thus in most cases the simulation		\
					behavior exactly matches that of the real calculator.	\
					In particular, numerical results will be identical,		\
					because the simulator is using the BCD arithmetic		\
					algorithms from the calculator.

homepage			http://nonpareil.brouhaha.com/
master_sites		http://nonpareil.brouhaha.com/download

set prog			nonpareil-${version}.tar.gz

distfiles			${prog}

checksums			${prog} sha1 83bc2f57e6ece9ce19e3449cce075ef246a9f4c2

depends_lib			port:bison								\
					port:flex								\
					port:glib2								\
					port:gtk2								\
					port:libxml2							\
					port:netpbm								\
					port:pkgconfig							\
					port:python23							\
					port:scons								

patchfiles          patch-src-util.diff

worksrcdir			${name}-${version}
use_parallel_build	yes
use_configure		no
build.cmd			"scons-local/scons.py"
build.args			prefix=${prefix}
build.target

destroot.cmd		"scons-local/scons.py"
build.args			prefix=${prefix} destdir=${destroot}

post-extract {
	system "cd ${workpath}/${name}-${version}/scons-local; tar -xzf scons-local-0.96.90.tar.gz"
}

platform macosx {
	post-destroot {
	xinstall -m 775 -d ${destroot}${applications_dir}
	xinstall -m 755 -d ${destroot}${applications_dir}/Nonpareil/HP-41CX.app
	xinstall -m 755 -d ${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents
	xinstall -m 755 -d ${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents/MacOS
	xinstall -m 755 -d ${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents/Resources

	xinstall -m 644 -W ${filespath}																\
		HP-41CX.app/Contents/Info.plist													\
		${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents/Info.plist
	xinstall -m 644 -W ${filespath}																\
		HP-41CX.app/Contents/Resources/HP-41CX.icns									\
		${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents/Resources/HP-41CX.icns
	xinstall -m 755 -W ${filespath}																\
		HP-41CX.app/Contents/MacOS/HP-41CX.command									\
		${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents/MacOS/HP-41CX.command

	reinplace																					\
		s|@PREFIX@|${prefix}|g																	\
		${destroot}${applications_dir}/Nonpareil/HP-41CX.app/Contents/MacOS/HP-41CX.command
	}
}

############################################################ {{{1 ###########
# vim: set nowrap tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab :
# vim: set textwidth=78 filetype=tcl foldmethod=marker nospell :
