# $Id: Portfile 82656 2011-08-17 17:15:43Z jmr@macports.org $

PortSystem 1.0

name		simh
version		v38-1
revision	2
categories	emulators
platforms	darwin
maintainers	gwright
description	A highly portable, multi-system simulator.
long_description	\
		The Computer History Simulation Project is a loose	\
		Internet-based collective of people interested in	\
		restoring historically significant computer hardware	\
		and software systems by simulation. The goal of the	\
		project is to create highly portable system simulators	\
		and to publish them as freeware on the Internet,	\
		with freely available copies of significant or		\
		representative software.

homepage	http://simh.trailing-edge.com
master_sites	http://simh.trailing-edge.com/sources/

checksums	md5     e15f65a82e21ea49e14b438326d93d5c		\
		sha1    5eac2f8e50be11600727983e05072690a7066702	\
		rmd160  f085c52ec92425f84f65b3f3605cb7aba8be7b32

use_zip		yes
distname	${name}${version}
extract.mkdir	yes

platform darwin 10 {
	# ticket #26181
	patchfiles-append	sim_ether.c.diff
}

use_configure	no

pre-build	{ file mkdir ${worksrcpath}/BIN }

depends_lib	port:libpcap
build.target	"USE_NETWORK=1 all"

build		{
#		system "export OSTYPE"
		system "cd ${worksrcpath} && OSTYPE=darwin make USE_NETWORK=1 all"
}

post-extract	{
		reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/makefile
}

destroot {
		set binaries {altair altairz80 eclipse gri h316 hp2100
		    	      i1401 i1620 i7094 ibm1130 id16 id32 lgp
			      nova pdp1 pdp10 pdp11 pdp15 pdp4 pdp7
			      pdp8 pdp9 s3 sds vax vax780 }
		foreach binary $binaries {
			system "install -c -m 755 ${worksrcpath}/BIN/${binary} ${destroot}${prefix}/bin/simh-${binary}"
		}

		xinstall -d -m 755 ${destroot}${prefix}/share/simh/VAX
		xinstall -c -m 644 ${worksrcpath}/VAX/ka655x.bin ${destroot}${prefix}/share/simh/VAX
}

