# Template file for spim
pkgname=spim
version=8.0
revision=1
build_wrksrc=spim
build_style=configure
configure_script="./Configure"
make_install_target="install install-man"
homepage="http://spimsimulator.sourceforge.net/"
license="BSD"
distfiles="http://pages.cs.wisc.edu/~larus/SPIM/spim-${version}.tar.gz"
checksum="6f205776cb9fa112729507008843b289012190ed3131cbd426c610a58387ee4b"
maintainer="Toyam Cox <vaelatern@gmail.com>"
hostmakedepends="flex"
short_desc="Self-contained simulator/debugger that runs MIPS32 programs"

pre_configure() {
	sed '/Copyright (c) 1990-2010, James R. Larus./,+26!d' README > LICENSE
	sed -i Makefile \
		-e 's:CFLAGS =:CFLAGS +=:' \
		-e 's:LDFLAGS =:LDFLAGS +=:' \
		-e 's:CC = gcc:CC ?= gcc:' \
		-e "s:BIN_DIR = .*:BIN_DIR = ${DESTDIR}/usr/bin/:" \
		-e "s:EXCEPTION_DIR = .*:EXCEPTION_DIR = ${DESTDIR}/usr/share/spim/:" \
		-e "s:MAN_DIR = .*:MAN_DIR = ${DESTDIR}/usr/share/man/man1/:" \
		-e "s:spim.man:spim.1:"
	mv ../Documentation/{spim.man,spim.1}
}

post_install() {
	vlicense LICENSE
}
