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

github.setup        tsduck tsduck 3.44-4676 v
github.tarball_from archive

categories          multimedia
license             BSD
maintainers         {mit.edu:quentin @quentinmit} \
                    openmaintainer
description         MPEG Transport Stream Toolkit
long_description    MPEG Transport Stream Toolkit

homepage            https://tsduck.io/

checksums           rmd160  e645d93c2e80ada63e103f0bf5a3a655bb140de5 \
                    sha256  22a6be2fdaa1714200c5ce0640dba551a9be9e2b2b8fb53067224ebf80c7c30e \
                    size    5302977

depends_build-append port:gsed

depends_lib-append  port:curl

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15

# PCSC requires pcsc-lite
# SRT requires libsrt
# Neither of these are currently available in macports
# Makefile.tsduck sets -install_name @rpath/$(notdir $@) and
# -rpath @executable_path, which are not compatible with the installed
# layout in $prefix.
set args            "NODOC=1 NOPCSC=true NOSRT=true CFLAGS_EXTRA='-Wno-unknown-warning-option -Wno-unknown-pragmas -Wno-missing-include-dirs -Wno-old-style-cast' CXXFLAGS_EXTRA='-Wno-unknown-warning-option -Wno-unknown-pragmas -Wno-missing-include-dirs -Wno-old-style-cast' LDFLAGS_EXTRA=-Wl,-rpath,@executable_path/../lib"

build.target        default
build.args          NOTEST=true ${args}

destroot.target     install install-devel
destroot.args       NOTEST=true ${args} "SYSROOT=${destroot}" "SYSPREFIX=${prefix}"

test.run        yes
test.args       ${args} LDFLAGS_EXTRA=-Wl,-rpath,@executable_path
