# Template file for 'simh'
pkgname=simh
version=3.9
revision=1
wrksrc=${pkgname}-${version}
create_wrksrc=yes
hostmakedepends="libpcap-devel unzip"
makedepends="libpcap-devel"
short_desc="Emulator for historical computers including PDP-11 and VAX"
maintainer="Daniel James <djames@orcadian.net>"
license="MIT"
homepage="http://simh.trailing-edge.com/"
distfiles="http://simh.trailing-edge.com/sources/simhv39-0.zip"
checksum=e49b259b66ad6311ca9066dee3d3693cd915106a6938a52ed685cdbada8eda3b

do_build() {
	mkdir -p BIN
	make ${makejobs} all \
		OS_CCDEFS="$CFLAGS" \
		OS_LDFLAGS="$LDFLAGS -pthread -lm" \
		USE_NETWORK=1 \
		NETWORK_OPT="-DUSE_NETWORK -isystem ${XBPS_CROSS_BASE}/usr/include -lpcap"
}
do_install() {
	(
		cd BIN
		for b in *; do vbin $b simh-$b; done
	)
	vinstall VAX/ka655x.bin 0644 usr/lib/simh
	sed -n '/Copy/,/written/p' sim_defs.h >LICENSE
	vlicense LICENSE
}
