# -*- 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           qt6 1.0
PortGroup           cmake 1.1
PortGroup           github 1.0
PortGroup           ffmpeg 1.0

github.setup        OpenShot libopenshot 1.0.0 v
revision            0
github.tarball_from archive
checksums           rmd160  06174754fde79083a2975261242b7c097664c42e \
                    sha256  5c5f3790f6f70977f3573b9d039372d5b85bddc46f8944244a6225a79891acf2 \
                    size    27227731
homepage            https://www.openshot.org/
categories          multimedia devel
license             GPL-3+
# qt-qtmultimedia, qt-svg, qt-qtwebkit all have OpenSSLException
# does not link with or use anything else that depends on openssl
license_noconflict  openssl openssl10 libpaper
maintainers         nomaintainer

description         Library for creating and editing videos
long_description    {*}${description}. Includes python bindings but not ruby.

ffmpeg.version      8

qt6.depends_lib     qtsvg

depends_build-append \
                    port:cppzmq \
                    port:swig-python

depends_lib         path:lib/pkgconfig/babl-0.1.pc:babl \
                    port:ImageMagick \
                    port:jsoncpp \
                    port:python314 \
                    port:libopenshot-audio \
                    port:zlib \
                    port:zmq

#depends_test        port:unittest-cpp \
#                    port:catch2

patchfiles          patch-cmake.diff

# https://github.com/OpenShot/libopenshot/pull/1092
patchfiles-append   patch-fix-build.diff

compiler.openmp_version 4.0
if {[info exists compiler.log_verbose_output]} {
    compiler.log_verbose_output no
} else {
    configure.cppflags-append -fopenmp
    configure.ldflags-append  -fopenmp
}

configure.args-append \
                    -DDISABLE_TESTS=ON \
                    -DPYTHON_EXECUTABLE:FILEPATH=${prefix}/bin/python3.14 \
                    -DPYTHON_INCLUDE_DIR:PATH=${frameworks_dir}/Python.framework/Versions/3.14/include/python3.14 \
                    -DPYTHON_LIBRARY:FILEPATH=${frameworks_dir}/Python.framework/Versions/3.14/lib/libpython3.14.dylib \
                    -DPYTHON_MODULE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/3.14/lib/python3.14/site-packages

# ruby bindings - if ruby27, need swig 4.0.3 which is not currently in MacPorts
# depends_build-append \
#                     port:ruby26 \
#                     port:py38-protobuf3

# swig ruby bindings fail to build
configure.args-append \
                    -DENABLE_RUBY=OFF
