# -*- 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

PortSystem 1.0
PortGroup           cmake 1.1

name              simulavr
version             1.1.0
revision            0
checksums           rmd160  6654189a7da966ff31ae859fef4eb753329c17e5 \
                    sha256  8d46a9cf05eb651c3258f720dfc3b967567cdb1a0279f55365e4203eabff9c27 \
                    size    1109235

categories        emulators devel
maintainers       nomaintainer
license             GPL-2+ MIT

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          https://www.nongnu.org/simulavr/
master_sites      https://savannah.nongnu.org/download/simulavr/
# No distfile on normal download server:
# https://savannah.nongnu.org/bugs/?65923
master_sites        http://git.savannah.nongnu.org/cgit/simulavr.git/snapshot/
distname            ${name}-release-${version}

depends_build-append \
                    bin:gzip:gzip \
                    port:help2man \
                    bin:makeinfo:texinfo

depends_lib         port:avr-gcc

patchfiles          doc.patch \
                    include.patch \
                    no-git.patch \
                    no-python.patch

post-patch {
    # https://savannah.nongnu.org/bugs/index.php?65943
    reinplace "s/0\.0\.0/${version}/g" ${worksrcpath}/cmake/get_git_version.sh
    # https://savannah.nongnu.org/bugs/index.php?65947
    delete ${worksrcpath}/include/elfio/VERSION
}

compiler.cxx_standard 2011

configure.args      -DCMAKE_DISABLE_FIND_PACKAGE_PythonInterp=ON \
                    -DDOT=DOT-NOTFOUND \
                    -DDOXYGEN=DOXYGEN-NOTFOUND \
                    -DDPKG=DPKG-NOTFOUND \
                    -DFAKEROOT=FAKEROOT-NOTFOUND \
                    -DVALGRIND=VALGRIND-NOTFOUND

# https://savannah.nongnu.org/bugs/index.php?58231
build.target-append doc

# https://savannah.nongnu.org/bugs/index.php?65948
build.env           DYLD_LIBRARY_PATH=${build.dir}/libsim
test.env            DYLD_LIBRARY_PATH=${build.dir}/libsim

# Tests require python, but allowing python to be found can cause unwanted
# documentation to be built.
# https://savannah.nongnu.org/bugs/index.php?65945
test.run            no
test.target         check

livecheck.type      regex
livecheck.url       https://git.savannah.nongnu.org/cgit/simulavr.git/refs/
livecheck.regex     release-(\[0-9.\]+)[quotemeta ${extract.suffix}]
