# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           qmake 1.0
PortGroup           cxx11 1.1
PortGroup           github 1.0

github.setup        pstavirs ostinato 0.9 v
revision            3
maintainers         {g5pw @g5pw} openmaintainer
license             GPL-3+

categories          net devel
description         Ostinato is an open-source, cross-platform network packet \
                    crafter/traffic generator and analyzer with a friendly GUI.
long_description    ${description} Craft and send packets of several streams \
                    with different protocols at different rates.

platforms           darwin

depends_lib         port:qt4-mac \
                    port:libpcap \
                    port:protobuf3-cpp

checksums           rmd160  e1984c471120a37ebe064ddb09df058a19c7481b \
                    sha256  569172cac35a104d5c670304e11c2eec6dfa99f2786130da780173023bf6a56f \
                    size    413820

worksrcdir          ${name}-${version}

# protobuf3-cpp requires c++11
configure.cxxflags-append -std=c++11

# force protobuf3-cpp into the no_threadlocal mode
if { ${os.platform} eq "darwin" && ${os.major} < 11 } {
    configure.cxxflags-append -DGOOGLE_PROTOBUF_NO_THREADLOCAL
}

# qmake is not automatically passing in the stdlib on link
if {[string match *clang* ${configure.cxx}]} {
    configure.ldflags-append -stdlib=${configure.cxx_stdlib}
}

post-destroot {
    move ${destroot}${prefix}/Ostinato ${destroot}${applications_dir}
}