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

github.setup        OpenShot libopenshot 0.3.2 v
revision            1
github.tarball_from archive
checksums           rmd160  56febba77be0cc7f837ac26f211c9a6808d3f499 \
                    sha256  58765cfc8aec199814346e97ce31a5618a261260b380670a6fb2bf6f68733638 \
                    size    26132237
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.

# qt5.min_version     ??  # Project does not indicate
qt5.depends_component \
                    qtmultimedia \
                    qtsvg \
                    qtwebkit
depends_lib         port:cppzmq \
                    path:lib/libavcodec.dylib:ffmpeg \
                    port:ImageMagick \
                    port:jsoncpp \
                    port:py311-zmq \
                    port:swig-python \
                    port:libopenshot-audio
#depends_test        port:unittest-cpp \
#                    port:catch2

# fix install path for openshot.py module
# patchfiles          patch_py_mod_path.diff
# 
# post-patch {
#         reinplace -locale C \
#             "s|@@PyModPath@@|${frameworks_dir}/Python.framework/Versions/3.8/lib/python3.8/site-packages|"  \
#             src/bindings/python/CMakeLists.txt
# }

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.11 \
                    -DPYTHON_INCLUDE_DIR:PATH=${frameworks_dir}/Python.framework/Versions/3.11/include/python3.11 \
                    -DPYTHON_LIBRARY:FILEPATH=${frameworks_dir}/Python.framework/Versions/3.11/lib/libpython3.11.dylib \
                    -DPYTHON_MODULE_PATH:FILEPATH=${frameworks_dir}/Python.framework/Versions/3.11/lib/python3.11/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 
