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

github.setup        pstavirs ostinato 0.9 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            7
maintainers         nomaintainer
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.

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
compiler.cxx_standard 2011
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.cxx_stdlib} ne ""} {
    configure.ldflags-append -stdlib=${configure.cxx_stdlib}
}

post-extract {
    move   ${worksrcpath}/extra/qhexedit2/src/VERSION \
           ${worksrcpath}/extra/qhexedit2/src/VERSION.txt
}

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