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

github.setup        smplayer-dev smplayer 25.6.0 v
revision            1
categories          multimedia aqua
license             GPL-2+
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer

homepage            https://www.smplayer.info
description         SMPlayer is a free media player for Windows, Linux and MacOS
long_description    ${description} with Youtube support.
checksums           rmd160  f011be44b785b4153392372e3621ef09a103a621 \
                    sha256  f42a58ac3fbef8e23c1ad102bd0169a190b6cfa826f07f2070b7407e12e1580f \
                    size    6912691
github.tarball_from archive

# Match mpv:
set ffmpeg_v        7

patch.pre_args-replace  -p0 -p1

patchfiles-append   ffmpeg${ffmpeg_v}.patch

# Fix broken linking
patchfiles-append   iokit.patch

# main.cpp:24:10: fatal error: 'QSurfaceFormat' file not found
# myapplication.h:80:14: error: field has incomplete type 'QStringList'
patchfiles-append   qt4-gl-window-fix.patch

post-patch {
    reinplace "s|@FFMPG_ROOT@|${prefix}/libexec/ffmpeg${ffmpeg_v}|g" \
                    ${worksrcpath}/src/${name}.pro
}

depends_lib-append  port:ffmpeg${ffmpeg_v} \
                    port:zlib

depends_run-append  path:bin/mpv:mpv

configure.dir       ${worksrcpath}/src
build.dir           ${worksrcpath}/src

destroot {
    copy ${worksrcpath}/src/smplayer.app ${destroot}${applications_dir}/
}
