SUMMARY="A simulator for historical computers, such as Vax & PDP-11"
DESCRIPTION="SIMH is a highly portable, multi-system simulator.

SIMH implements simulators for:
- Data General Nova, Eclipse
- Digital Equipment Corporation PDP-1, PDP-4, PDP-7, PDP-8, PDP-9, PDP-10, \
PDP-11, PDP-15, VAX
- GRI Corporation GRI-909, GRI-99
- IBM 1401, 1620, 1130,  7090/7094, System 3
- Interdata (Perkin-Elmer) 16b and 32b systems
- Hewlett-Packard 2114, 2115, 2116, 2100, 21MX, 1000
- Honeywell H316/H516
- MITS Altair 8800, with both 8080 and Z80
- Royal-Mcbee LGP-30, LGP-21
- Scientific Data Systems SDS 940
- SWTP 6800"
HOMEPAGE="http://simh.trailing-edge.com/"
COPYRIGHT="1993-2008 Robert M Supnik"
LICENSE="MIT"
REVISION="3"
SOURCE_URI="https://github.com/simh/simh/archive/18175040523db4d6195d1d32696d4c2178490c11.tar.gz"
CHECKSUM_SHA256="4f6b475188039e209b930b76a58013f14e41da65a1895be0a8714b33d8519070"
SOURCE_DIR="simh-18175040523db4d6195d1d32696d4c2178490c11"
#PATCHES="simh-4.0.0_git.patchset"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	simh$secondaryArchSuffix = $portVersion
	cmd:altair = $portVersion
	cmd:altairz80 = $portVersion
	cmd:eclipse = $portVersion
	cmd:gri = $portVersion
	cmd:h316 = $portVersion
	cmd:hp2100 = $portVersion
	cmd:i1401 = $portVersion
	cmd:i1620 = $portVersion
	cmd:i7094 = $portVersion
	cmd:ibm1130 = $portVersion
	cmd:id16 = $portVersion
	cmd:id32 = $portVersion
	cmd:lgp = $portVersion
	cmd:microvax1 = $portVersion
	cmd:microvax2 = $portVersion
	cmd:microvax3900 = $portVersion
	cmd:nova = $portVersion
	cmd:pdp1 = $portVersion
	cmd:pdp10 = $portVersion
	cmd:pdp11 = $portVersion
	cmd:pdp15 = $portVersion
	cmd:pdp4 = $portVersion
	cmd:pdp7 = $portVersion
	cmd:pdp8 = $portVersion
	cmd:pdp9 = $portVersion
	cmd:rtvax1000 = $portVersion
	cmd:s3 = $portVersion
	cmd:sds = $portVersion
	cmd:ssem = $portVersion
	cmd:swtp6800mp_a = $portVersion
	cmd:swtp6800mp_a2 = $portVersion
	cmd:tx_0 = $portVersion
	cmd:vax = $portVersion
	cmd:vax730 = $portVersion
	cmd:vax750 = $portVersion
	cmd:vax780 = $portVersion
	cmd:vax8600 = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libSDL2_2.0${secondaryArchSuffix}
	#TODO:pcap
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL2$secondaryArchSuffix
	#TODO:pcap
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:find
	cmd:which
	"

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	mkdir -p "$prefix/bin"
	for bin in BIN/*; do
		cp -a "$bin" "$prefix/bin"
	done
}
