# -*- 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           makefile 1.0
PortGroup           github 1.0
PortGroup           wxWidgets 1.0

github.setup        shumatech BOSSA 1.9.1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball

name                bossa
categories          cross devel
license             BSD
maintainers         {mit.edu:quentin @quentinmit} \
                    openmaintainer
description         Basic Open Source SAM-BA Application
long_description    BOSSA is a flash programming utility for Atmel's SAM \
                    family of flash-based ARM microcontrollers.

homepage            http://www.shumatech.com/web/products/bossa

checksums           sha1    ec911282fe3872769a73195c9e0d6e57b2a6e5b2 \
                    rmd160  729652752baa57dde02ce30608b208ddc753d8c0 \
                    sha256  811b9c6833cb43072fa3f3e76131fb46cbc36d8f7181b8a25085f0f4ba5ae77d \
                    size    544207

default_variants    +wxwidgets
depends_lib-append  port:readline

# Remove default CXXFLAGS so MacPorts can set them.
patchfiles          patch-Makefile \
                    patch-clang_Wunqualified-std-cast-call.diff

# The Makefile is racy
use_parallel_build  no

# "strip" builds the command-line binaries.
build.target        strip-bossac strip-bossash
build.args          VERSION=${version} Q=

destroot {
    xinstall -m 755 -W ${worksrcpath}/bin bossac bossash ${destroot}${prefix}/bin
}

variant wxwidgets description {Build graphical wxWidgets app} {
    wxWidgets.use       wxWidgets-3.0
    build.target-append strip app
    depends_lib-append  port:${wxWidgets.port}
    build.env-append    "PATH=${wxWidgets.wxdir}:${env(PATH)}"
    post-destroot {
        xinstall -m 755 -W ${worksrcpath}/bin bossa ${destroot}${prefix}/bin
        file copy ${worksrcpath}/bin/BOSSA.app ${destroot}${applications_dir}/BOSSA.app
    }
}
