# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
categories emulators devel
description Simulator for Atmel AVR microcontrollers
long_description The SimulAVR program is a simulator for the Atmel AVR family \
of microcontrollers. (ATtiny and ATmega) SimulAVR can be used \
either standalone or as a remote target for avr-gdb.
homepage http://www.nongnu.org/simulavr/
master_sites http://savannah.nongnu.org/download/simulavr/
checksums rmd160 0e9eb32f398943449b564e919765348c32f4c600 \
sha256 39d93faa3eeae2bee15f682dd6a48fb4d4366addd12a2abebb04c99f87809be7
depends_build bin:makeinfo:texinfo
depends_lib port:avr-binutils \
patchfiles patch-src_systemclock.cpp \
# Hack the swig macro into detecting a modern version of swig
reinplace "s|required=1.3.18|required=3.0.8|g" ${worksrcpath}/configure
# Apply changes from http://savannah.nongnu.org/bugs/?35737 to fix building
# against the later avr-libc releases
"s/SIG_INTERRUPT0/INT0_vect/"
"s/SIG_INTERRUPT1/INT1_vect/"
"s/SIG_INTERRUPT2/INT2_vect/"
"s/SIG_OUTPUT_COMPARE2/TIMER2_COMP_vect/"
"s/SIG_OUTPUT_COMPARE2A/TIMER2_COMPA_vect/"
"s/SIG_OUTPUT_COMPARE3B/TIMER3_COMPB_vect/"
"s/SIG_UART0_RECV/USART0_RX_vect/"
"s/SIG_UART0_DATA/USART0_UDRE_vect/"
"s/__attribute__((progmem))/PROGMEM/"
"s/__attribute__ ((progmem))/PROGMEM/"
fs-traverse fpath ${worksrcpath} {
set ext [file extension "${fpath}"]
if {[file isfile "${fpath}"] && ($ext == ".c" || $ext == ".h" || $ext == ".cpp")} {
reinplace -locale C $r $fpath
reinplace "s|^static char unshifted|static const char unshifted|" ${worksrcpath}/examples/atmel_key/scancodes.h
reinplace {s|prog_char shifted\[\]\[2\]|static const char shifted\[\]\[2\] PROGMEM|g} ${worksrcpath}/examples/atmel_key/scancodes.h