# $Id: Portfile 90682 2012-03-12 11:33:16Z jmr@macports.org $

PortSystem 1.0

name		dynamips
version		0.2.7
revision	2
categories	net
maintainers	vexate.net:jstrine
description	Cisco router emulator
homepage	http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator
platforms	darwin

long_description \
		Dynamips emulates a variety of Cisco routers on a \
		traditional PC.  It supports the emulation of select 7200, \
		3600, 3700, and 2600 series routers.  It uses real Cisco \
		IOS images (which are not part of this package).  Of \
		course, this emulator cannot replace a real router. It is \
		simply a complementary tool to real labs for administrators \
		of Cisco networks or people wanting to pass their \
		CCNA/CCNP/CCIE exams.

master_sites	http://www.ipflow.utc.fr/dynamips
distname	dynamips-${version}
checksums	md5 0fe1875bb4e7e3624ca420dd75c85279 \
		sha1 6f65a2e92f5d27aca9d8608369cb20c9539a8121

depends_lib	port:libelf \
		port:libpcap

patchfiles	Makefile.diff
use_configure no

# patch.pre_args set to allow use of unmodified idle_pcs patch from developer
patch.pre_args	-p1

build.pre_args-append		PREFIX=${prefix} CC=${configure.cc}
build.env-append            CFLAGS="${configure.cc_archflags}"
use_parallel_build          no

destroot.pre_args-append	PREFIX=${prefix} CC=${configure.cc}
destroot.env-append         CFLAGS="${configure.cc_archflags}"

if {${build_arch} == "x86_64"} {
	set dynamips_arch amd64
} elseif {${build_arch} == "i386"} {
    set dynamips_arch x86
} else {
    set dynamips_arch nojit
}
build.pre_args-append		DYNAMIPS_ARCH=${dynamips_arch}
destroot.pre_args-append	DYNAMIPS_ARCH=${dynamips_arch}

default_variants	+idle_pcs

variant no_pcap \
	description {Without support to send/receive external traffic} {

	depends_lib-delete		port:libpcap
	build.pre_args-append		HAS_PCAP=0
	destroot.pre_args-append	HAS_PCAP=0
}

variant idle_pcs \
	description {With support for multiple idle-pcs. Uses patch \
		     written by Yannick Le Teigner available at \
		     http://dynagui.sourceforge.net.} {
	
	patchfiles-append	idle_pcs.diff
}
